Quaternion Rotation

Rotate vector by quaternion

  • Library:
  • Aerospace Blockset / Utilities / Math Operations

Description

The Quaternion Rotation block rotates a vector by a quaternion. For the equations used for the quaternion, vector, and rotated vector, see Algorithms.

Ports

Input

expand all

Quaternions in the form of [q0, r0, ..., q1, r1, ... , q2, r2, ... , q3, r3, ...], specified as a quaternion or vector of quaternions.

Data Types: double

Vector or vector of vectors in the form of [v1, u1, ... , v2, u2, ... , v3, u3, ...].

Data Types: double

Output

expand all

Rotated vector or vector of rotated vectors.

Data Types: double

Algorithms

The quaternion has the form of

q=q0+iq1+jq2+kq3.

The vector has the form of

v=iv1+jv2+kv3.

The rotated vector has the form of

v=[v1v2v3]=[(12q222q32)2(q1q2+q0q3)2(q1q3q0q2)2(q1q2q0q3)(12q122q32)2(q2q3+q0q1)2(q1q3+q0q2)2(q2q3q0q1)(12q122q22)][v1v2v3]

References

[1] Stevens, Brian L., Frank L. Lewis. Aircraft Control and Simulation, Second Edition. Hoboken, NJ: Wiley–Interscience.

[2] Diebel, James. "Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors." Stanford University, Stanford, California, 2006.

Introduced before R2006a