Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inequation in Matlab

Status
Not open for further replies.

Rodrigo245

Computer
Aug 6, 2006
9
Is it possible to solve inequation in Matlab? I mean, like this:

x + 3 < 2


Is this possible and if it is, how to do it?
 
Replies continue below

Recommended for you

HAve you bothered looking at the help files?

TTFN



 
Of course, I've tried help first with the word "inequation" - nothing found.

If you know how to find the answer from help, please tell me. Because English is not my first language and finding appropriate phrases can be sometimes difficult.
 
inequation is not a word. Perhaps you meant inequality. Or you could search on the symbols i.e. ">". The Maple symbolic toolbox will help for an actual solution. I MATLAB you can iterate on your own to find solutions or use the fmin and simular search functions. They are are documented and have examples right in the help files.

jsolar
 
I've tried both: wiht "inequality" and with sign ">" and other signs for inequlity. Nothing came out. Any more ideas?
 
You should get something like what is below. Maybe your installation is bad. Conatact the mathworks and give them your licence codes and the response from typing "ver" at the command prompt. THe Mathworks also supplies their help on line. If you are using the student version your results might be different.

>> help >
Operators and special characters.

Arithmetic operators.
plus - Plus +
uplus - Unary plus +
minus - Minus -
uminus - Unary minus -
mtimes - Matrix multiply *
times - Array multiply .*
mpower - Matrix power ^
power - Array power .^
mldivide - Backslash or left matrix divide \
mrdivide - Slash or right matrix divide /
ldivide - Left array divide .\
rdivide - Right array divide ./
kron - Kronecker tensor product kron

Relational operators.
eq - Equal ==
ne - Not equal ~=
lt - Less than <
gt - Greater than >
le - Less than or equal <=
ge - Greater than or equal >=

Logical operators.
Short-circuit logical AND &&
Short-circuit logical OR ||
and - Element-wise logical AND &
or - Element-wise logical OR |
not - Logical NOT ~
xor - Logical EXCLUSIVE OR
any - True if any element of vector is nonzero
all - True if all elements of vector are nonzero

Special characters.
colon - Colon :
paren - Parentheses and subscripting ( )
paren - Brackets [ ]
paren - Braces and subscripting { }
punct - Function handle creation @
punct - Decimal point .
punct - Structure field access .
punct - Parent directory ..
punct - Continuation ...
punct - Separator ,
punct - Semicolon ;
punct - Comment %
punct - Invoke operating system command !
punct - Assignment =
punct - Quote '
transpose - Transpose .'
ctranspose - Complex conjugate transpose '
horzcat - Horizontal concatenation [,]
vertcat - Vertical concatenation [;]
subsasgn - Subscripted assignment ( ),{ },.
subsref - Subscripted reference ( ),{ },.
subsindex - Subscript index

Bitwise operators.
bitand - Bit-wise AND.
bitcmp - Complement bits.
bitor - Bit-wise OR.
bitmax - Maximum floating point integer.
bitxor - Bit-wise XOR.
bitset - Set bit.
bitget - Get bit.
bitshift - Bit-wise shift.

Set operators.
union - Set union.
unique - Set unique.
intersect - Set intersection.
setdiff - Set difference.
setxor - Set exclusive-or.
ismember - True for set member.

See also arith, relop, slash, function_handle.

jsolar
 
My friend I've tried everything you said to me. It is not a problem comparing two matrices - but how to compre two functions? Like this:

y = x + 1
y1 = x + 3

y < y1


Can Matlab find solutions here? This is my problem. And I've got the error that "it is not working with syms variables"
 
The answer to what you have written is Boolean 1. You really are going to have to explain what you want in far more detail if you want a helpful answer.

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
What exactly are you trying to accomplish? Are you looking for that actual algebraic solution, in which case you are are SOL without the Symbolic Toolbox. Or are you simply looking for the boolean answer to y < y1, in which case you should be using an if statement.

Is this for a class? I'm finding it hard to believe that at computer professional can't answer this question.

TTFN



 
Are you looking for the range of z for which the inequality is valid? If so the following Maple in MATLAB should help. If you waqnt to know the boolean as GregLocock said you can use the results for x and make a judgement.

The first statement says that the inequality holds for all values of x. The second says for none.

maple( 'y1:=x+1: y3:=x+3: solve(y1<y3,x)' )

ans =

x

>> maple( 'y1:=x+1: y3:=x+3: solve(y1>y3,x)' )

ans =

''

jsolar
 
VisiGoth thanks a lot. I thought for myself that people will never understand what I need and that this cannot be done with matlab.

God bless you and a warm greeting from Slovenia,

Frenky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor