conj

Complex conjugate of quaternion

Syntax

quatConjugate = conj(quat)

Description

example

quatConjugate = conj(quat) returns the complex conjugate of the quaternion, quat.

If q=a+bi+cj+dk, the complex conjugate of q is q*=abicjdk. Considered as a rotation operator, the conjugate performs the opposite rotation. For example,

q = quaternion(deg2rad([16 45 30]),'rotvec');
a = q*conj(q);
rotatepoint(a,[0,1,0])
ans =

     0     1     0

Examples

collapse all

Create a quaternion scalar and get the complex conjugate.

q = normalize(quaternion([0.9 0.3 0.3 0.25]))
q = quaternion
     0.87727 + 0.29242i + 0.29242j + 0.24369k

qConj = conj(q)
qConj = quaternion
     0.87727 - 0.29242i - 0.29242j - 0.24369k

Verify that a quaternion multiplied by its conjugate returns a quaternion one.

q*qConj
ans = quaternion
     1 + 0i + 0j + 0k

Input Arguments

collapse all

Quaternion to conjugate, specified as a scalar, vector, matrix, or array of quaternions.

Data Types: quaternion

Output Arguments

collapse all

Quaternion conjugate, returned as a quaternion or array of quaternions the same size as quat.

Data Types: quaternion

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2018a