Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the 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.

## 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 `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

## Topics

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.

Get trial now