A team of engineering students is writing a MATLAB program that can accurately c
ID: 3667831 • Letter: A
Question
A team of engineering students is writing a MATLAB program that can accurately calculate and plot the projectile motion of shooting a cannonball at any height, shooting angle, and initial velocity based on the user input. This program will also simulate the cannonball target practice result. Place a 10 meters tall target on the ground at any horizontal distance the user specifies, the program will predict hit or miss.
The program should gather the following information from the MATLAB command window:
The vertical height of the cannon in meters.
The shooting angle in degrees.
The initial velocity in meters per second (m/s).
The horizontal location of the target in meters.
Based on the height of the cannon, the shooting angle, and the initial velocity, the program should calculate the maximum height (hmax) the cannonball can reach, the horizontal distance (x) the cannonball travels, and the total time (ttotal) the cannonball is in the air.
Format the answers to display 3 digits after the decimal point in the command window.
The program should then separate the total time (ttotal) the cannonball is in the air into 1000 equally spaced time points. Compute the x and y values of each time point.
Plot the projectile motion of the cannonball in the x and y coordinates from the moment the cannonball is released in the air to the moment the cannonball reaches the ground.
Plot a line that represents the height of the cannon in the same graph.
Plot the 10 meters tall target in the same graph.
Add plot title, legends, and label each axis clearly.
After the computation, add an if..elseif..else..end statement in the program to analyze if the cannonball will hit the target and print results in the command window for the user.