solution5 - % Prob 1 xx=[0.1 0.2 0.3]; nn=[1 2 3 4];...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Prob 1 xx=[0.1 0.2 0.3]; nn=[1 2 3 4]; [x,n]=meshgrid(xx,nn); M=(1./n.^2).*cos(n.*x); summation=sum(M) summation = 1.4037 1.3456 1.2534 % Prob. 2 A=[3 B=[5 C=[1 D=[2 E=[7 7 2;5 7 2 9;6 8 4;2 9;6 6 4;3 9 5;1 8;4 1;6 7 3]; 4;6 3 1]; 9]; 7]; 9]; disp('A+B') A+B disp('A-B') A-B disp('B-A') B-A disp('C+E') C+E disp('C-E') C-E disp('E-C') E-C disp('A*B') A*B disp('B*A') B*A disp('A*C') A*C disp('B*C') B*C disp('A*E') A*E disp('B*E') B*E disp('D*C') D*C disp('D*E') D*E disp('C*D') C*D disp('E*D') E*D disp('D*A') D*A disp('D*B') disp('A^2') A^2 disp('B^2') B^2 A+B ans = 8 11 12 9 15 10 11 5 4 A-B ans = -2 -1 0 B-A ans = 2 1 0 C+E ans = 8 3 10 C-E ans = -6 1 2 E-C ans = 6 -1 -2 A*B ans = 69 73 90 B*A ans = 79 82 39 A*C ans = 29 25 38 B*C ans = 63 46 18 A*E ans = 36 46 61 89 90 113 119 132 60 93 92 114 112 126 70 39 32 18 68 69 77 57 74 85 1 -1 0 -1 1 0 9 17 18 -5 1 -4 7 3 -2 5 -1 4 -7 -3 2 B*E ans = 73 66 49 D*C ans = 38 63 D*E ans = 36 58 C*D ans = 14 31 39 E*D ans = 29 26 35 D*A ans = 60 96 D*B A^2 ans = 56 56 71 B^2 ans = 91 102 54 53 88 39 62 90 67 84 91 112 19 20 28 84 133 22 36 87 78 105 63 60 79 42 93 117 32 71 87 94 150 98 156 122 130 63 Only matrices having the same size (the same number of rows and the same number of columns) can be added or subtracted. As the above results show, the order of multiplication is important. If the product of two matrices is desired, the first matrix must have as many columns as the second has rows. Thus A*C can be done, but C*A cannot be done. Only square matrices can be raised to a power. Thus, of the above matrices, only A and B can be squared. % Prob 3 x=0.1:0.1:0.3; n=1:4; summation=(1./n.^2)*cos(n'*x) % Prob 4 n=1:10; x=0:0.1:0.5; E=(1./n).*exp(-(n*pi/2).^2); summation=1-x+(4/pi^2)*N*cos(n'*pi*x/2) summation = 1.4037 summation = 1.0344 0.9340 0.8327 0.7306 0.6278 0.5243 1.3456 1.2534 The solution to Prob. 3 agrees with that of Prob. 1 of this assignment and the solution of Prob. 4 agrees with that of Prob. 5 in assignment 4. ...
View Full Document

This note was uploaded on 02/27/2010 for the course ENME 271 taught by Professor Marks during the Summer '08 term at Maryland.

Page1 / 10

solution5 - % Prob 1 xx=[0.1 0.2 0.3]; nn=[1 2 3 4];...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online