filmov
tv
MATLAB Theory of Relational operators, Logical operators, Order of precedence in MATLAB|| Lecture 10

Показать описание
This lecture contains the following topics:
Relational operators in MATLAB
Logical operators in MATLAB
Order of precedence in MATLAB
_____________________________
Relational Operator Description
Less than
Greater than
Less than or equal to
Greater than or equal to
= = Equal to
~= Not Equal to
Logical Operator Name Description
&(Ex: A&B) AND Operates on two operands (A and B). If both are true, the
result is true (1); otherwise the result is false (0).
|(Ex: A|B) OR Operates on two operands (A and B). If either one, or
both, are true, the result is true (1); otherwise (both are
false) the result is false (0).
~(Ex: ~A) NOT Operates on one operand (A). Gives the opposite of the
operand; true (1) if the operand is false, and false (0) if
the operand is true.
Precedence Operation
1 (highest) Parentheses (if nested parentheses exist, inner ones have precedence)
2 Exponentiation
3 Logical NOT (~)
4 Multiplication, division
5 Addition, subtraction
6 Relational operators
7 Logical AND (&)
8 (lowest) Logical OR ( | )
_____________________
OTHER LECTURES
____________________
#cbcsmath
#matlabProgramming
#numericalPractical
Contact me:
Relational operators in MATLAB
Logical operators in MATLAB
Order of precedence in MATLAB
_____________________________
Relational Operator Description
Less than
Greater than
Less than or equal to
Greater than or equal to
= = Equal to
~= Not Equal to
Logical Operator Name Description
&(Ex: A&B) AND Operates on two operands (A and B). If both are true, the
result is true (1); otherwise the result is false (0).
|(Ex: A|B) OR Operates on two operands (A and B). If either one, or
both, are true, the result is true (1); otherwise (both are
false) the result is false (0).
~(Ex: ~A) NOT Operates on one operand (A). Gives the opposite of the
operand; true (1) if the operand is false, and false (0) if
the operand is true.
Precedence Operation
1 (highest) Parentheses (if nested parentheses exist, inner ones have precedence)
2 Exponentiation
3 Logical NOT (~)
4 Multiplication, division
5 Addition, subtraction
6 Relational operators
7 Logical AND (&)
8 (lowest) Logical OR ( | )
_____________________
OTHER LECTURES
____________________
#cbcsmath
#matlabProgramming
#numericalPractical
Contact me: