angle2dcm - Create direction cosine matrix from rotation angles

Syntax

n = angle2dcm(r1, r2, r3)
n = angle2dcm(r1, r2, r3, s)

Description

n = angle2dcm(r1, r2, r3) calculates the direction cosine matrix, n, for a given set of rotation angles, r1, r2, r3. r1 is an m array of first rotation angles. r2 is an m array of second rotation angles. r3 is an m array of third rotation angles. n returns a 3-by-3-by-m matrix containing m direction cosine matrices. Rotation angles are input in radians.

n = angle2dcm(r1, r2, r3, s) calculates the direction cosine matrix, n, for a given set of rotation angles, r1, r2, r3, 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'.

Examples

Determine the direction cosine matrix from rotation angles:

yaw = 0.7854; 
pitch = 0.1; 
roll = 0;
dcm = angle2dcm(yaw, pitch, roll)

dcm =

    0.7036    0.7036   -0.0998
   -0.7071    0.7071         0
    0.0706    0.0706    0.9950

Determine the direction cosine matrix from multiple rotation angles:

yaw = [0.7854 0.5]; 
pitch = [0.1 0.3]; 
roll = [0 0.1];
dcm = angle2dcm(pitch, roll, yaw, 'YXZ')

dcm(:,:,1) =

    0.7036    0.7071   -0.0706
   -0.7036    0.7071    0.0706
    0.0998         0    0.9950


dcm(:,:,2) =

    0.8525    0.4770   -0.2136
   -0.4321    0.8732    0.2254
    0.2940   -0.0998    0.9506

See Also

angle2dcm, dcm2angle, dcm2quat, quat2dcm, quat2angle

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS