Quaternions to Direction Cosine Matrix

Convert quaternion vector to direction cosine matrix

Library

Utilities/Axes Transformations

Description

The Quaternions to Direction Cosine Matrix block transforms the four-element unit quaternion vector (q0, q1, q2, q3) into a 3-by-3 direction cosine matrix (DCM). The outputted DCM performs the coordinate transformation of a vector in inertial axes to a vector in body axes.

Using quaternion algebra, if a point P is subject to the rotation described by a quaternion q, it changes to P′ given by the following relationship:

P=qPqcq=q0+iq1+jq2+kq3qc=q0iq1jq2kq3P=0+ix+jy+kz

Expanding P′ and collecting terms in x, y, and z gives the following for P′ in terms of P in the vector quaternion format:

P=[0xyz]=[0(q02+q12q22q32)x+2(q1q2q0q3)y+2(q1q3+q0q2)z2(q0q3+q1q2)x+(q02q12+q22q32)y+2(q2q3q0q1)z2(q1q3q0q2)x+2(q0q1+q2q3)y+(q02q12q22+q32)z]

Since individual terms in P′ are linear combinations of terms in x, y, and z, a matrix relationship to rotate the vector (x, y, z) to (x′, y′, z′) can be extracted from the preceding. This matrix rotates a vector in inertial axes, and hence is transposed to generate the DCM that performs the coordinate transformation of a vector in inertial axes into body axes.

DCM=[(q02+q12q22q32)2(q1q2+q0q3)2(q1q3q0q2)2(q1q2q0q3)(q02q12+q22q32)2(q2q3+q0q1)2(q1q3+q0q2)2(q2q3q0q1)(q02q12q22+q32)]

Dialog Box

Inputs and Outputs

InputDimension TypeDescription

First

4-by-1 quaternion vectorContains the quaternion vector.

OutputDimension TypeDescription

First

3-by-3 direction cosine matrix.Contains the direction cosine matrix.

Was this topic helpful?