How can I specify the inequality signs in the function call?

3 Ansichten (letzte 30 Tage)
suvadip paul
suvadip paul am 4 Okt. 2013
Kommentiert: suvadip paul am 10 Okt. 2013
My program is like that
if 2x-5y-6<=0 && 4x-6y+7>=0
........
end
I want a function file for that.
function myprogram(A,b)
I will run it as
>> myprogram([2 -5;4 -6],[6 -7]) How can I specify the inequality signs in the function call
  4 Kommentare
Walter Roberson
Walter Roberson am 5 Okt. 2013
It is the matrix inequality
A*x - b ? 0
where the ? operator may be different for every row and suvadip paul wishes the choice of inequality operators to be user input.
suvadip paul
suvadip paul am 10 Okt. 2013
Ya Walter got it right

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 5 Okt. 2013
myprogram([2 -5;4 -6],[6 -7], {'<=', '>='})
  2 Kommentare
suvadip paul
suvadip paul am 5 Okt. 2013
I am not clear how to use it.
function myprogram(A,b,?)
An example Please
Walter Roberson
Walter Roberson am 5 Okt. 2013
Bearbeitet: Walter Roberson am 5 Okt. 2013
function myprogram(A, b, user_inequalities)
If you want to figure out which inequality characters were given, use strcmp() or ismember()
Hint: you do not need all four operators. P > Q is the same as -P < -Q

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by