Question: Problem 3 : A model rocket ( with mass m = 1 0 kg ) initially at rest on the ground ( Zo = 0
Problem : A model rocket with mass m kg initially at rest on the ground Zo
is launched upward. The motion of the rocket is described by the following differential
equations:
dw
dt g T h
m
dz
dt w
where t is time, z is altitude, w is velocity, and T h is the upward thrust due to the propulsion
of the rocket and g is gravity. In this exercise, the upward thrust Th varies with time as
follows:
T htN f or t s
T htN f or t s
T htN f or t s
and the gravity g varies with altitude z as follows:
gz
z
ms f or z m
g ms f or z m
Using EulerCromer method, the differential equations can be approximated by
Wn Wn
gn T hn
m
t
Zn Zn Wnt
where t is the time step and capital letters are used to denote approximated quantities.
In this exercise, you will create a file rocket.m to include functions. The primary
function should be named rocket and two subfunctions should be named gravity and
thrust.
The rocket function solves the governing equations for the projectile motion of the rocket.
It should have the following header: function T Z W rocket Tf dt where the
input Tf is the duration of the flight of the rocket and dt is the time step. The output
vectors T Z and W are the time, altitude and velocity of the rocket, respectively.
The thrust subfunction computes the thrust at a given time during the flight. It should
have the following header: function Th thrustt where the input t is the time and
the output Th is the upward thrust given above. Both input and output are single numbers.
The gravity subfunction computes the value of gravity at a given time during the flight.
It should have the following header: function g gravityz where the input z is the
altitude of the rocket and the output g is the altitudedependent gravity given above. Both
input and output are single numbers.
Give all functions a description.
a Set pa evalchelp rocket'
b Set pb evalchelp gravity'
c Set pc evalchelp thrust'
d Set pd evalchelp rocketgravity'
e Set pe evalchelp rocketthrust'
fg Compute the altitude and velocity of the rocket at s using t s Put the
answers in pf and pg respectively. The answers should be single numbers, not vectors.
h Create figure Use function subplot to include panels with one on top of the
other. The top panel shows how the altitude of the rocket changes with time during the
second flight. The bottom panel shows velocity versus time. Set ph 'See figure
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
