Documentation

quatmod

Calculate modulus of quaternion

Syntax

```n = quatmod(q) ```

Description

`n = quatmod(q)` calculates the modulus, `n`, for a given quaternion, `q`. Input `q` is an `m`-by-4 matrix containing `m` quaternions. `n` returns a column vector of `m` moduli. 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 quaternion modulus has the form of

`$|q|=\sqrt{{q}_{0}^{2}+{q}_{1}^{2}+{q}_{2}^{2}+{q}_{3}^{2}}$`

Examples

Determine the modulus of `q = [1 0 0 0]`:

```mod = quatmod([1 0 0 0]) mod = 1```

References

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

Get trial now