필터 지우기
필터 지우기

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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by