Iismavo CW Matlab
Iismavo CW Matlab
COURSEWORK
(Optional)
Submission
Firstname_Lastname_MP.m
Procedure
1. Ask the user for the height of the launching point 𝐻, initial velocity 𝑈, and the angle of
projectile motion 𝑇𝑒𝑡𝑎.
2. Calculate the velocity vector in the vertical 𝑈𝑦 and horizontal 𝑈𝑥 direction through equations
𝑈𝑦 = 𝑈 sin(𝑇𝑒𝑡𝑎)
𝑈𝑥 = 𝑈 cos(𝑇𝑒𝑡𝑎)
3. Calculate the time 𝑇 when an object hits the ground. At this time, vertical displacement 𝑆𝑦 = 0 (see the
illustration) or mathematically can be written as
1
𝑔𝑇2 + 𝑈 𝑇 + 𝐻 = 0
𝑦
2
Therefore, the time when an object hits the ground 𝑇 can be obtained by solving the quadratic equations
above. Hint: You only need the positive value of 𝑇.
4. Create time array 𝑡 = [0, … , 𝑇] with 1000 elements using linspace function
𝑡 = 𝑙𝑖𝑛𝑠𝑝𝑎𝑐𝑒(0, 𝑇, 1000)
5. Apply the SUVAT equations to calculate the object’s displacement (ignore the air resistance) in the
vertical 𝑆𝑦 and horizontal 𝑆𝑥 direction through equations
1
2
𝑆𝑦 = 𝑈𝑦𝑡 + 𝑔𝑡 + 𝐻
2
𝑆 𝑥 = 𝑆 𝑥𝑡
7. Communicate the time of flight of the object to the user as well as the total horizontal distance
travelled in the Command Window.