log

Natural logarithm of quaternion array

Syntax

``B = log(A)``

Description

````B = log(A)` computes the natural logarithm of the elements of the quaternion array `A`.```

example

Examples

collapse all

Create a 3-by-1 quaternion array A.

`A = quaternion(randn(3,4))`
```A = 3x1 quaternion array 0.53767 + 0.86217i - 0.43359j + 2.7694k 1.8339 + 0.31877i + 0.34262j - 1.3499k -2.2588 - 1.3077i + 3.5784j + 3.0349k ```

Compute the logarithmic values of A.

`B = log(A)`
```B = 3x1 quaternion array 1.0925 + 0.40848i - 0.20543j + 1.3121k 0.8436 + 0.14767i + 0.15872j - 0.62533k 1.6807 - 0.53829i + 1.473j + 1.2493k ```

Input Arguments

collapse all

Input quaternion, specified as a `quaternion` object or an array of `quaternion` objects of any dimensionality.

Output Arguments

collapse all

Natural logarithm values, returned as a `quaternion` object or an array of `quaternion` objects of the same size of the `A` argument.

Algorithms

Given a quaternion $A=a+\overline{v}=a+b\text{i}+c\text{j}+d\text{k}$, the logarithm is computed by

`$\mathrm{log}\left(A\right)=\mathrm{log}‖A‖+\frac{\overline{v}}{‖\overline{v}‖}\text{arccos}\frac{a}{‖A‖}$`

Version History

Introduced in R2018b