Quaternion Function Reference

S/SCALAR

Scalar component of a quaternion

Syntax

r = s(q), r = scalar(q)

Description

These two functions extract the scalar component of a quaternion or octonion. The result is a real (or a complex value if the quaternion/octonion has complex components).

The two functions differ in their behaviour when given a pure array (that is a quaternion/octonion with no scalar part). The function s returns an empty array in this case, whereas scalar returns a zero array of the same size as the pure array, with the same class as the components of the array. For example if the pure quaternion/octonion has components of class uint8 the array of zeros returned will also be of class uint8.

Examples

>> q = eyeq(2)
 
q = 2x2 quaternion array
 
>> s(q)

ans =

     1     0
     0     1

>> scalar(qi)

ans =  0

See Also

QTFM functions: v, vector, x, y, z, part

© 2008-2013 Stephen J. Sangwine and Nicolas Le Bihan

License terms.