Main Content

Quaternion Multiplication

Calculate product of two quaternions

  • Quaternion Multiplication block

Libraries:
Aerospace Blockset / Utilities / Math Operations

Description

The Quaternion Multiplication block calculates the product for two given quaternions. Aerospace Blockset™ uses quaternions that are defined using the scalar-first convention. For more information on the quaternion forms, see Algorithms.

Examples

Ports

Input

expand all

First quaternion, specified as a vector or vector of quaternions. A vector of quaternions has this form, where q and p are quaternions:

[ q 0 , p 0 , ..., q 1 , p 1 , ... , q 2 , p 2 , ... , q 3 , p 3 , ...]

Data Types: double

Second quaternion, specified as a vector or vector of quaternions. A vector of quaternions has this form, where s and r are quaternions:

[ s 0 , r 0 , ..., s 1 , r 1 , ... , s 2 , r 2 , ... , s 3 , r 3 , ...]

Data Types: double

Output

expand all

Product of two quaternions, output as a vector or vector of quaternion products.

Data Types: double

Algorithms

This block uses quaternions of the form of

q=q0+iq1+jq2+kq3

and

r=r0+ir1+jr2+kr3.

The quaternion product has the form of

t=q×r=t0+it1+jt2+kt3,

where

t0=(r0q0r1q1r2q2r3q3)t1=(r0q1+r1q0r2q3+r3q2)t2=(r0q2+r1q3+r2q0r3q1)t3=(r0q3r1q2+r2q1+r3q0)

References

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a