The coordinates of a projectile traveling through the air can be calculated with
ID: 1843533 • Letter: T
Question
The coordinates of a projectile traveling through the air can be calculated with the following equations: x = v_0t cos (theta) y = v_0t sin(theta) - 1/2gt^2 where v_0 is the initial velocity (60 m/s) t is the time (seconds) theta is initial angle of the projectile relative to the ground (degrees) g is the acceleration due to gravity (9.81 m/s^2 Write a script to complete the following tasks Allow the user to interactively input the initial angle of the projectile theta (in degrees) Starting at an initial time t of 0 seconds, calculate the x and y coordinates of the projectile for each time value t until the y coordinates of the projectile reaches the ground (while y lessthanorequalto 0) You will need to increase the value of time t by 0.1 seconds inside the loop. After the projectile reaches the ground, display the final x and y coordinates of the projectile to the screen using disp statements. Test the script with theta = 25 degrees. Make sure the tests appear in the diary file, otherwise no point will be given to the problem!!Explanation / Answer
Matlab Code for the problem given
v0= 20;
g=9.81;
y=0;
t=0;
while (y>=0)
t=t+0.1;
y= v0*t- 0.5*g*t^2;
disp([ at t= ', num2str(t), ', location= ', numstr(y)]);
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.