%%% File by JA Rossiter in support of resources on matrices 8 %%% See video for more information A=[1,3,2;-6,0,4] B=[1,2,3,4,5,6;0,1,2,3,4,5;0,0,1,2,3,4] C=A*B w=[1 2 3 4] v = [0;1;2;4] w*v v*w syms a b c d G=[a,b,3;c-1,d,2] H=[2*a,c;b,5;d-2,0] G*H xx=[2 2 -4 1] yy=[3 4 4 2] xx*yy' x=inv([2,2,-1;4,1,-6;4,0,5])*[3;0;-3] figure(1);clf reset T30=[cos(pi/6),sin(pi/6);-sin(pi/6),cos(pi/6)]; T60=[cos(pi/3),sin(pi/3);-sin(pi/3),cos(pi/3)]; x=[1;1]; x30=T30*x; x60=T60*x; plot([0,x(1)],[0,x(2)],'b-','linewidth',2);hold on plot([0,x30(1)],[0,x30(2)],'r--','linewidth',2);hold on plot([0,x60(1)],[0,x60(2)],'g:','linewidth',2);hold on grid aa=legend('x','x30','x60');set(aa,'fontsize',20); figure(1);clf reset Ts=[1.5 0;0 2]; x=[2 1 0.5;1 2 1.5]; xs=Ts*x; plot([x(1,1),xs(1,1)],[x(2,1),xs(2,1)],'b-','linewidth',2);hold on plot([x(1,2),xs(1,2)],[x(2,2),xs(2,2)],'r--','linewidth',2);hold on plot([x(1,3),xs(1,3)],[x(2,3),xs(2,3)],'g:','linewidth',2);hold on plot(x(1,1),x(2,1),'bo','markersize',10) plot(x(1,2),x(2,2),'ro','markersize',10) plot(x(1,3),x(2,3),'go','markersize',10) plot(xs(1,1),xs(2,1),'bs','markersize',10) plot(xs(1,2),xs(2,2),'rs','markersize',10) plot(xs(1,3),xs(2,3),'gs','markersize',10) axis([0,4,0,4]) grid aa=legend('x(:,1)','x(:,2)','x(:,3)');set(aa,'fontsize',20);