Answer this question in MATLAB
When a particle is projected obliquely near the Earth's surface, it moves simultaneously in the horizontal and vertical directions. When a particle is projected at an angle θ, with an initial velocity vo, the horizontal and vertical positions at time t are given by the following two equations:
x = vo * cos(θ) * t
y = vo * sin(θ) * t - (1/2) * g * t^2
Write a MATLAB function object_motion that will take two input arguments, vo (in m/s) and θ (you have the flexibility of using either radians or degrees, but need to specify this information in the usage to inform users). The function should produce two output arguments, x and y, to describe the projectile's motion over time. The function should calculate the positions of the projectile at a temporal resolution of 1 millisecond. Note that g is the acceleration on Earth, which is 9.8 m/s^2. The function should check the input to make sure both of them are of numerical data type, and provide a warning where appropriate.
Then, write a script .m file that will call this function to generate data for plotting. First, verify that your function is working correctly by displaying the output values for a specific input (vo and θ) and paste them as comments in your .m file at the end (with a section header: %% debugging responses).
Next, for a given vo (of your choosing), select three different θ values (of your choosing) to produce the data needed for plotting using subplot. For each θ value, generate a plot and put it in a 2-row-by-2-column arrangement in the figure.
In the remaining (i.e., 4th) subplot area, verify that when θ is 45 degrees, the horizontal projection reaches the maximum value, by comparing the plot with other plots you have generated (i.e., put the responses in the Command Window into the comment area in your script .m file, with a section header: "%% script display output").
Finally, use the MATLAB command (in your .m script file) to determine if the figure should be saved as PNG or JPG. If it's an even number, save as PNG. If it's an odd number, save it as JPG.