Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dcm2angle

Create rotation angles from direction cosine matrix

Syntax

[r1 r2 r3] = dcm2angle(n)
[r1 r2 r3] = dcm2angle(n, s)
[r1 r2 r3] = dcm2angle(n, s, lim)

Description

[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. This function applies only to direction cosine matrices that are orthogonal with determinant +1.

[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 sequences 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 specifies either 'Default' or 'ZeroR3'. See Assumptions and Limitations for full definitions of angle constraints.

Examples

Determine the rotation angles from direction cosine matrix:

dcm = [1 0 0; 0 1 0; 0 0 1];
[yaw, pitch, roll] = dcm2angle( dcm )
yaw =

     0

pitch =

     0

roll =

     0

Determine the rotation angles from multiple direction cosine matrices:

dcm        = [ 1 0 0; 0 1 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 =

         0
    0.5000

Assumptions and Limitations

The '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.

Introduced in R2006b

Was this topic helpful?