Convert quaternion to direction cosine matrix
n = quat2dcm(q)
n = quat2dcm(q)
calculates the direction cosine
matrix, n
, for a given quaternion, q
. Input
q
is an m
-by-4 matrix containing
m
quaternions. n
returns a
3-by-3-by-m
matrix of direction cosine matrices. The direction
cosine matrix performs the coordinate transformation of a vector in inertial axes to a
vector in body axes. Each element of q
must be a real number.
Aerospace Toolbox uses quaternions that are defined using the scalar-first convention.
Determine the direction cosine matrix from q = [1 0
1 0]
:
dcm = quat2dcm([1 0 1 0]) dcm = 0 0 -1.0000 0 1.0000 0 1.0000 0 0
Determine the direction cosine matrices from multiple quaternions:
q = [1 0 1 0; 1 0.5 0.3 0.1]; dcm = quat2dcm(q) dcm(:,:,1) = 0 0 -1.0000 0 1.0000 0 1.0000 0 0 dcm(:,:,2) = 0.8519 0.3704 -0.3704 0.0741 0.6148 0.7852 0.5185 -0.6963 0.4963
angle2dcm
| angle2quat
| dcm2angle
| dcm2quat
| quat2angle
| quatrotate