/ Friday, 23 June 2017 / No comments / ,

How to perform Basic Math functions in MATLAB commonly used functions Quick Guide

The basic math functions addition , subtraction , division , multiplication, matrix addition multiplication in MATLAB. How to take matrix transpose in matlab .how to take inverse of matrix in matlab.


In this Quick Tutorial we will see some of the example of basic math functions in MATLAB. Before that there is quick overview about MATLAB , its uses,benefits and What can be done with a MATLAB.
So let's start with a Quick guide of a MATLAB.
Here is the list of contents:

Contents:

  1.  A Quick introduction to MATLAB
  2.  Commonly used mathematical Calculations
  3. Uses of MATLAB
  4. How to perform addition in MATLAB
  5. How to perform Subtraction in MATLAB
  6. How to perform Multiplication in MATLAB
  7. How to perform division in MATLAB
  8. How to perform square root in MATLAB
  9. How to perform Matrix addition subtraction and multiplication,Transpose and inverse in MATLAB
  10. Conclusion

1-Introduction to MATLAB:

MATLAB is developed by MathWorks.A high level Programming language software used for Numerical computation.Most of the computational math work, algorithms,Complex Engineering problems,Graphs and system design equations can be done with MATLAB.
It also has other great features of designing a control system using it's Simulink library.


2-Commonly Used Mathematical Calculations in MATLAB:

The Commonly used mathematical calculations are:
  1. Numerical Computation
  2. Calculus and deferential equations
  3. Integration
  4. Linear Algebra and algebraic Equations
  5. Non-Linear functions
  6. Matrices and arrays
  7. Statistics 
  8. Data analysis
  9. Transforms 
  10. Curve fitting
  11. 2-D and 3-D graph plotting

3-Uses of MATLAB:

As a computational tool MATLAB is widely used in almost all Engineering fields. Other than Engineering MATLAB is also used in physics,Chemistry and maths.
The applications fields of MATLAB are:
  1. Control systems
  2. Tests and measurements
  3. Signal processing and communication
  4. image and video Processing
  5. Computational Finance and Biology

 4-How to perform Addition in MATLAB:

Performing most of the simple functions are quite similar with C and C++ language:
For example to add:
A= 2 , 3 ;
B = 3, 4 ;
C= A+B;
it's quite simple..!
For an array we write in matlab as:

A= [ 1 2 ; 3 4];
B= [3 4  ; 5 6 ];

C= A + B adds array A and B and stores the result in C

The semicolon in the center shows that the row has changed.We write columns without any comma's and To move into the second row the semicolon is used.Semicolon at the end shows the functions is over as we did in the C language.

 5-How to perform Subtraction in MATLAB:

The Same procedure is used for subtraction:
A=[2 3; 4 5];
B= [5 6 ; 7 8 ];
C= A-B

 6-How to perform Multiplication in MATLAB:

The element wise multiplication in matlab uses the times command:

times or .*

C = A.*B
C = times(A,B)

C= A.*B multiplies Array A and B Elements by elements 

A= [2 3 ; 4 5 ];
B= 4 5 ; 6 7];

C=A.*B

 7-How to perform Division in MATLAB:

The simple division in matlab uses rdivide command:

rdivide or ./

C= rdivide (a,b)
C= a./b

c=a./b performs division of each element of array a with each element of array b.

 8-How to perform Square Root in MATLAB:

Taking square Root is quite simple in matlab:
The square root uses the sqrt command:

A=sqrt(X)

it takes the square root of the elements of array X and stores the result in A.

9-How to perform Matrix addition subtraction and multiplication,Transpose and inverse in MATLAB

Now comes to the Matrix Part.The matrix addition and subtraction inverse and transpose etc.

Matrix Addition and subtraction Multiplication and Division in MATLAB:

There is no special command for addition and subtraction:
The division command uses / or \  slash both have same results:

A=[ 1 2 ; 3 4 ; 5 6 ];
B= [3 4 ; 5 6 ; 8 9 ];
C= A+ B
D= A-B
E= A* B
F = A/B

The result will be shown in the matrix form.

Transpose of a matrix in MATLAB;

Transpose opertaion switches rows and coloumn in a matrix.The command used for transpose in MATLB is a single (')

A= [2 3 4 ; 4 5 6 ; 7 8 6 ];
B= A'

Inverse of Matrix in MATLAB:

Taking inverse is quite simple by typing inv ()

A= [2 3 4 ; 5 6 7 ; 6 7 8];
inv(A)

or 
B=inv (A)

The result will be shown in vector B.

Conclusion:

In this quick Tutorial we will see some basic concepts of MATLAB. How to perform the basic math funnctions.We will come up with detail overview of MATLAB with Step by step guide of each and everything in coming Tutorials. Stay connected for further Tutorials. 

Share This Post :
Tags : ,
Related Posts

No comments:

Post a Comment

Social Media

Popular Posts