| Aerospace Toolbox | ![]() |
[r1 r2 r3] = dcm2angle(n)
[r1 r2 r3] = dcm2angle(n, s)
[r1 r2 r3] = dcm2angle(n, s, lim)
[r1 r2 r3] = dcm2angle(n) calculates the set of rotation angles, r1, r2, r3, for a given direction cosine matrix, n. n is a 3-by-3-by-m matrix containing m direction cosine matrices. r1 returns an m array of first rotation angles. r2 returns an m array of second rotation angles. r3 returns an m array of third rotation angles. Rotation angles are output in radians.
[r1 r2 r3] = dcm2angle(n, s) calculates the set of rotation angles, r1, r2, r3, for a given direction cosine matrix, n, and a specified rotation sequence, s.
The default rotation sequence is 'ZYX', where r1 is z-axis rotation, r2 is y-axis rotation, and r3 is x-axis rotation.
Supported rotation sequence strings are 'ZYX', 'ZYZ', 'ZXY', 'ZXZ', 'YXZ', 'YXY', 'YZX', 'YZY', 'XYZ', 'XYX', 'XZY', and 'XZX'.
[r1 r2 r3] = dcm2angle(n, s, lim) calculates the set of rotation angles, r1, r2, r3, for a given direction cosine matrix, n, a specified rotation sequence, s, and a specified angle constraint, lim. lim is a string specifying either 'Default' or 'ZeroR3'. See Assumptions and Limitations for full definitions of angle constraints.
Determine the rotation angles from direction cosine matrix:
dcm = [0 1 0; 1 0 0; 0 0 1];
[yaw pitch roll] = dcm2angle(dcm)
yaw =
1.5708
pitch =
0
roll =
0Determine the rotation angles from multiple direction cosine matrices:
dcm = [ 0 1 0; 1 0 0; 0 0 1];
dcm(:,:,2) = [ 0.85253103550038 0.47703040785184 -0.21361840626067; ...
-0.43212157513194 0.87319830445628 0.22537893734811; ...
0.29404383655186 -0.09983341664683 0.95056378592206];
[pitch roll yaw] = dcm2angle(dcm, 'YXZ')
pitch =
0
0.3000
roll =
0
0.1000
yaw =
1.5708
0.5000The 'Default' limitations for the 'ZYX', 'ZXY', 'YXZ', 'YZX', 'XYZ', and 'XZY' implementations generate an r2 angle that lies between ±90 degrees, and r1 and r3 angles that lie between ±180 degrees.
The 'Default' limitations for the 'ZYZ', 'ZXZ', 'YXY', 'YZY', 'XYX', and 'XZX' implementations generate an r2 angle that lies between 0 and 180 degrees, and r1 and r3 angles that lie between ±180 degrees.
The 'ZeroR3' limitations for the 'ZYX', 'ZXY', 'YXZ', 'YZX', 'XYZ', and 'XZY' implementations generate an r2 angle that lies between ±90 degrees, and r1 and r3 angles that lie between ±180 degrees. However, when r2 is ±90 degrees, r3 is set to 0 degrees.
The 'ZeroR3' limitations for the 'ZYZ', 'ZXZ', 'YXY', 'YZY', 'XYX', and 'XZX' implementations generate an r2 angle that lies between 0 and 180 degrees, and r1 and r3 angles that lie between ±180 degrees. However, when r2 is 0 or ±180 degrees, r3 is set to 0 degrees.
angle2dcm, dcm2quat, quat2dcm, quat2angle
![]() | dcm2alphabeta | dcm2latlon | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |