A Brief Introduction to MATLAB and MATLAB * operator?

Do you want to learn MATLAB? But, still confused about some questions. Like, What can I do with MATLAB? Who uses MATLAB? Is MATLAB hard to learn? What is the MATLAB * operator? Then Don’t Worry! This blog will help you to clear your confusion about these questions step by step. 

What is MATLAB?

MATLAB is a programming platform, non-free software to classify programming language and numerical analysis based on their features. MATLAB is a matrix-based language that is very useful for engineers and scientists worldwide to design any new product or system for data analysis, developing algorithms, matrix manipulation & creating models and applications, tests and measurements, computational finance, and biology.

Features of MATLAB:

  • MATLAB is a high-level programming language for mathematical analysis and applications and algorithms development.
  • It’s very helpful for performing mathematical functions for linear algebra, statistics, numerical integration, Fourier analysis & solving ordinary differential equations.
  • Neuroscientists also use MATLAB to analyze their experimental data, neural time series ( Time-Frequency, Multi-Resolution Analysis, and Signal Analysis) data from electrode signal recordings and run experiments.
  • It’s also beneficial for analyzing images and volume at neurons, processing and generating live data brooks, use for the machine and deep learning and simulate models of brain circuits.

MATLAB operators

Operators are symbols that tell the compiler ( A program that can convert programming language to machine language) to perform any logical function or any specific mathematical calculation. As MATLAB is a matrix-based language, it is designed to operate mostly whole matrices and arrays. 

There are some following types of operators that MATLAB allows:

  • Arithmetic Operators: Arithmetic operators are used in simple operations like addition, subtraction, multiplication, and standard calculations such as summation, modulo operation, and rounding.
  • Relational Operators: Relational operators compare the element in two arrays and produce the logical value true or false to indicate the relation. 
  • Logical Operators: The logical data operator is used to present true or false status with the help of numbers 1 and 0. 
  • Bitwise Operations: The bitwise operator is used to turn the bit design of numbers. 
  • Set Operations: The set operator compares the element in two sets to find the difference and commonalities between them. 

In this blog, we will discuss MATLAB * operator deeply.

MATLAB * Operator 

MATLAB * operator is called Matrix Multiplication operator. It is a linear algebraic result of any two matrices. MATLAB * multiplication for non-scalar matrices A and B, the size of the matrices must be equal. The representation of rows of A must equal the representation of columns of B. Let’s consider matrices A and B and can calculate the product of these two matrices. 

       A=[ 2 4; 6 8]

      A = 2 4

            6 8 

      B=[3 5; 7 9]

     B = 3 5 

             7 9 

A*B = 34 46 

             74 102

MATLAB * operator under the arithmetic operator’s community. MATLAB has two varieties of arithmetic operators;

  • Array Operations:  It’s an arrangement of objects and numbers in rows and columns. An array is also a helpful presentation of multiplication concepts in mathematics and executes element-wise operations.
OperatorPurposeDescription
+AdditionA+B adds A and B.
+Unary plus+A returns A.
SubtractionA-B subtracts B from A
Unary minus-A negates the elements of A.
.*Element-wise multiplicationA.*B is the element-by-element product of A and B.
.^Element-wise powerA.^B is the matrix with elements A(i,j) to the B(i,j) power.
./Right array divisionA./B is the matrix with elements A(i,j)/B(i,j).
.\Left array divisionA.\B is the matrix with elements B(i,j)/A(i,j).
.’Array transposeA.’ is the array transpose of A. For complex matrices, this does not involve conjugation.

For example, 

Consider two vectors of the same size A and B, and add them element-wise. 

A = [1 2 3 ]

A = 1 2 3 

B = [2 4 6 ]

B = 2 4 6 

A+B 

ans. = 3 6 9 

Or, if we add a 2-by-1 vector to a 1-by-3 vector, it produces a 2-by-3 matrix.

For example, 

X = [15; 7]

Y = [2 3 4]

Then, X+Y = 

ans. = 17 18 19 

             9 10 11 

 There are some arithmetic operators in the following table; 

  • Matrix Operations:  It’s a collection of numbers( elements or entries) placed in rows and columns, forming a rectangular array. Matrix is also known as a 2D array that follows the rule of linear algebra. 

For example, 

A = [ 1 2; 3 4 ] 

B = [0 3; 5 1 ]

A*B =  

ans. = 10 5 

             20 13 

Or if we can calculate its element-wise product, then. 

A.*B = 

ans. = 0 6

             15 4 

Difference Between MATLAB * operator and .* operator. 

* operator

It is known as the Matrix Multiplication operator, which supports the rule of linear algebra. For scaler, the matrix A can be multiplied by any size of matrix B. But for non-scaler, the size of matrices must equal each other. 

.* operator

It is known as Array Multiplication Operator, which supports element-by-element multiplication. For array multiplication, the size of Matrices A and B must be equal. 

For example, 

A = [ 1 0; 2 4 ] 

B = [3 1; 0 1 ]

Then, A*B = 

ans. = 3 1 

              6 6

For, A.*B =

ans. = 3 0

            0 4

Conclusion

As we have discussed above, the MATLAB and MATLAB * operator and clear all the confusion related to MATLAB. MATLAB is not very hard to learn. It is easy to use. You will also find several books that will help you in learning MATLAB. At last, it depends on you, if you are going with MATLAB or not? If yes, then start writing code now.  

Frequently Asked Questions

What does * do in Matlab?

* is an operator in MATLAB known as Matrix Multiplication Operator, which follows the rule of linear algebra. It is used for the multiplication of the matrices. For non-scaler, Matrices A and B must be equal in size.

Is Matlab free for students?

MATLAB is non-free software, and also there is no free version of MATLAB for students. If you want to learn MATLAB, you will need to purchase the license or ask your institution to provide the license to students.

Leave a comment