A simple code for introducing with MATLAB (Matrix Laboratory) software.
Experiment No: 1
Name of Experiment: Introduction to MATLAB
Objective:
1) Introduction to MATLAB.
2) Know about what is MATLAB
3) Study basic operation of MATLAB.
Answer to the Question no 1:
MFILE:
for z=1:2:15
y=(z^3+5*z)/(4*(z^2)-10)
end
Output:
y =
-1
y =
1.6154
y =
1.6667
y =
2.0323
y =
2.4650
y =
2.9241
y =
3.3964
y =
3.8764
Answer to the Question no 2:
MFILE:
a=[4 -2 6 ;2 8 2 ;6 10 3 ]
b=[8;4;0]
x=inv(a)*b
Output:
a =
4 -2 6
2 8 2
6 10 3
b =
8
4
0
x =
-1.8049
0.2927
2.6341
Answer to the Question no 3.a:
MFILE:
u=[4 9 -5];
v=[-3;6;-7];
y=u*v
Output:
y =
77
Answer to the Question no 3.b:
MFILE:
u=[4 9 -5];
v=[-3 6 -7];
x=u.*v
Output:
x =
-12 54 35
Answer to the Question no 3.c:
MFILE:
u=[4 9 -5];
v=[-3 6 -7];
dot(u,v)
Output:
ans =
77
Answer to the Question no 4:
MFILE:
c=[2 4 6 8 10;
3 6 9 12 15;
7 14 21 28 35]
Output:
c =
2 4 6 8 10
3 6 9 12 15
7 14 21 28 35
Answer to the Question no 4.a:
MFILE:
c=[2 4 6 8 10;
3 6 9 12 15;
7 14 21 28 35];
b=c(:,3)
Output:
b =
6
9
21
Answer to the Question no 4.b:
MFILE:
c=[2 4 6 8 10;
3 6 9 12 15;
7 14 21 28 35];
b=c(2,:)
Output:
b =
3 6 9 12 15
Answer to the Question no 5:
MFILE:
x=[1 2 2];
roots(x)
Output:
ans =
-1.0000 + 1.0000i
-1.0000 - 1.0000i
Discussion:
From this experiment we understand that MATLAB is powerful tool for the engineering as well as for the science and applied mathematics. MATLAB stands for Matrix Laboratory. We learn some basic operation of MATLAB like how to use MATLAB as a calculator, how to define variables, complex number computation and matrix & vector computation
1 comment:
any problem related to matleb.
u wil get solution here
Post a Comment