euler
Description
converts the quaternion, eulerAngles
= euler(quat
,rotationSequence
,rotationType
)quat
, to an N-by-3
matrix of Euler angles.
Examples
Convert Quaternion to Euler Angles in Radians
Convert a quaternion frame rotation to Euler angles in radians using the "ZYX" rotation sequence.
quat = quaternion([0.7071 0.7071 0 0]); eulerAnglesRandians = euler(quat,"ZYX","frame")
eulerAnglesRandians = 1×3
0 0 1.5708
Input Arguments
quat
— Quaternion to convert to Euler angles
quaternion
object | array of quaternion
objects
Quaternion to convert to Euler angles, specified as a quaternion
object or an array of quaternion
objects of any dimensionality.
rotationSequence
— Rotation sequence
"ZYX"
| "ZYZ"
| "ZXY"
| "ZXZ"
| "YXZ"
| "YXY"
| "YZX"
| "YZY"
| "XYZ"
| "XYX"
| "XZY"
| "XZX"
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"
:
The first rotation is about the y-axis.
The second rotation is about the new z-axis.
The third rotation is about the new x-axis.
Data Types: char
| string
rotationType
— Type of rotation
"point"
| "frame"
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.
Data Types: char
| string
Output Arguments
eulerAngles
— Euler angle representation (radians)
N-by-3 numeric matrix
Euler angle representation in radians, 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 element
corresponds to the first axis in the rotation sequence, the second element
corresponds to the second axis in the rotation sequence, and the third
element 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 R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)