Thursday, April 25, 2024

MatLab operators

Must read

An operator is an image that tells the compiler to carry out numerous numerical or logical manipulations. MATLAB is designed to perform especially on complete matrices and arrays.

Arithmetic Operation:

There are specific form of mathematics operators in matlab they are:

  • Matrix mathematics operation.
    • Array mathematics operation.

 Arithmetic operator are used to carry out matrix manipulation, it used for performing smooth mathematics operation which is probably together with numbers, subtraction, division, Array mathematics operations are executed detail via way of way of detail, and may be used with multidimensional arrays, each operands need to be the identical size.

Matrix operations observe the rules of linear algebra. By contrast, array operations execute detail via way of way of detail operations and help multidimensional arrays. The character (.) defines the array operations from the matrix operations.

+     Addition. A+B adds A and BA and B must have the identical size, except one is a scalar. A scalar may be added to a matrix of any size.

-     Subtraction or unary minus. A-B subtracts B and AA and B must have the identical size, except one is a scalar. A scalar can perform multiplication of a matrix of different or same size.

*   The matrix multiplication of fabricated from matrices may be calculated with the formula, C = A*B.

For nonscalar A and B, the fashion of columns of A want to identical to the fashion of rows of B.

.*    Array multiplication or Element-sensible multiplication, A.*B is the detail-via way of way of-detail fabricated from the arrays A and B.A and B want to have the identical size.

 /       Matrix right division, B/A is quite same as B*inv(A). they will more precisely, B/A = (A'\B')'.

./      Array right division. A./B is the matrix with elements A(i,j)/B(i,j). Aand B must have the identical size, except truly considered one in every of them is a scalar.

.\Array left division. A.\B is the matrix with elements B(i,j)/A(i,j). A and B must have the identical size, except truly considered one in every of them is a scalar. .\

.\   Array left division. A.\B is the matrix with elements B (i,j)/A(i,j)A and B must have the identical size, except truly considered one in every of them is a scalar.

    '       Matrix transpose. A'is the linear algebraic transpose of A. For complicated matrices, that is the complex conjugate transpose.

   .'     Array transposeA.' is the array transpose of A. For complicated matrices, this does not comprise conjugation.

Logical Operators

Logical operator performs logical operation and provides it output in the form of boolean i.e., true or false. Matlab has three types of logical operators they are:

  • Element-wise operator.
  • Bit- wise operator.
  • Short-circuit.

Element wise operator performs element wise logical operation on the input same sized output array.

&   Logical AND It returns 1 for every element location that is true (notzero) in both arrays and 0 for all other elements. For example.

A = [0 1 1 0 1];
B = [1 1 0 0 1];

A & B = 01001

|    Logical OR It returns 1 for each detail area this is real (nonzero) in every one or the wonderful, or each arrays, and zero for all wonderful elements. For example

A = [0 1 1 0 1];
B = [1 1 0 0 1];

A| B=11101

   ~     Logical NOT It complements the input array of each given element, A.

A = [0 1 1 0 1];
B = [1 1 0 0 1];

~A = 10010

Xor   It returns 1 for every element location that is true (notzero) in only one array, and 0 for all other elements.

A = [0 1 1 0 1];
B = [1 1 0 0 1];

Xor (A, B)=10100

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -

Latest article