# 6DOF (Quaternion)

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

• Library:
• Aerospace Blockset / Equations of Motion / 6DOF

## Description

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

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, and that the mass and inertia are constant.

## Ports

### Input

expand all

Applied forces, specified as a three-element vector.

Data Types: `double`

Applied moments, specified as a three-element vector.

Data Types: `double`

### Output

expand all

Velocity in the flat Earth reference frame, returned as a three-element vector.

Data Types: `double`

Position in the flat Earth reference frame, returned as a three-element vector.

Data Types: `double`

Euler rotation angles [roll, pitch, yaw], returned as three-element vector, in radians.

Data Types: `double`

Coordinate transformation from flat Earth axes to body-fixed axes, returned as a 3-by-3 matrix.

Data Types: `double`

Velocity in the body-fixed frame, returned as a three-element vector.

Data Types: `double`

Angular rates in body-fixed axes, returned as a three-element vector, in radians per second.

Data Types: `double`

Angular accelerations in body-fixed axes, returned as a three-element vector, in radians per second squared.

Data Types: `double`

Accelerations in body-fixed axes with respect to body frame, returned as a three-element vector.

Data Types: `double`

Accelerations in body-fixed axes with respect to inertial frame (flat Earth), returned as a three-element vector. You typically connect this signal to the accelerometer.

#### Dependencies

This port appears only when the Include inertial acceleration check box is selected.

Data Types: `double`

## Parameters

expand all

### Main

Input and output units, specified as `Metric (MKS)`, `English (Velocity in ft/s)`, or `English (Velocity in kts)`.

UnitsForcesMomentAccelerationVelocityPositionMassInertia
`Metric (MKS)` NewtonNewton-meterMeters per second squaredMeters per secondMetersKilogramKilogram meter squared
`English (Velocity in ft/s)` PoundFoot-poundFeet per second squaredFeet per secondFeetSlugSlug foot squared
`English (Velocity in kts)` PoundFoot-poundFeet per second squaredKnotsFeetSlugSlug foot squared

#### Programmatic Use

 Block Parameter: `units` Type: character vector Values: `Metric (MKS)` | `English (Velocity in ft/s)` | `English (Velocity in kts)` Default: `Metric (MKS)`

Mass type, specified according to the following table.

Mass TypeDescriptionDefault for
`Fixed`

Mass is constant throughout the simulation.

`Simple Variable`

Mass and inertia vary linearly as a function of mass rate.

`Custom Variable`

Mass and inertia variations are customizable.

The `Simple Variable` selection conforms to the previously described equations of motion.

#### Programmatic Use

 Block Parameter: `mtype` Type: character vector Values: `Fixed` | `Simple Variable` | `Custom Variable` Default: `Simple Variable`

Equations of motion representation, specified according to the following table.

RepresentationDescription

`Euler Angles`

Use Euler angles within equations of motion.

`Quaternion`

Use quaternions within equations of motion.

The `Quaternion` selection conforms to the equations of motion in Algorithms.

#### Programmatic Use

 Block Parameter: `rep` Type: character vector Values: `Euler Angles` | `Quaternion` Default: `'Quaternion'`

Initial location of the body in the flat Earth reference frame, specified as a three-element vector.

#### Programmatic Use

 Block Parameter: `xme_0` Type: character vector Values: `'[0 0 0]'` | three-element vector Default: `'[0 0 0]'`

Initial velocity in body axes, specified as a three-element vector, in the body-fixed coordinate frame.

#### Programmatic Use

 Block Parameter: `Vm_0` Type: character vector Values: `'[0 0 0]'` | three-element vector Default: `'[0 0 0]'`

Initial Euler orientation angles [roll, pitch, yaw], specified as a three-element vector, in radians. Euler rotation angles are those between the body and north-east-down (NED) coordinate systems.

#### Programmatic Use

 Block Parameter: `eul_0` Type: character vector Values: `'[0 0 0]'` | three-element vector Default: `'[0 0 0]'`

Initial body-fixed angular rates with respect to the NED frame, specified as a three-element vector, in radians per second.

#### Programmatic Use

 Block Parameter: `pm_0` Type: character vector Values: `'[0 0 0]'` | three-element vector Default: `'[0 0 0]'`

Initial mass of the rigid body, specified as a double scalar.

#### Programmatic Use

 Block Parameter: `mass_0` Type: character vector Values: `'1.0'` | double scalar Default: `'1.0'`

Inertia of the body, specified as a double scalar.

#### Dependencies

To enable this parameter, set Mass type to `Fixed`.

#### Programmatic Use

 Block Parameter: `inertia` Type: character vector Values: `eye(3)` | double scalar Default: `eye(3)`

Gain to maintain the norm of the quaternion vector equal to 1.0, specified as a double scalar.

#### Programmatic Use

 Block Parameter: `k_quat` Type: character vector Values: `1.0` | double scalar Default: `1.0`

Select this check box to add an inertial acceleration port.

#### Dependencies

To enable the Abe port, select this parameter.

#### Programmatic Use

 Block Parameter: `abi_flag` Type: character vector Values: `'off'` | `'on'` Default: `off`

### State Attributes

Assign a 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 comma-separated list surrounded by braces, for example, `{'a', 'b', 'c'}`. Each name must be unique.

• If a parameter is empty (`' '`), no name is assigned.

• 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.

Position state names, specified as a comma-separated list surrounded by braces.

#### Programmatic Use

 Block Parameter: `xme_statename` Type: character vector Values: `''` | comma-separated list surrounded by braces Default: `''`

Velocity state names, specified as comma-separated list surrounded by braces.

#### Programmatic Use

 Block Parameter: `Vm_statename` Type: character vector Values: `''` | comma-separated list surrounded by braces Default: `''`

Quaternion vector state names, specified as a comma-separated list surrounded by braces.

#### Programmatic Use

 Block Parameter: `quat_statename` Type: character vector Values: `''` | comma-separated list surrounded by braces Default: `''`

Body rotation rate state names, specified comma-separated list surrounded by braces.

#### Programmatic Use

 Block Parameter: `pm_statename` Type: character vector Values: `''` | comma-separated list surrounded by braces Default: `''`

## 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 $\epsilon$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}{\stackrel{˙}{q}}_{0}\\ {\stackrel{˙}{q}}_{1}\\ {\stackrel{˙}{q}}_{2}\\ {\stackrel{˙}{q}}_{3}\end{array}\right]=1}{2}\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-\left({q}_{0}^{2}+{q}_{1}^{2}+{q}_{2}^{2}+{q}_{3}^{2}\right)\end{array}$`

Aerospace Blockset™ uses quaternions that are defined using the scalar-first convention.

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using Simulink® Coder™.

Introduced in R2006a

Get trial now