Matlab Codes and Graphs
Autor: junaid shaikh • April 11, 2016 • Lab Report • 1,284 Words (6 Pages) • 800 Views
1) Investigate th effect of the following matlab commands:
v= [2 4 7 5];
w=[1 3 8 9];
(a) v(2)
ans =
4
(b) sum=v+w
sum =
3 7 15 14
(c) diff=v-w
diff =
1 1 -1 -4
(d) vw=[v w]
vw =
2 4 7 5 1 3 8 9
(e) vw(2:6)
ans =
4 7 5 1 3
(f) v'
ans =
2
4
7
5
2) Investigate th effect of the following commands:
(a) z=[1;1;0;0];
z'
ans =
1 1 0 0
(b) z*v
ans =
2 4 7 5
2 4 7 5
0 0 0 0
0 0 0 0
(c) [v;w]
ans =
2 4 7 5
1 3 8 9
(d) v*z
ans =
6
(e) [z;v']
ans =
1
1
0
0
2
4
7
5
(f) z+v'
ans =
3
5
7
5
3) Investigate th effect of the following commands:
M=[1 2;3 4];
(a) N=inv(M)
N =
-2.0000 1.0000
1.5000 -0.5000
(b) M*N
ans =
1.0000 0
0.0000 1.0000
(c) I=eye(2)
I =
1 0
0 1
(d) M + I
...