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

A cannon is fired on level ground. Assume the user inputs an initial velocity (v

ID: 3695155 • Letter: A

Question

A cannon is fired on level ground. Assume the user inputs an initial velocity (vO) of 100 m/s and an initial elevation angle of theta = 25 degrees. Using a while loop, calculate the x and y position of the cannon ball in time steps of 0.1 seconds until the cannon ball hits the ground. Display the time, x-position and y-position in a nice table format with three columns. (Your output should look similar to the table from the previous cannon problem.) Remember that trigonometric functions require input in radians, not degrees. Assume the initial position is (x,y) = (0,0). The vertical acceleration due to gravity is -9.8 m/s^2. Can you think of how to do this problem with a for loop? (not required)

Explanation / Answer

ang = 25*pi/180;
vx=100*sin(ang);
vy=100*cos(ang);
t=0.1;
disp("Time X-value Y-value");
while true
dx = vx*t;
dy = vy*t-4.9*t*t;
if(dy<0)
break
end
ab = [num2str(t)," ",num2str(dx)," ",num2str(dy)];
disp(ab);
t+=0.1;
end