Polar decomposition
[t, h, n] = polar(q, L)
polar computes the polar decomposition of a complexified quaternion (biquaternion) or complexified octonion q such that n .* t .* h = q (right polar decomposition) or n .* h .* t = q (left polar decomposition). In the case of biquaternions, this decomposition is isomorphic to the polar decomposition of linear algebra applied to the adjoint matrix representation. (Octonions do not have an adjoint matrix representation, so this equivalence does not apply in the octonion case.)
The optional output parameter n is the modulus of q, which may be complex. If the optional parameter is not supplied, a warning will be issued if q does not have unit (real) modulus. t is invariant to the ordering, but h varies. Applied to a real quaternion/octonion, h will be unity, and t will be identical to q. The t output parameter is a trigonometric factor, and will be real. It may therefore be expressed in the usual polar (Euler) form using the axis and angle functions. The h output parameter is a hyperbolic factor. It may be expressed in Euler form with a root of +1. See the reference cited below for details.
The second input parameter must be 'L' or 'R'. The default is 'R'.
>> b = unit(complex(randq, randq)) .* 7 b = (-0.5011+2.247i) + (-3.957+5.102i) * I + (-1.782-0.2298i) * J + (8.218+2.544i) * K >> [t, h, n] = polar(b) t = -0.05384 - 0.4252 * I - 0.1914 * J + 0.883 * K h = (1.329+2.429e-17i) + (0+0.1379i) * I + (0-0.7349i) * J + (0-0.4566i) * K n = 7.0000 - 0.0000i >> n * t * h - b ans = (0-4.441e-16i) - 8.882e-16 * I + (0+1.388e-16i) * J + (0+4.441e-16i) * K