# Custom Variable Mass 6DOF (Quaternion)

Implement quaternion representation of six-degrees-of-freedom equations of motion of custom variable mass with respect to body axes

**Libraries:**

Aerospace Blockset /
Equations of Motion /
6DOF

## Description

The Custom Variable Mass 6DOF (Quaternion) block implements a quaternion representation of six-degrees-of-freedom equations of motion of custom variable mass with respect to body axes. For a description of the coordinate system and the translational dynamics, see the block description for the Custom Variable Mass 6DOF (Euler Angles) block.

Aerospace Blockset™ uses quaternions that are defined using the scalar-first convention. For more information on the integration of the rate of change of the quaternion vector, see Algorithms.

## Limitations

The block assumes that the applied forces act at the center of gravity of the body.

## Ports

### Input

### Output

## Parameters

## Algorithms

The integration of the rate of change of the quaternion vector is given below. The
gain *K* drives the norm of the quaternion state vector to 1.0 should
*ε* become nonzero. You must choose the value of this gain with
care, because a large value improves the decay rate of the error in the norm, but also
slows the simulation because fast dynamics are introduced. An error in the magnitude in
one element of the quaternion vector is spread equally among all the elements,
potentially increasing the error in the state vector.

$$\begin{array}{l}\left[\begin{array}{c}{\dot{q}}_{0}\\ {\dot{q}}_{1}\\ {\dot{q}}_{2}\\ {\dot{q}}_{3}\end{array}\right]={\scriptscriptstyle \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.}\left[\begin{array}{cccc}0& -p& -q& -r\\ p& 0& r& -q\\ q& -r& 0& p\\ r& q& -p& 0\end{array}\right]\left[\begin{array}{c}{q}_{0}\\ {q}_{1}\\ {q}_{2}\\ {q}_{3}\end{array}\right]+K\epsilon \left[\begin{array}{c}{q}_{0}\\ {q}_{1}\\ {q}_{2}\\ {q}_{3}\end{array}\right]\\ \epsilon =1-({q}_{0}^{2}+{q}_{1}^{2}+{q}_{2}^{2}+{q}_{3}^{2}).\end{array}$$

## References

[1] Stevens, Brian, and Frank Lewis.
*Aircraft Control and Simulation*, 2nd ed. Hoboken, NJ: John
Wiley & Sons, 2003.

[2] Zipfel, Peter H. *Modeling
and Simulation of Aerospace Vehicle Dynamics*. 2nd ed. Reston, VA: AIAA
Education Series, 2007.

## Extended Capabilities

## Version History

**Introduced in R2006a**

## See Also

6DOF (Euler Angles) | 6DOF (Quaternion) | 6DOF ECEF (Quaternion) | 6DOF Wind (Quaternion) | 6DOF Wind (Wind Angles) | Custom Variable Mass 6DOF (Euler Angles) | Custom Variable Mass 6DOF ECEF (Quaternion) | Custom Variable Mass 6DOF Wind (Quaternion) | Custom Variable Mass 6DOF Wind (Wind Angles) | Simple Variable Mass 6DOF (Euler Angles) | Simple Variable Mass 6DOF ECEF (Quaternion) | Simple Variable Mass 6DOF Wind (Quaternion) | Simple Variable Mass 6DOF Wind (Wind Angles)