Construct a complex quaternion from real quaternions.
(Quaternion and octonion overloadings of standard MATLAB® function)
q = complex(a,b)
complex takes two quaternion arguments and constructs a complexified quaternion with the first quaternion as real part, and the second as the imaginary part. The result is equivalent to a + i * b (where i is the standard MATLAB® complex operator).
Once constructed, a complexified quaternion can be separated into four complex components, or two quaternions (real and imaginary). It is of course also possible to construct complexified quaternions by other means, from four complex components.
The two arguments must be of the same size, unless one is scalar. If this is the case the scalar argument is promoted in size to match the non-scalar argument. (This behaviour matches the way the corresponding MATLAB® function operates.)
>> q = complex(quaternion(1,2,3,4), quaternion(5,6,7,8)) q = (1+5i) + (2+6i) * I + (3+7i) * J + (4+8i) * K