Quaternions to Direction Cosine Matrix
Convert quaternion vector to direction cosine matrix
Aerospace Blockset / Utilities / Axes Transformations
The Quaternions to Direction Cosine Matrix block transforms a 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. Aerospace Blockset™ uses quaternions that are defined using the scalar-first convention. This block normalizes all quaternion inputs. For more information, see Algorithms.
q — Quaternion
Quaternion, specified as a 4-by-1 vector.
DCMbe — Direction cosine matrix
Direction cosine matrix, returned as a 3-by-3 matrix.
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:
Expanding P′ and collecting terms in x, y, and z gives the following for P′ in terms of P in the vector quaternion format:
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.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Introduced before R2006a