Norm of a quaternion
Y = normq(X)
(Not to be confused with the function norm which computes a matrix norm.)
normq(X) returns an array Y such that each element of Y is the norm of the corresponding element of X. The norm is the sum of the squares of the four components (three components in the case where X is pure).
If X is a complex quaternion, normq(X) returns the complex semi-norm, computed in the same way. The semi-norm of a complexified quaternion can vanish (see references).
normq(quaternion(1,1,1,1)) ans = 4normq is vectorized, and hence can operate on arrays:
abs([qi, qj, qk, qi + qj]) ans = 1 1 1 2It can also operate on complex quaternions yielding a complex result in general (the semi-norm):
>> normq(1 + i + qi + qj + qk) ans = 3.0000 + 2.0000iThe following shows that a complex quaternion can have a vanishing norm and modulus:
>> normq(i + qi) ans = 0