Representations of Body Orientation

About Body Orientation Representations

You represent a Simscape™ Multibody™ 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.

Axis-Angle Representation

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 n = (nx,ny,nz) is a three-component unit vector, where n·n = nx2 + ny2 + nz2 = 1. The axis n is sometimes called the eigenaxis.

Simscape Multibody 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: [nx ny nz θ]. 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.

Quaternion Representation

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

q= [nxsin(θ/2), nysin(θ/2), nzsin(θ/2), cos(θ/2)]=[qv, qs]

with q*q = qv·qv + qs2 = 1. This definition uses the axis-angle representation defined above. The rotation angle about that axis is θ. To describe continuous rotation in time, treat n and θ as functions of time. Unlike some rotation representations, quaternions never become singular.

Rotation Matrix Representation

The axis-angle representation also defines the rotation matrix R in exponential form R = exp(θ J), where the Jk are real, antisymmetric matrices, and J = nxJ1 + ny J2 + nz J3. The rotation matrix R is orthogonal: RRT = RTR = I.

The J matrices are related to the antisymmetric permutation symbol ɛijk.


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

R=exp(θnJ) = I + (nJ)sinθ + (nJ)2(1cosθ)

where I is the identity matrix, and J is given by


The inverse of R is identical to its transpose RT. 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.

Euler Angle Representation

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:

RBW = R3*R2*R1

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

RWB = R1*R2*R3

The Euler angle convention is to

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

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

  3. 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,

RBW = RX1)*RY2)*RZ3)

RWB = RZ(Φ)*RX(θ)*RZ(Ψ)

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

RZ(ϕ)=(cosϕsinϕ0sinϕ cosϕ0001)

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.

Converting Rotation Representations

Certain Simscape Multibody 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.

Transforming the Axis-Angle Representation

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

q= [nxsin(θ/2), nysin(θ/2), nzsin(θ/2), cos(θ/2)]=[qv, qs]R=exp(θnJ) = I + (nJ)sinθ + (nJ)2(1cosθ)


Transforming the Quaternion Representation

The quaternion is a vector-scalar pair, q = [qv qs], defined by Quaternion Representation. You can recover the axis-angle representation from the quaternion components:


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

R = (2qs21)I+2qsQv+2qvTqv(Qv)ik=jεijk(qv)j

The term qvTqv is the outer product of qv with itself, the 3-by-3 matrix of qv components multiplied by each other.

Transforming the Rotation Matrix Representation

The rotation matrix R is an orthogonal 3-by-3 matrix: RRT = RTR = I, defined in Rotation Matrix Representation. You can invert the rotation matrix representation to obtain the equivalent representations for the quaternion q = [qv qs] and axis-angle (n, θ)


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, (Jj)ik = ɛijk. See The Permutation Symbol and the Vector Cross Product for more details.

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

Transforming the Euler Angle Representation

The Euler angle representation of a rotation, defined by Euler Angle Representation, 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 RWB = R1(Φ)*R2(θ)*R3(Ψ),

RWB(ϕ, θ, ψ)=(cosϕsinϕ0sinϕ cosϕ0001)(1000cosθsinθ0sinθ cosθ)(cosψsinψ0sinψ cosψ0001) =(cosϕcosψsinϕcosθsinψcosϕsinψsinϕcosθcosψ sinϕsinθsinϕcosψ+cosϕcosθsinψsinϕsinψ+cosϕcosθcosψcosϕsinθsinθsinψsinθcosψcosθ)

In this convention, you can read θ from the R33 component, then find Ψ from the R32 or R31 component. Obtain Φ from one of the other components, using cos2Φ + sin2Φ = 1, or by multiplying from the right by R3ΨT, then R2θT. The second method yields a unique solution for the sine and cosine of Φ.

Converting the Angular Velocity

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

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.

The quaternion derivative is also related to the angular velocity:


Was this topic helpful?