Implement threedegreesoffreedom equations of motion of simple variable mass with respect to body axes
Equations of Motion/3DOF
The Simple Variable Mass 3DOF (Body Axes) block considers the rotation in the vertical plane of a bodyfixed coordinate frame about a flat Earth reference frame.
The equations of motion are
$$\begin{array}{l}{A}_{xb}=\dot{u}=\frac{{F}_{x}}{m}\frac{\dot{m}Ur{e}_{b}}{m}qwg\mathrm{sin}\theta \\ {A}_{be}=\left[\begin{array}{c}{A}_{xe}\\ {A}_{ze}\end{array}\right]=\frac{{F}_{b}\dot{m}{V}_{re}}{m}\overline{g}\\ Vr{e}_{b}=\begin{array}{cc}[Ure& {Wre]}_{b}\end{array}\\ {A}_{zb}=\dot{w}=\frac{{F}_{z}}{m}\frac{\dot{m}Wr{e}_{b}}{m}+qu+g\mathrm{cos}\theta \\ \dot{q}=\frac{M{\dot{I}}_{yy}q}{{I}_{yy}}\\ \dot{\theta}=q\\ {\dot{I}}_{yy}=\frac{{I}_{yyfull}{I}_{yyempty}}{{m}_{full}{m}_{empty}}\dot{m}\end{array}$$
where the applied forces are assumed to act at the center of gravity of the body. Ure_{b} and Wre_{b} are the relative velocities of the mass flow ($$\dot{m}$$) being added to or ejected from the body in bodyfixed axes.
Specifies the input and output units:
Units  Forces  Moment  Acceleration  Velocity  Position  Mass  Inertia 

 Newton  Newton meter  Meters per second squared  Meters per second  Meters  Kilogram  Kilogram meter squared 
 Pound  Foot pound  Feet per second squared  Feet per second  Feet  Slug  Slug foot squared 
 Pound  Foot pound  Feet per second squared  Knots  Feet  Slug  Slug foot squared 
Select the type of mass to use:
 Mass is constant throughout the simulation. 
 Mass and inertia vary linearly as a function of mass rate. 
 Mass and inertia variations are customizable. 
The Simple Variable
selection conforms to the
previously described equations of motion.
A scalar value for the initial velocity of the body, (V_{0}).
A scalar value for the initial pitch attitude of the body, (θ_{0}).
A scalar value for the initial angle between the velocity vector and the body, $$({\alpha}_{0})$$.
A scalar value for the initial body rotation rate, (q_{0}).
A twoelement vector containing the initial location of the body in the flat Earth reference frame.
A scalar value for the initial mass of the body.
A scalar value for the inertia of the body.
A scalar value for the empty mass of the body.
A scalar value for the full mass of the body.
A scalar value for the empty inertia of the body.
A scalar value for the full inertia of the body.
Specify source of gravity:
 Variable gravity input to block 
 Constant gravity specified in Acceleration due to gravity 
A scalar value for the acceleration due to gravity used if internal
gravity source is selected. If gravity is to be neglected in the
simulation, this value can be set to 0. This parameter appears if you
set Gravity source to
Internal
.
Select this check box to add a mass flow relative velocity port. This is the relative velocity at which the mass is accreted or ablated.
Select this check box to enable an additional output port for the accelerations in bodyfixed axes with respect to the inertial frame. You typically connect this signal to the accelerometer.
Assign unique name to each state. You can use state names instead of block paths during linearization.
To assign a name to a single state, enter a unique name between quotes,
for example, 'velocity'
.
To assign names to multiple states, enter a commadelimited list
surrounded by braces, for example, {'a', 'b', 'c'}
. Each
name must be unique.
If a parameter is empty (' '
), no name assignment
occurs.
The state names apply only to the selected block with the name parameter.
The number of states must divide evenly among the number of state names.
You can specify fewer names than states, but you cannot specify more names than states.
For example, you can specify two names in a system with four states. The first name applies to the first two states and the second name to the last two states.
To assign state names with a variable in the MATLAB^{®} workspace, enter the variable without quotes. A variable can be a character vector, cell array, or structure.
Specify velocity state names.
Default value is ''
.
Specify pitch attitude state name.
Default value is ''
.
Specify position state names.
Default value is ''
.
Specify pitch angular rate state name.
Default value is ''
.
Specify mass state name.
Default value is ''
.
Input  Dimension Type  Description 

First  Contains the force acting along the body xaxis, (F_{x}).  
Second  Contains the force acting along the body zaxis, (F_{z}).  
Third  Contains the applied pitch moment, (M).  
Fourth  Contains one or more rates of change of mass, $$(\dot{m})$$ (positive if accreted, negative if ablated).  
Fifth (Optional)  Contains the gravity in the selected units.  
Sixth (Optional)  Twoelement vector  Contains one or more relative velocities at which the mass is accreted to or ablated from the body in bodyfixed axes. 
Output  Dimension Type  Description 

First  Contains the pitch attitude, within ±pi, in radians (θ).  
Second  Contains the pitch angular rate, in radians per second (q).  
Third  Contains the pitch angular acceleration, in radians per second squared $$(\dot{q})$$.  
Fourth  Twoelement vector  Contains the location of the body, in the flat Earth reference frame, (Xe, Ze). 
Fifth  Twoelement vector  Contains the velocity of the body resolved into the bodyfixed coordinate frame, (u, w). 
Sixth  Twoelement vector  Contains the acceleration of the body resolved into the bodyfixed coordinate frame, (Ax,Az). 
Seventh  Scalar element  Contains a flag for fuel tank status, (Fuel):

Eighth (Optional)  Twoelement vector  Contains the accelerations in bodyfixed axes with respect to inertial frame (flat Earth). You typically connect this signal to the accelerometer. 