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 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 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 (Since R2020a)
meanrotQuaternion mean rotation
slerpSpherical linear interpolation
rotateframeQuaternion frame rotation
rotatepointQuaternion point rotation
so2SO(2) rotation (Since R2023b)
so3SO(3) rotation (Since R2023b)
ctranspose, 'Complex conjugate transpose of quaternion array
transpose, .'Transpose 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 (Since R2020a)
se2SE(2) homogeneous transformation (Since R2023b)
se3SE(3) homogeneous transformation (Since R2023b)
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