Question
Part B) Create a MATLAB Script that follows this part a of the problem. The projectile UDF that it refrences is as follows function [x,y,maxy,max_x,maxt]
Part B) Create a MATLAB Script that follows this part a of the problem.
The "projectile" UDF that it refrences is as follows
function [x,y,maxy,max_x,maxt] = projectile(Vo, theta, H, t) % start UDF (t = time, H=initial height, Vo = initial velocity, theta = initial angle)
g = 9.8; x = (t)*(Vo)*cos(theta); % horizontal distance traveled per given time in seconds y = (H)+(t)*(Vo)*sin(theta)-(0.5)*(g)*(t.^2); % vertical distance traveled per given time in seconds [maxy,index] = max(y); % max vertical distance in meters max_x = x(index); % max horizontal distnace in meters where maxy is greatest maxt = t(index); % the max time in seconds where maxy and max_x are greatest end % End UDF
Lab 7: Nested loops in MATLAB Problem 1: In previous labs, you created a UDF called "projectile" that calculated the maximum vertical displacement of a projectile given a vector of flight times, initial launch angle, , initial velocity, Vo, and initial height, ho. If your UDF does not yet work properly, fix it before proceeding, and test it to make sure it works properly using any of the cases provided below Copy and paste UDF projectile into your working folder, so that it will be available to use in this lab Part a Create a flowchart for a MATLAB script that calls UDF projectile to calculate and create a matrix named "MaxHeight" with the values given and organized as shown in the table below: Vo [m/s 100 200 300 1,000 10 (/18) 15.12963 60.5185421 137.9722661246.4817 0 [degrees (radians)l 20(/9)58.5060 238.7282536.0604 2930.2014 90 (/2) | 510.0000 | 1510 2510 9510 9510 Each value in the table above is the maximum height for a projectile launched at the angle indicated by the row header and initial velocity indicated by the column header, in the first 1(0 seconds of flight. To get the same results shown above, use a time vector that starts at 0 seconds, ends at 10 seconds, and increases in steps of 1 second. Use an initial height of 0 m. Let the launch angle vector be named "theta", and your initial velocity vector, "v0", and use nested loops to create "MaxHeight". Part b Write the MATLAB script described by the flowchart in part a of this problem. After the creation of "MaxHeight" in your code, copy and paste the following lines of MATLAB code to create a surface of maximum projectile heights as a function of launch angle and initial velocityStep 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