- Back to Home »
- MAT LAB »
- Introduction To MATLAB
Posted by : Unknown
Tuesday, October 1, 2013
MAT LAB is a high level language used for analyze data, perform different mathematical operations and create models and different applications. MAT LAB Provides us a quick way to solve any mathematical problem. It's a best and quick way to solve any mathematical problem.
Some Useful MAT LAB Commands:
Matrices:
· Row Matrix:
For
a single row matrix we use a single variable to display value. E.g.
>>a= [1, 2,
3]
a =
1
2 3
· Column Matrix:
For
a single column matrix we use a single variable to display value. To display
column matrix we use “;”.E.g.
>>a=[1;2;3]
>>a=[1;2;3]
a
=
1
2
3
3
· Row, Column Matrix:
For a Row, Column Matrix we use a single variable to display value. To display
column matrix we use “;”.E.g.
>>a=
[1, 2, 3;4, 5, 6]
a = 1 2
3
4
5 6
- Multiply
a constant with Matrix :
>>
a=2*[1, 2, 3; 4, 5, 6]
a
=
2
4 6
8
10
12
· Operation of two Matrices:
For basic mathematical operation such as
multiplication, addition, subtraction , the procedure is the same except the
operator changes.i.e ‘+’’-’’*’’/’
E.g
E.g
To multiply two matrices we use “*” operator.
>> a=[1,2,3;3,4,5;6,7,8]
a
= 1 2 3
3 4
5
6
7 8
>> b= [1;2;3]
b =
1
>> b= [1;2;3]
b =
1
2
3
>> a*b
ans =
14
>> a*b
ans =
14
26
44
Inverse
Of a Matrix :
To
find inverse of a matrix , we use “inv()” for inverse of a matrix.E.g.
>>a= [1, 2; 3, 4]
a =
1
2
3
4
>> inv (a)
ans =
-2.0000 1.0000
1.5000 -0.5000
Trigonometric Functions:
To find trigonometric functions we use “sind(), cosd() , tan(), “ and for their invers we use “asin(), acos(), atan()”.
E.g.
>> sind(30)
ans =
0.5000
Plot:
For plotting a graph on
Matlab use “plot” command.
x = linspace(-2*pi, 2*pi);
x = linspace(-2*pi, 2*pi);
y1 = sin(x);
y2 = cos(x);
plot(x,y1,x,y2)
Help:
“Look For” is used to find about any information about a command or
function used in Matlab.
E.g.
>> lookfor sin
>> lookfor sin
acos - Inverse cosine, result in radians.
acosd - Inverse cosine,
result in degrees.
acosh - Inverse hyperbolic
cosine.
asin - Inverse sine, result in radians.
asind - Inverse sine, result
in degrees.
asinh - Inverse hyperbolic
sine.
cos - Cosine of argument
in radians.
cosd - Cosine of argument in degrees.
cosh - Hyperbolic cosine.
sin - Sine of argument
in radians.
sind - Sine of argument in
degrees.
sinh - Hyperbolic sine.