Question: Update the script provided on the first day of class (go to Lab 6 in CANVAS to download the .m file) by adjusting the code



Update the script provided on the first day of class (go to Lab 6 in CANVAS to download the .m file) by adjusting the code to complete the following: 1. Print the maximum height that the particle will reach you will need to generate a formula for this - by hand) 2. Adjust the plot curve to ensure that it is magenta with a dash-dot line 3. The program should run as follows (when using v = 100 mph and theta = 40 degrees): Please enter the initial velocity fin mph): 100 Please enter the initial launch angle fin degrees): 40(empty) Time of Flight: 5.86 sec Total Distance Traveled: 657.90ft Max Height of Particle: 138.01 ft (empty) %Prompting user to enter velocity and theta prompt = 'Please enter the initial velocity (in mph): '; v=input(prompt) prompt2 = 'Please enter the initial launch angle (in degrees): '; theta = input (prompt) %Initial Values g = -32.2; $Acceleration of Gravity (ft/sec^2) V = 50 * 5280/3600; theta = 30 + pi/180; %Initial Velocity (ft/sec) *Initial Launch Angle (radians) *Compute Time of Flight and Horizontal Distance Traveled disp(' Time of Flight (s): ') tf = -2 * V * sin(theta)/g *Time of Flight (sec) disp(' Total Distance Traveled (ft): ') xf = V * cos(theta) * tf Horizontal position when *particle hits the ground %Compute Time Values and corresponding Particle Position linspace(0,tf , 256); %Incrementing time values from 0 to tg x = v*t*cos(theta); $Horizontal Position Data y = (1/2)*g*t.^2 + v*t*sin(theta); %Vertical Position Data %Plot Trajectory plot(x,y), grid, xlabel('Distance (ft)'), ylabel('Height (ft)'), ... title('Flight Trajectory') Update the script provided on the first day of class (go to Lab 6 in CANVAS to download the .m file) by adjusting the code to complete the following: 1. Print the maximum height that the particle will reach you will need to generate a formula for this - by hand) 2. Adjust the plot curve to ensure that it is magenta with a dash-dot line 3. The program should run as follows (when using v = 100 mph and theta = 40 degrees): Please enter the initial velocity fin mph): 100 Please enter the initial launch angle fin degrees): 40(empty) Time of Flight: 5.86 sec Total Distance Traveled: 657.90ft Max Height of Particle: 138.01 ft (empty) %Prompting user to enter velocity and theta prompt = 'Please enter the initial velocity (in mph): '; v=input(prompt) prompt2 = 'Please enter the initial launch angle (in degrees): '; theta = input (prompt) %Initial Values g = -32.2; $Acceleration of Gravity (ft/sec^2) V = 50 * 5280/3600; theta = 30 + pi/180; %Initial Velocity (ft/sec) *Initial Launch Angle (radians) *Compute Time of Flight and Horizontal Distance Traveled disp(' Time of Flight (s): ') tf = -2 * V * sin(theta)/g *Time of Flight (sec) disp(' Total Distance Traveled (ft): ') xf = V * cos(theta) * tf Horizontal position when *particle hits the ground %Compute Time Values and corresponding Particle Position linspace(0,tf , 256); %Incrementing time values from 0 to tg x = v*t*cos(theta); $Horizontal Position Data y = (1/2)*g*t.^2 + v*t*sin(theta); %Vertical Position Data %Plot Trajectory plot(x,y), grid, xlabel('Distance (ft)'), ylabel('Height (ft)'), ... title('Flight Trajectory')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
