quaternion
Create quaternion array
Description
A quaternion is a four-part hyper-complex number used in three-dimensional rotations and orientations.
A quaternion number is represented in the form , where a, b, c, and d parts are real numbers, and i, j, and k are the basis elements, satisfying the equation: i2 = j2 = k2 = ijk = −1.
The set of quaternions, denoted by H, is defined within a four-dimensional vector space over the real numbers, R4. Every element of H has a unique representation based on a linear combination of the basis elements, i, j, and k.
All rotations in 3-D can be described by an axis of rotation and angle about that axis. An advantage of quaternions over rotation matrices is that the axis and angle of rotation is easy to interpret. For example, consider a point in R3. To rotate the point, you define an axis of rotation and an angle of rotation.
The quaternion representation of the rotation may be expressed as , where θ is the angle of rotation and [ub, uc, and ud] is the axis of rotation.
Creation
Syntax
Description
creates an empty
quaternion.quat
= quaternion()
creates a quaternion array where the four quaternion parts are taken from the
arrays quat
= quaternion(A,B,C,D
)A
, B
, C
, and
D
. All the inputs must have the same size and be of the
same data type.
creates an N-by-1 quaternion array from an
N-by-4 matrix, where each column becomes one part of the
quaternion.quat
= quaternion(matrix
)
creates an N-by-1 quaternion array from an
N-by-3 matrix of rotation vectors,
quat
= quaternion(RV
,"rotvec")RV
. Each row of RV
represents a
rotation vector in radians.
creates an N-by-1 quaternion array from an
N-by-3 matrix of rotation vectors,
quat
= quaternion(RV
,"rotvecd")RV
. Each row of RV
represents a
rotation vector in degrees.
Input Arguments
Object Functions
angvel | Angular velocity from quaternion array |
classUnderlying | Class of parts within quaternion |
compact | Convert quaternion array to N-by-4 matrix |
conj | Complex conjugate of quaternion |
eulerd | Convert quaternion to Euler angles (degrees) |
dist | Angular distance in radians |
euler | Convert quaternion to Euler angles (radians) |
exp | Exponential of quaternion array |
ldivide | Element-wise quaternion left division |
log | Natural logarithm of quaternion array |
meanrot | Quaternion mean rotation |
minus, - | Quaternion subtraction |
mtimes, * | Quaternion multiplication |
norm | Quaternion norm |
normalize | Quaternion normalization |
ones | Create quaternion array with real parts set to one and imaginary parts set to zero |
parts | Extract quaternion parts |
power | Element-wise quaternion power |
prod | Product of quaternion array |
randrot | Uniformly distributed random rotations |
rdivide | Element-wise quaternion right division |
rotateframe | Quaternion frame rotation |
rotatepoint | Quaternion point rotation |
rotmat | Convert quaternion to rotation matrix |
rotvec | Convert quaternion to rotation vector (radians) |
rotvecd | Convert quaternion to rotation vector (degrees) |
slerp | Spherical linear interpolation |
times | Element-wise quaternion multiplication |
transpose,
.' | Transpose quaternion array |
uminus, - | Quaternion unary minus |
zeros | Create quaternion array with all parts set to zero |
ctranspose,
' | Complex conjugate transpose of quaternion array |