Main Content

eulerd

Convert quaternion to Euler angles (degrees)

Description

eulerAngles = eulerd(quat,rotationSequence,rotationType) converts the quaternion, quat, to an N-by-3 matrix of Euler angles in degrees.

example

Examples

collapse all

Convert a quaternion frame rotation to Euler angles in degrees using the "ZYX" rotation sequence.

quat = quaternion([0.7071 0.7071 0 0]);
eulerAnglesDegrees = eulerd(quat,"ZYX","frame")
eulerAnglesDegrees = 1×3

         0         0   90.0000

Input Arguments

collapse all

Quaternion to convert to Euler angles, specified as a quaternion object or an array of quaternion objects of any dimensionality.

Rotation sequence of Euler angle representation, specified as one of these values.

  • "YZY"

  • "YXY"

  • "ZYZ"

  • "ZXZ"

  • "XYX"

  • "XZX"

  • "XYZ"

  • "YZX"

  • "ZXY"

  • "XZY"

  • "ZYX"

  • "YXZ"

The rotation sequence defines the order of rotations about the axes. For example, if you specify a rotation sequence of "YZX":

  1. The first rotation is about the y-axis.

  2. The second rotation is about the new z-axis.

  3. The third rotation is about the new x-axis.

Data Types: char | string

Type of rotation, specified as "point" or "frame".

In a point rotation, the frame is static and the point moves. In a frame rotation, the point is static and the frame moves. Point rotation and frame rotation define equivalent angular displacements but in opposite directions.

Frame Rotation and Point Rotation

Data Types: char | string

Output Arguments

collapse all

Euler angle representation in degrees, returned as an N-by-3 numeric matrix, where N is the number of quaternions in the quat argument.

For each row of eulerAngles, the first column corresponds to the first axis in the rotation sequence, the second column corresponds to the second axis in the rotation sequence, and the third column corresponds to the third axis in the rotation sequence.

The data type of the Euler angles representation is the same as the underlying data type of quat.

Data Types: single | double

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b