Natural logarithm
(Quaternion overloading of standard MATLAB® function)
Y = log(X)
log(X) computes the natural logarithm of the elements of the quaternion array X.
The logarithm of a quaternion is not difficult to derive, as follows. First note that exp(y) = x (definition of logarithm). Then write x in polar form as r × exp(μθ). Then we have: ln(x) = y = ln(r) + ln(exp(μθ)) = ln(r) + μθ. Note that r and θ may be complex if X is a complex quaternion.
>> log(quaternion(1,1,1)) ans = 0.5493 + 0.9069 * I + 0.9069 * J + 0.9069 * K