Main Content

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 Convention.

Functions

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
angvelAngular velocity from quaternion array
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
transformMotionCompute motion quantities between two relatively fixed frames
enu2llaTransform local east-north-up coordinates to geodetic coordinates
ned2llaTransform local north-east-down coordinates to geodetic coordinates
lla2nedTransform geodetic coordinates to local north-east-down coordinates
lla2enuTransform geodetic coordinates to local east-north-up coordinates

Topics

Orientation, Position, and Coordinate Convention

Learn about toolbox conventions for spatial representation and coordinate systems.

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.