This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

angle2dcm

Convert rotation angles to direction cosine matrix

Syntax

dcm = angle2dcm(rotationAng1,rotationAng2,rotationAng3)
dcm = angle2dcm(___,rotationSequence)

Description

example

dcm = angle2dcm(rotationAng1,rotationAng2,rotationAng3) calculates the direction cosine matrix given three sets of rotation angles specifying yaw, pitch, and roll.

dcm = angle2dcm(___,rotationSequence) calculates the direction cosine matrix given three sets of rotation angles.

Examples

collapse all

Direction cosine matrix from angles

Calculate direction cosine matrix from rotation angles.

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

    0.7036    0.7036   -0.0998
   -0.7071    0.7071         0
    0.0706    0.0706    0.9950

Direction cosine matrix from rotation angle and sequence

Calculate direction cosine matrix from rotation angles and rotation sequence.

yaw = [0.7854 0.5];  
pitch = [0.1 0.3];  
roll = [0 0.1];
dcm = angle2dcm( pitch, roll, yaw, 'YXZ' )
dcm = 
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

Input Arguments

collapse all

First rotation angles, specified as an m-by-1 array, in rads.

Data Types: double | single

Second rotation angles, specified as an m-by-1 array, in rads.

Data Types: double | single

Third rotation angles, specified as an m-by-1 array, in rads.

Data Types: double | single

Rotation sequence, specified as a scalar.

Data Types: char | string

Output Arguments

collapse all

Direction cosine matrices, specified as a 3-by-3-by-m matrix, where m is the number of direction cosine matrices.

Introduced in R2006b