## Documentation Center |

On this page… |
---|

About Body Orientation Representations Rotation Matrix Representation |

You represent a SimMechanics™ body's orientation by specifying the orientation of its center of gravity coordinate system (CG CS) axes relative to some other set of axes, either the CS axes of an adjoining body or the World CS axes. No reorientation is represented by "no rotation" or the rotational identity.

A general rotation of a body in three dimensions has three independent degrees of freedom. There are many equivalent and interconvertible ways to represent these degrees of freedom . The Body and related Body Sensor and RotationMatrix2VR blocks use the following representations. The block reference pages for these blocks discuss block-specific details.

The *axis-angle* representation
of a rotation is the most fundamental form. Specify a rotation axis ** n**, then rotate by the right-hand rule about that axis by
some angle θ. The vector

SimMechanics models do not make direct use of the axis-angle representation, but it is the starting point for deriving other forms. It is also used extensively in mechanical applications such as computer-aided design and robotics.

The axis-angle representation is usually written as a 4-vector:
[*n*_{x} *n*_{y} *n*_{z} θ].
Of the four numbers, three are independent, because ** n** always has unit length. The remaining freedom
in this vector allows you to specify a direction (two angles) and
the size and sense of the rotation about that directional axis (magnitude
and sign of θ).

To describe continuous rotation in time, treat ** n** and θ as functions of time.

A *quaternion* represents
a three-dimensional rotation as a four-component row vector of unit
length:

with * q*q* =

For more about quaternions, see Bell and Shuster in the chapter references.

The axis-angle representation also defines the *rotation matrix* *R* in
exponential form *R* = exp(θ *n·*** J**),
where the

The *J* matrices are related to the antisymmetric
permutation symbol ɛ_{ijk}.

The exponential *R* is reduced to closed form
by the *Rodrigues identity*:

where *I* is the identity matrix, and *n·*** J** is
given by

The inverse of *R* is identical to its transpose *R*^{T}.
You can also obtain the inverse by replacing θ with θ
or by reversing the direction of ** n**.

To describe continuous rotation in time, treat ** n** and θ as functions of time.

An alternative representation for *R* is to
rotate, in succession, about three independent axes, by three independent *Euler angles*. A full rotation *R* starting
in *World* composes by multiplying the matrices
successively on the *left*:

*R*_{BW} = *R*_{3}**R*_{2}**R*_{1}

A full rotation *R* starting in a *body
CS* composes by multiplying the matrices successively on
the *right*:

*R*_{WB} = *R*_{1}**R*_{2}**R*_{3}

The Euler angle convention is to

Rotate about one body coordinate axis (which rotates the other two).

Then rotate about a second body coordinate axis (rotated from its original direction) not identical to the first.

Lastly, rotate about another body coordinate axis not identical to the second.

Thus there are 3*2*2 = 12 possible Euler angle rotation sequences.
The rotation axis sequences *Z-X-Z* and *Z-Y-X* are
common. Rotation angles are often labeled as θ_{1},
θ_{2}, θ_{3} or
Φ, θ, Ψ as the first, second, and third angles,
respectively. For example,

*R*_{BW} = *R*_{X}(θ_{1})**R*_{Y}(θ_{2})**R*_{Z}(θ_{3})

*R*_{WB} = *R*_{Z}(Φ)**R*_{X}(θ)**R*_{Z}(Ψ)

A two-dimensional rotation about a fixed axis requires one angle.
For example, rotating the *x*- and *y*-axes
about the *z*-axis by Φ is represented by

To describe continuous rotation in time, treat the Euler angles as functions of time. The Euler angle representation is singular in certain limiting situations. Such singularities are artifacts of the Euler angle form and have no geometric or physical significance.

Certain SimMechanics blocks make use of different rotation representations.

The Body block makes direct use of the Euler angle, rotation matrix, and quaternion representations.

The Body Sensor block makes use of the rotation matrix.

The RotationMatrix2VR block uses the rotation matrix and axis-angle forms.

The four rotation representations presented in this section are equivalent. You can represent a rotation equally well with any one of them. Some applications, however, tend to favor one representation over the others, and certain representations are singular in certain limits. It is helpful to know how to convert the various rotation representations into one another. The following summaries group the conversion formulas into one place.

The rotation axis unit vector ** n** and
the rotation angle θ define this representation, which is discussed
in detail in Axis-Angle Representation preceding.
This representation defines the quaternion and rotation matrix representations:

The quaternion is a vector-scalar pair, `q`` `= [*q*_{v} *q*_{s}],
defined by Quaternion Representation preceding.
You can recover the axis-angle representation from the quaternion
components:

You can also construct the equivalent rotation matrix *R* from *q*.

The term
is the *outer product* of *q*_{v} with itself, the
3-by-3 matrix of *q*_{v} components
multiplied by each other.

The rotation matrix *R* is an orthogonal 3-by-3
matrix: *RR*^{T} = *R*^{T}*R* = *I*, defined in Rotation Matrix Representation preceding. You can invert the rotation
matrix representation to obtain the equivalent representations for
the quaternion * q* = [

The trace *Tr* of a matrix is the sum of
its diagonal elements.

The J matrices constitute a 3-vector of matrices defined by
the antisymmetric permutation symbol, (*J*^{j})_{ik} = ɛ_{ijk}.
See The Permutation Symbol and the Vector Cross Product preceding for more details.

The RotationMatrix2VR block converts the rotation matrix to the axis-angle representation.

The Euler angle representation of a rotation, defined by Euler Angle Representation preceding, stands apart from the other three, insofar as you cannot derive it from the axis-angle representation. It depends on the choice of rotation axis sequence, which generates multiple definition conventions. The Euler angle representation, at certain limits, can also be singular. Use caution with Euler angle expressions.

If you choose a convention and three angles, then compute *R*,
you can convert *R* to the other representations
by the use of Transforming the Rotation Matrix Representation above.
But given the nine components of *R*, you must find
the Euler angles by inverting the nine equations that result from
this matrix equation. (Only three equations of the nine are independent.)
In some cases, angles can be read from *R* by inspection.

For example, choose rotations with respect to a Body coordinate
system (CS) triad, in a commonly used rotation axis sequence *Z-X-Z*,
with Φ, θ, Ψ as the respective angles. The rotation
matrix is *R*_{WB} = *R*_{1}(Φ)**R*_{2}(θ)**R*_{3}(Ψ),

In this convention, you can read θ from the *R*_{33} component,
then find Ψ from the *R*_{32} or *R*_{31} component.
Obtain Φ from one of the other components, using cos^{2}Φ
+ sin^{2}Φ = 1,
or by multiplying from the right by *R*_{3}Ψ^{T},
then *R*_{2}θ^{T}.
The second method yields a unique solution for the sine and cosine
of Φ.

The rotation matrix *R* is defined in Representations of Body Motion and Rotation Matrix Representation preceding.

The angular velocity vector ω is the rate at which a spinning
CS rotates. *R* and the antisymmetric matrix Ω
define ω:

You can also express the angular velocity in terms of Euler
angles, by choosing a particular set of angles to represent *R*.
See Euler Angle Representation and Transforming the Euler Angle Representation preceding.

The quaternion derivative is also related to the angular velocity:

Was this topic helpful?