MATLAB Online Class #2: Fundamentals of MATLAB Relational Operators

0
83

MATLAB Relational operators is a logical array equation which performs element-by-element comparisons between two or more arrays based on array logical equation and returns a logical array of the same size with elements set to logical 1 and elements set to logical 0 where it is not.

Relational Operators are used in both real and Imaginary equations, which should be the same size either use real or imaginary, it doesn’t matter, the function should be element by element only.

MATLAB Relational Operator Description in Details Functions
< Less than lt
<= Less than or equal to le
> Greater than gt
>= Greater than or equal to ge
== Equal to eq
~= Not equal to ne
~ Nearest Value Used NA

For Example:

A = [1 2 3; 8 9 16]

A =

1 2 3
8 9 16

B = [4 7 9; 10 0 4]
B =

     4 7 9
     10 0 4
A < B
ans =

     1     0     1
     1     0     0
Likewise, if the output value is 1 (True) and If the Output Value is 0 (False).
these two conditions are follows

Let See One More Operation:

=B > 9

B = 

0 0 0 

1 0 0

Tha MATLAB Relational Operators are combination of Real part and imaginary part Values and these values are separated in two ways as shown in below formats,

  • The operators ><>=, and <= use only the real part of the operands in performing comparisons.
  • The operators == and ~= test both real and imaginary parts of the operands.

NOTE:

Remeber, two array elements should be same in size and all values are either in real or imaginary (A+iB). Where A is a real value and B is an imaginary value (i value treated as a negative either it is in minus or positive symbol). 

How to Use in MATLAB on Project Based Functions:

Say any equation, x=a+ib (a is real and b is imaginary values); another equation is y=c+id (c is a real and d is an imaginary); Both x and y equations are the same size (taken the same size for an element by element operations purpose). When using relational operators on MATLAB, try above equations by replacing constant values in a,b,c,d, you’ll get plenty of output values in Command window. try once and comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here