Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 senseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started