Can I please get some help with problem 1? I have to use a function for this problem. The code below is the code that needs to be modified.
clc clear disp('ENGR15100 Prelab 9') disp('Your name here') disp(' ') %Run script file for rocket calculations rocket2h2 %rocket2h2.m % clc b=input('Enter desired burn time '); disp(' ') h_des=input('Enter desired height '); disp(' ') dt=.1; m=10; f=2000; g=32.2; %calculate constants v_b=(f/m-g)*b; h_b=0.5*(f/m-g)*b^2; h_p=h_b+v_b^2/(2*g); t_p=b+v_b/g; figure(2) %Begin calculating flight h=0; k=0; while h>=0 t=k*dt; k=k+1; if th_des %do-able! h=0; k=0; t=0; while h STEP 2: Using the functions created above solve again the problems of lab 9 step 1. You will be writing standalone script files for each problem so each should begin with clear and clc. Please use the usual file naming of firstname_lastname_lab9 step2_problem1.m etc., for each of the five problems Problem 1 i) Ask the user to enter the values of the empty rocket mass m, the engine force f, the engine burn time b, and the time step dt. Calculate the flight parameters of the rocket velocity at engine shut down v_b, altitude at engine shut down h _b, peak altitude h p, and the time of peak altitude t p. Use the same values you used in lab 8 for m,f,b and g- 32.2 Display (using fprintf) messages with values of the variables calculated above ii) Problem 2 i) Ask the user to enter the same parameters as above, and produce a plot of altitude h from the time of launch to ground impact i) Create the plot in figure 2, add x and y labels, title, and a grid Problem 3 i) Ask the user to enter the same parameters as in 1) and calculate the velocity v and altitude h of the rocket from the time of launch to ground impact. Use the same values as before. i) Create a two-row, one-column subplot in figure 3. Subplot one shows altitude h over time, while subplot two shows velocity v over time Problem 4 i) Add the additional input function get_h des to the list of input parameters and then determine the time at which h = 3000 on the way up. Use a FOR loop technique and the same rocket parameters as in 1) except use a time step dt = 0.1 sec Print an error message if h = 3000 ft is not reached Use fprintf to display the result ii) Problem 5 i) Add the additional input function get_h_des to the list of input parameters and thern determine the time at which h = 3000 on the way up. Use a WHILE loop technique and a time step dt = 0.05sec. Print an error message if h = 3000 ft is not reached Use fprintf to display the result ii)