Matlab Codes and Graphs
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+wsum = 3 7 15 14(c) diff=v-wdiff = 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) vans = 2 4 7 52) Investigate th effect of the following commands: (a) z=[1;1;0;0]; zans = 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*zans = 6(e) [z;v]ans = 1 1 0 0 2 4 7 5(f) z+vans = 3 5 7 53) 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*Nans = 1.0000 0 0.0000 1.0000(c) I=eye(2)I = 1 0 0 1(d) M + I