Products & Services Solutions Academia Support User Community Company

Learn more about Aerospace Toolbox   

angle2quat - Convert rotation angles to quaternion

Syntax

quaternion = angle2quat(rotationAng1,rotationAng2,rotationAng3)
quaternion = angle2quat(rotationAng1,rotationAng2,rotationAng3,rotationSequence)

Description

quaternion = angle2quat(rotationAng1,rotationAng2,rotationAng3) calculates the quaternion for three rotation angles.

quaternion = angle2quat(rotationAng1,rotationAng2,rotationAng3,rotationSequence) calculates the quaternion using a rotation sequence.

Inputs

rotationAng1

m-by-1 array of first rotation angles, in radians.

rotationAng2

m-by-1 array of second rotation angles, in radians.

rotationAng3

m-by-1 array of third rotation angles, in radians.

rotationSequence

String that defines rotation sequence. For example, the default 'ZYX' represents a sequence where rotationAng1 is z-axis rotation, rotationAng2 is y-axis rotation, and rotationAng3 is x-axis rotation.

'ZYX'
'ZYZ'
'ZXY'
'ZXZ'
'YXZ'
'YXY'
'YZX'
'YZY'
'XYZ'
'XZY'
'XYX'
'XZX'
'ZYX' (default)

Outputs

quaternion

m-by-4 matrix containing m quaternions. quaternion has its scalar number as the first column.

Examples

Determine the quaternion from rotation angles:

yaw = 0.7854; 
pitch = 0.1; 
roll = 0;
q = angle2quat(yaw, pitch, roll)
q =
    0.9227   -0.0191    0.0462    0.3822
 

Determine the quaternion from rotation angles and rotation sequence:

yaw = [0.7854 0.5]; 
pitch = [0.1 0.3]; 
roll = [0 0.1];
q = angle2quat(pitch, roll, yaw, 'YXZ')
q =
    0.9227    0.0191    0.0462    0.3822
    0.9587    0.0848    0.1324    0.2371

See Also

angle2dcm | dcm2angle | dcm2quat | quat2angle | quat2dcm

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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