Question: This must be solved in MATLAB using loops and not built in functions. 1 Create a function called cannon (that calculates the maximum height of

 This must be solved in MATLAB using loops and not built

This must be solved in MATLAB using loops and not built in functions.

1 Create a function called cannon (that calculates the maximum height of a cannon ball's trajectory the time at which this occurs, and the speed at that time. These three values are returned to the main program, which has the following form: x0 = 0; v0 = 20; % initial speed in m/s angle 45; % elevation angle in degrees [maxheight,time, speed]-cannon (x0, yo, v0, angle); fprintf ('The max height is %7.2f ' , maxheight) fprintf ('The time of the max height is %7.2f seconds ' , time) fprintf ('The speed at the max height is %7.2f in' , speed) The arguments passed down to cannonare the initial x- and y-coordinates (x0,y0), initial speed (vO), and elevation angle (angle). Do not use the built-in max () function, and do not use equations that give the height, time, and/or velocity directly. Use the equations of motion (x and y coordinate equations) that you used in HW #2, Problem #6. Start at time 0 and then repeatedly increment the time by a small amount while checking if the maximum height has been reached. To check your code, you might consider generating plots that enable you to see if your answers make sense

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!