| Aerospace Toolbox | ![]() |
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. Additionally, q has its scalar number as the first column.
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.4963angle2dcm, dcm2angle, dcm2quat, angle2quat, quat2angle, quatrotate
![]() | quat2angle | quatconj | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |