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

 quaternion Create a quaternion array ones Create quaternion array with real parts set to one and imaginary parts set to zero zeros Create quaternion array with all parts set to zero classUnderlying Class of parts within quaternion normalize Quaternion normalization randrot Uniformly distributed random rotations
 times, .* Element-wise quaternion multiplication mtimes, * Quaternion multiplication prod Product of a quaternion array minus, - Quaternion subtraction uminus, - Quaternion unary minus conj Complex conjugate of quaternion ldivide, .\ Element-wise quaternion left division rdivide, ./ Element-wise quaternion right division exp Exponential of quaternion array log Natural logarithm of quaternion array power, .^ Element-wise quaternion power
 dist Angular distance in radians norm Quaternion norm angvel Angular velocity from quaternion array meanrot Quaternion mean rotation slerp Spherical linear interpolation
 rotateframe Quaternion frame rotation rotatepoint Quaternion point rotation
 ctranspose, ' Complex conjugate transpose of quaternion array transpose, .' Transpose a quaternion array
 rotmat Convert quaternion to rotation matrix rotvec Convert quaternion to rotation vector (radians) rotvecd Convert quaternion to rotation vector (degrees) parts Extract quaternion parts euler Convert quaternion to Euler angles (radians) eulerd Convert quaternion to Euler angles (degrees) compact Convert quaternion array to N-by-4 matrix
 transformMotion Compute motion quantities between two relatively fixed frames enu2lla Transform local east-north-up coordinates to geodetic coordinates ned2lla Transform local north-east-down coordinates to geodetic coordinates lla2ned Transform geodetic coordinates to local north-east-down coordinates lla2enu Transform 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.