# Quaternion Multiplication

Calculate product of two quaternions

## Library

Utilities/Math Operations

## Description

The Quaternion Multiplication block calculates the product for two given quaternions.

The quaternions have the form of

`$q={q}_{0}+i{q}_{1}+j{q}_{2}+k{q}_{3}$`

and

`$r={r}_{0}+i{r}_{1}+j{r}_{2}+k{r}_{3}.$`

The quaternion product has the form of

`$t=q×r={t}_{0}+i{t}_{1}+j{t}_{2}+k{t}_{3},$`

where

`$\begin{array}{l}{t}_{0}=\left({r}_{0}{q}_{0}-{r}_{1}{q}_{1}-{r}_{2}{q}_{2}-{r}_{3}{q}_{3}\right)\\ {t}_{1}=\left({r}_{0}{q}_{1}+{r}_{1}{q}_{0}-{r}_{2}{q}_{3}+{r}_{3}{q}_{2}\right)\\ {t}_{2}=\left({r}_{0}{q}_{2}+{r}_{1}{q}_{3}+{r}_{2}{q}_{0}-{r}_{3}{q}_{1}\right)\\ {t}_{3}=\left({r}_{0}{q}_{3}-{r}_{1}{q}_{2}+{r}_{2}{q}_{1}+{r}_{3}{q}_{0}\right)\end{array}$`

## Inputs and Outputs

InputDimension TypeDescription

First

Quaternion or vectorContains quaternions in the form of [q0, p0, ..., q1, p1, ... , q2, p2, ... , q3, p3, ...].

Second

Quaternion or vectorContains quaternions in the form of [s0, r0, ..., s1, r1, ... , s2, r2, ... , s3, r3, ...].

OutputDimension TypeDescription

First

Quaternion product or vectorContains quaternion product or vector of quaternion products.

## References

Stevens, Brian L., Frank L. Lewis, Aircraft Control and Simulation, Wiley–Interscience, 2nd Edition.