quat2dcm - Convert quaternion to direction cosine matrix
Syntax
n = quat2dcm(q)
Description
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. Additionally, q has
its scalar number as the first column.
Examples
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 0Determine 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.4963See Also
angle2dcm, dcm2angle, dcm2quat, angle2quat, quat2angle, quatrotate
 | quat2angle | | quatconj |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit