Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

H (t) = vt sin? - 1/2 gt^2 write a MATLAB program to calculate and store h and x

ID: 1857030 • Letter: H

Question


H (t) = vt sin? - 1/2 gt^2



write a MATLAB program to calculate and store h and x for time increments of 0.1 seconds for ? =20 and v= 200 feet per second . Use a value for g of 32.2 feet/s^2 . continue to make the calculations until the projectile hints the ground . use the plot command to crear three graphs:

a. t along the horizontal axis , h along the vertical axis.

b. t along the horizontal axis , x along the vertical axis

c. x along the horizontal axis , h along the vertical axis (this is a plot of the trajectory of the projectile).



Explanation / Answer

x0=0; y0=0; v0=200; theta=20; % deg g=32.2; % feet/s^2 b=v0*sin(pi*(theta/180)); a=-g/2; c=y0; t_flight=(-b-sqrt(b^2-4*a*c))/(2*a); t= 0:0.1:t_flight; xdot0=v0*cos(pi*(theta/180)); ydot0=v0*sin(pi*(theta/180)); x=xdot0*t+x0; y=-(g/2)*t.^2+ydot0*t+y0; figure; plot(x,y) axis equal xlabel(sprintf('Distance (feet)); ylabel('Height (feet)'); figure; plot(t,x) axis equal xlabel(sprintf('time (s))); ylabel(''Distance (feet)'); figure; plot(t,y) axis equal xlabel(sprintf('time(s))); ylabel('Height (feet)');