Accelerating the pace of engineering and science

quatnormalize

Normalize quaternion

Syntax

n = quatnormalize(q)

Description

n = quatnormalize(q) calculates the normalized quaternion, n, for a given quaternion, q. Input q is an m-by-4 matrix containing m quaternions. n returns an m-by-4 matrix of normalized quaternions. Each element of q must be a real number. Additionally, q has its scalar number as the first column.

The quaternion has the form of

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

The normalized quaternion has the form of

$normal\left(q\right)=\frac{{q}_{0}+i{q}_{1}+j{q}_{2}+k{q}_{3}}{\sqrt{{q}_{0}^{2}+{q}_{1}^{2}+{q}_{2}^{2}+{q}_{3}^{2}}}$

Examples

Normalize q = [1 0 1 0]:

```normal = quatnormalize([1 0 1 0])

normal =

0.7071         0    0.7071         0```

References

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