Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab 3. Write a program to find the max height of a model rocket. The program

ID: 639370 • Letter: M

Question

Matlab

3. Write a program to find the max height of a model rocket. The program should accept the thrust of the rocket in Newtons (N), time of thrust action in seconds (s), the mass of the rocket in kilograms (kg), and output the maximum height in meters (m). Assume gravity is equal to 9.81 m/s^2. From physics we know F = ma where F is force in N, m is mass in g, and a is acceleration in m/s^2 v = v0 + a * t where y o is the initial velocity in m/s d = do + vo * t + ½ * a * t^2 where d0 is the starting distance in meters (m) Hints: For the problem v0 is equal to zero because the rocket starts at rest, and d0 is zero because it is assumed to be sitting on the ground. In order to find the maximum height, the time at which y is equal to 0 must be found. Please enter the mass of the rocket in kilograms: .05 Please enter the thrust of the rocket in Newtons: 16 Please enter the time of thrust of the rocket ?n seconds: 0.15 The time when the maximum height is reached is 4.89 seconds The maximum height reached for 16 Newtons of thrust is: 113.83 meters

Explanation / Answer

mass = input('Please enter the mass of the rocket in kilograms: ');

thrust = input('Please enter the thrusdt of the rocket in Newtons: ');

t1 = input('Please enter the time of thrust of the rocket in seconds: ');

g=9.81;

acc = (thrust - mass*g) / mass;

v1 = acc*t1;
t2 = v1/g;


time = t1+t2;

d1 = 0.5*acc*t1*t1;
d2 = (v1*t2) - (0.5*g*t2*t2);
height = d1 + d2;

fprintf('The time when maximum height is reached is: %.2f seconds ', time);

fprintf('The maximum height reached for 16 Newtons of thrust is: %.2f meters ', height);