Rotate vector by quaternion
Aerospace Blockset / Utilities / Math Operations
The Quaternion Rotation block calculates the resulting vector following the
passive rotation of initial vector
vec by quaternion
q and returns a final vector, the rotated vector or vector of
rotated vectors. Aerospace Blockset™ uses quaternions that are defined using the scalar-first convention. This
block normalizes all quaternion inputs. For the equations used for the quaternion,
initial vector, and final vector, see Algorithms.
q — Quaternion
quaternion | vector
Quaternions in the form of [q0, r0, ..., q1, r1, ... , q2, r2, ... , q3, r3, ...], specified as a quaternion or vector of quaternions.
vec — Initial vector
vector | vector of vectors
Initial vector or vector of vectors in the form of [v1, u1, ... , v2, u2, ... , v3, u3, ...].
vec_rot — Final quaternion
rotated quaternion | vector of rotated quaternions
Final vector or vector of rotated vectors.
The normalized quaternion has the form of
The vector has the form of
The Aerospace Blockset defines a passive quaternion rotation of the form:
where Ⓧ is the operator of a quaternion multiplication.
The final vector has the form of
 Stevens, Brian L., Frank L. Lewis. Aircraft Control and Simulation, Second Edition. Hoboken, NJ: Wiley–Interscience.
 Diebel, James. "Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors." Stanford University, Stanford, California, 2006.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Introduced before R2006a