Part A
1. Write three separate functions (m-files) for x(t), y(t) and v(t) to implement equations 2, 4, and 5 respectively. Note that the time input will be a vector.
2. Given a projectile launched horizontally, (thus the angle of the initial trajectory to 0°), v0 = 10 m/s and y0 = 20 m;
a. Use the functions you created in Part A.1 to compute x(t), y(t) and v(t), where time is from 0 to 2 sec (inclusive) for 200 equal increments.
Hint: linspace().
b. Plot the velocity v(t) of the arrow over the 2 sec.
c. Plot the trajectory, y(t) against x(t), of the arrow over the 2 sec.
3. Given the projectile launched upwards at an angle of 45° (upwards), v0 = 50 m/s and y0 = 0 m (on the ground);
a. Use the function you created in Part A.1 to compute x(t), y(t) and v(t) where time is from 0 to 7.2 sec (inclusive) for 200 equal increments.
b. Plot the velocity v(t) of the arrow over the 7.2 sec.
c. Plot the trajectory, y(t) against x(t), of the arrow over the 7.2 sec.
4. Given the projectile being launched at an angle of 45°, v0 = 20 m/s and y0 = 30 m;
a. Use the function you created in Part A.1 to compute x(t), y(t) and v(t) where time is from 0 to 4.3 sec (inclusive) for 200 equal
increments.
b. Plot the velocity v(t) of the arrow over the 4.3 sec.
c. Plot the trajectory, y(t) against x(t), of the arrow over the 4.3 sec.
5. Explain the difference in trajectory between Part A, 2, 3 and 4.
Part B
1. Write a single function (m-files) that outputs the total time of flight, range of the projectile and the velocity on impact given inputs of g, the angle, v0 and y0. Hint: [timeFlight, range, velocity] = projectile(g, θ, v0, y0) The equations for all the required outputs should be in the same function file and the function should use all the required inputs.
2. Use the functions you created in Part B.1 to compute values for:
a. cannon ball shot upwards at an angle of 30°, v0 = 15 and y0 = 5;
b. cannon ball shot upwards at an angle of 30°, v0 = 20 and y0 = 5;
c. cannon ball shot upwards at an angle of 45°, v0 = 30 and y0 = 0;
d. cannon ball shot upwards at an angle of 45°, v0 = 40 and y0 = 0;
3. Plot the trajectory, y(t) against x(t), of the cannon ball from 0 to the total time you computed in Part B.2.