# What is the convention of the new quaternion( ) class introduced in R2018b?

10 views (last 30 days)
James Tursa on 10 May 2020
Edited: James Tursa on 17 May 2020
MATLAB introduced a new quaternion( ) class in R2018b. How does this compare to other existing quaternion functionality in MATLAB?

James Tursa on 10 May 2020
Edited: James Tursa on 11 May 2020
The new quaternion( ) class introduced in R2018b is a generic class. The functions it uses can be made to be consistent with quaternions from either the Aerospace Toolbox or the Robotics Toolbox as follows:
The Aerospace Toolbox quaternion convention is a Scalar-Vector order, Right chain, right-handed Hamilton convention that typically is used for coordinate system transformations. I.e., used for representing the same vector in two different coordinate frames that are rotated with respect to each other. Sometimes also know as "Passive".
The new quaternion( ) class option 'frame" matches this convention.
E.g., Right chain means:
V_ECI = vector in ECI coordinates
V_BODY = same vector in BODY coordinates
q_E2B = quaternion representing a coordinate system transformation from ECI to BODY
V_BODY = q_E2B^-1 * V_ECI * q_E2B
The Robotics Toolbox quaternion convention is a Scalar-Vector order, Left chain, right-handed Hamilton convention that typically is used for vector rotation. I.e., used to physically rotate a vector within the same coordinate frame. Sometimes also known as "Active".
The new quaternion( ) class option 'point' matches this convention.
E.g., Left chain means:
V_BEFORE = vector in ECI coordinates before the rotation
V_AFTER = V_BEFORE rotated into a different vector in ECI coordinates
qrot = quaternion representing a vector rotation within the same ECI frame
V_AFTER = q_rot * V_BEFORE * qrot^-1
The Aerospace Toolbox quaternion convention is the conjugate of the Robotics Toolbox quaternion convention. When converted to direction cosine matrices, the Aerospace Toolbox conversion (same as rotmat( ) 'frame') will result in a direction cosine matrix that is the transpose of the Robotics Toolbox conversion (same as rotmat( ) 'point'). See these links for more discussion: