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.

Orientation, Position, and Coordinate Systems

Quaternions, Euler angles, rotation matrices, and conversions

Represent orientation and rotation using the quaternion data type. Convert between quaternions and Euler angles, rotation matrices, and rotation vectors using the euler, rotmat, and rotvec functions.

To learn more about quaternion mathematics and how they are implemented in Sensor Fusion and Tracking Toolbox™, see Rotations, Orientation, and Quaternions. To learn more about conventions and coordinate systems in Sensor Fusion and Tracking Toolbox, see Orientation, Position, and Coordinate Systems.


expand all

quaternionCreate a quaternion array
onesCreate quaternion array with real parts set to one and imaginary parts set to zero
zerosCreate quaternion array with all parts set to zero
classUnderlyingClass of parts within quaternion
normalizeQuaternion normalization
randrotUniformly distributed random rotations
times, .*Element-wise quaternion multiplication
mtimes, *Quaternion multiplication
prodProduct of a quaternion array
minus, -Quaternion subtraction
uminus, -Quaternion unary minus
conjComplex conjugate of quaternion
ldivide, .\Element-wise quaternion left division
rdivide, ./Element-wise quaternion right division
expExponential of quaternion array
logNatural logarithm of quaternion array
power, .^Element-wise quaternion power
distAngular distance in radians
normQuaternion norm
meanrotQuaternion mean rotation
slerpSpherical linear interpolation
rotateframeQuaternion frame rotation
rotatepointQuaternion point rotation
ctranspose, 'Complex conjugate transpose of quaternion array
transpose, .'Transpose a quaternion array
rotmatConvert quaternion to rotation matrix
rotvecConvert quaternion to rotation vector (radians)
rotvecdConvert quaternion to rotation vector (degrees)
partsExtract quaternion parts
eulerConvert quaternion to Euler angles (radians)
eulerdConvert quaternion to Euler angles (degrees)
compactConvert quaternion array to N-by-4 matrix


Rotations, Orientation, and Quaternions

This example reviews concepts in three-dimensional rotations and how quaternions are used to describe orientation and rotations.

Lowpass Filter Orientation Using Quaternion SLERP

This example shows how to use spherical linear interpolation (SLERP) to create sequences of quaternions and lowpass filter noisy trajectories.