quatinv

Inversion of unit quaternions.

Syntax
qinv = quatinv(q)
Description

Find the (quaternion) multiplicative inverse of unit quaternion(s) q. The input unit quaternions, which must be normalized to one, are given as a 4xN array. The inverse quaternions(s) qinv are returned as a 4xN array.

Just as matrix inversion of rotation matrices produces inverse rotations, quaternion inversion of unit quaternions also produces inverse rotations.

Note that quatinv is vectorized and will accept arrays of unit quaternions of size 4xNxMx... with an arbitrary number of dimensions, in which case the inverse quaternions will be returned as an array of size 4xNxMx... .

Examples

Taking an arbitrary quaternions and normalizing the result, we perform quaternion inversion

q = [0.1; 0.438; -0.879; 0.699];
q = q./sqrt(sum(q.^2));
qinv = quatinv(q)
qinv =
    0.0827
   -0.3621
    0.7267
   -0.5779

To show that qinv is the inverse of q we perform quaternion multiplication between the two, which yields the (multiplicative) identity quaternion (equivalent to the identity matrix).

quatinv(qinv,q)
ans =
    1.0000
         0
         0
   -0.0000
See also

rotmat2quat, quat2euler, rotmat2quat, euler2quat, quatvecmult, quatmult