18.06 MATLAB transcript September 14 a = 5 2 3 2 9 6 3 6 0 >> [l,u]=lu(a) l = 1.0000 0 0 0.4000 1.0000 0 0.6000 0.5854 1.0000 u = 5.0000 2.0000 3.0000 0 8.2000 4.8000 0 0 -4.6098 >> d=diag(u) d = 5.0000 8.2000 -4.6098 >> d=diag(d) d = 5.0000 0 0 0 8.2000 0 0 0 -4.6098 >> l*d*l' ans = 5.0000 2.0000 3.0000 2.0000 9.0000 6.0000 3.0000 6.0000 0 >> a a = 5 2 3 2 9 6 3 6 0 >> l l = 1.0000 0 0 0.4000 1.0000 0 0.6000 0.5854 1.0000 >> format compact >> l l = 1.0000 0 0 0.4000 1.0000 0 0.6000 0.5854 1.0000 >> d d = 5.0000 0 0 0 8.2000 0 0 0 -4.6098 >> l*d*l' ans = 5.0000 2.0000 3.0000 2.0000 9.0000 6.0000 3.0000 6.0000 0 >> x=[4 5 6]' x = 4 5 6 >> y=[2 5 10]' y = 2 5 10 >> x*y' ans = 8 20 40 10 25 50 12 30 60 >> A=rand(7,2) A = 0.8147 0.5469 0.9058 0.9575 0.1270 0.9649 0.9134 0.1576 0.6324 0.9706 0.0975 0.9572 0.2785 0.4854 >> A'*A ans = 2.8216 2.4216 2.4216 4.2656 >> B=A' B = Columns 1 through 6 0.8147 0.9058 0.1270 0.9134 0.6324 0.0975 0.5469 0.9575 0.9649 0.1576 0.9706 0.9572 Column 7 0.2785 0.4854 >> B*B' ans = 2.8216 2.4216 2.4216 4.2656 >> A=[3 7 2 ; 17 -9 0 ; 1000 1001 pi] A = 1.0e+003 * 0.0030 0.0070 0.0020 0.0170 -0.0090 0 1.0000 1.0010 0.0031 >> format bank >> A A = 3.00 7.00 2.00 17.00 -9.00 0 1000.00 1001.00 3.14 >> A*[1 0 0]' ans = 3.00 17.00 1000.00 >> A*[0 1 0]' ans = 7.00 -9.00 1001.00 >> A*[1 1 0]' ans = 10.00 8.00 2001.00 >> A*[3 1 0-2]' ans = 12.00 42.00 3994.72 >> A*[3 1 -2]' ans = 12.00 42.00 3994.72 >> [1 0 0]'*A ??? Error using ==> mtimes Inner matrix dimensions must agree. >> [1 0 0]*A ans = 3.00 7.00 2.00 >> A A = 3.00 7.00 2.00 17.00 -9.00 0 1000.00 1001.00 3.14 >> [1 1 0]*A ans = 20.00 -2.00 2.00 >> x x = 4.00 5.00 6.00 >> y y = 2.00 5.00 10.00 >> dot(x,y) ans = 93.00 >> x'*y ans = 93.00 >> x*y' ans = 8.00 20.00 40.00 10.00 25.00 50.00 12.00 30.00 60.00