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

1 回表示 (過去 30 日間)
suvadip paul
suvadip paul 2013 年 10 月 4 日
コメント済み: suvadip paul 2013 年 10 月 10 日
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 件のコメント
Walter Roberson
Walter Roberson 2013 年 10 月 5 日
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 2013 年 10 月 10 日
Ya Walter got it right

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 10 月 5 日
myprogram([2 -5;4 -6],[6 -7], {'<=', '>='})
  2 件のコメント
suvadip paul
suvadip paul 2013 年 10 月 5 日
I am not clear how to use it.
function myprogram(A,b,?)
An example Please
Walter Roberson
Walter Roberson 2013 年 10 月 5 日
編集済み: Walter Roberson 2013 年 10 月 5 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by