• • • • • • • • • • • • • • • 18. 程式(a) and (b): g = 9.81; % Part a v = 10;A = 35*(pi/180); t_hit = (2/g)*v*sin(A); t = [0:t_hit/1000:t_hit]; h = v*t*sin(A)-.5*g*t.^2; [peak_height,i_peak] = max(h); t_peak = i_peak*t_hit/1000; peak_height distance = v*t_hit*cos(A) t_hit % Part b x=v*t*cos(A); plot(x,h),xlabel(‘Distance (meters)’),ylabel(‘Height (meters)’) 圖 (b) • • • • • • • • • • • • • • • • • 程式(c) g = 9.81; v = 10;A = [20,30,45,60,70]*(pi/180); t_hit = (2/g)*v*sin(A); t = [0:max(t_hit)/1000:max(t_hit)]’; sA = sin(A); cA = cos(A); r = 0.5*g*t.^2; X = v*[t*cA(1),t*cA(2),t*cA(3),t*cA(4),t*cA(5)]; r = 0.5*g*t.^2; R = [r,r,r,r,r]; Q = v*[t*sA(1),t*sA(2),t*sA(3),t*sA(4),t*sA(5)]; H = Q-R; max_x = v*t_hit(3)*cA(3); plot(X,H),axis([0 max_x 0 max(max(H))]),xlabel(‘Distance (m)’),... ylabel(‘Height (m)’),gtext(‘20 deg’),gtext(‘30 deg’),... gtext(‘45 deg’),gtext(‘60 deg’),gtext(‘70 deg’) 圖 (c) • • • • • • • • • • • • • 程式(d): g = 9.81;A = 45*(pi/180); v = [10:2:18]; t_hit = (2/g)*v*sin(A); t = [0:max(t_hit)/1000:max(t_hit)]0; r = 0.5*g*t.^2; X = cos(A)*[t*v(1),t*v(2),t*v(3),t*v(4),t*v(5)]; R = [r,r,r,r,r]; Q = sin(A)*[t*v(1),t*v(2),t*v(3),t*v(4),t*v(5)]; H = Q-R; plot(X,H),axis([0 max(max(X)) 0 max(max(H))]),xlabel(‘Distance (m)’),... ylabel(‘Height (m)’),gtext(‘10 m/s’),gtext(‘12 m/s’),... gtext(‘14 m/s’),gtext(‘16 m/s’),gtext(‘18 m/s’) 圖 (d) • • • • 21. Clear all;clc; t = [0:8,10]; s = [0, 1210, 1866, 2301, 2564, 2724, 2881, 2879, 2915, 3010]; • plot(t, s,’*’,t, s,’--’), xlabel(‘Time (sec)’), ylabel(‘Speed (rpm)’) • 24. A與V 均為 r的次冪函數(power function),因此可在loglog軸上為直線 • 程式(a) • r = logspace(-1,2,300); • V = (4/3)*pi*r.^3; • A = 4*pi*r.^2; • subplot(2,1,1) • loglog(r,A),xlabel(‘Radius r (meters)’),ylabel(‘Area A (meters^2)’) • subplot(2,1,2) • loglog(r,V), xlabel(‘Radius r (meters)’), ylabel(‘Volume (meters^3)’) 程式(b): A = logspace(0,4,300); r = 0.5*sqrt(A/pi); V = (1/(6*sqrt(pi)))*A.^(3/2); subplot(2,1,1) loglog(A,r),xlabel(‘Area A (meters^2)’),ylabel(‘Radius r (meters)’) • subplot(2,1,2) • loglog(A,V),xlabel(‘Area A (meters^2)’),ylabel(‘Volume V (meters^3)’) • 圖示: • • • • • •