110 likes | 222 Views
Engr/Math/Physics 25. Test Your Understanding Chp02. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. The B Matrix. T2.1-2. >> C = max(B) C = 16 12 15 25 >> D = max(C) D = 25. B = 2 4 10 13 16 3 7 18
E N D
Engr/Math/Physics 25 Test Your UnderstandingChp02 Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu
The B Matrix T2.1-2 >> C = max(B) C = 16 12 15 25 >> D = max(C) D = 25 B = 2 4 10 13 16 3 7 18 8 4 9 25 3 12 15 17 >> C = sort(B) C = 2 3 7 13 3 4 9 17 8 4 10 18 16 12 15 25 Ans (a) Ans (b)
T2.4-1 & T2.4-2 >> u = [6, -8, 3]; >> w = [5; 3; -4]; >> u u = 6 -8 3 >> w w = 5 3 -4 >> u*w ans = -6 >> P = [7,4; -3,2; 5,9]; >> Q = [1,8; 7,6]; >> % [P][Q] = [3x2][2x2] >> P*Q ans = 35 80 11 -12 68 94
T2.5-4 >> f = [6,4,0,-5];g = [12,-7,3,9]; >> f2 = polyval(f,2) f2 = 59 >> g = polyval(g,2) g = 83 >> f2/g2 ans = 0.7108 >> quot2 = polyval(f,2)/polyval(g,2) quot2 = 0.7108 >> [q,r] = deconv(f,g); >> quot2 = polyval(q,2)+polyval(r,2)/polyval(g,2) quot2 = 0.7108
T2.5-5 >> x = [-7:.02:1]; >> f = [1,13,52,6]; >> FofX = polyval(f,x); >> plot(x, FofX), xlabel('x'), ylabel('f(x)'), grid
The Script File The Output T2.6-1 % TYU T2.6-1 % Bruce Mayer, PE % ENGR25 • 20Jun05 A{1} = [1:4]; A{2} = [0,9,2]; A{3} = [2:5]; A{4} = [6:8]; [x,y] = deal(A{1:2}); B = [x,y] C = [A{2};A{4}] [u,v] = deal(A{2:3}); D = min([u,v]) B = 1 2 3 4 0 9 2 C = 0 9 2 6 7 8 D = 0
Exercise Structure T2.7-1 >> student(3).tests ans = 55 45 58 >> student(3).tests(2) = 53; >> student(3).tests ans = 55 53 58 >> student(1).IDN ans = 324-292-5714 >> student student = 1x3 struct array with fields: name IDN eMail tests >> new_student = rmfield(student,'IDN'); >> new_student new_student = 1x3 struct array with fields: name eMail tests >> new_student(1).IDN ??? Reference to non-existent field 'IDN'. >> student(1:3).name ans = Nolan Ryan ans = Walter Johnson ans = Bob Gibson
T1.3-3 Command Script • From the Command Window >> t = [0:0.1:5]; >> s = 2*sin(3*t +2) + sqrt(5*t +1); >> plot(t,s), xlabel('t (seconds)'), ylabel('s (fps)'), title('Speed vs Time - ENGR25 Jun05')
T1.3-4 Command Script • From the Command Window >> x = [0:0.02:1.5]; >> y = 4*sqrt(6*x + 1); >> z = 5*exp(0.3*x) - 2*x; >> plot(x,y,x,z), xlabel('distance (m)'), ylabel('force (N)'), gtext('y'), gtext('z')