Main Content

conj

Complex conjugate of quaternion

Since R2020a

Description

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

example

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 quaternion object or an array of quaternion objects of any dimensionality.

Output Arguments

collapse all

Quaternion conjugate, returned as a quaternion object or an array of quaternion objects of the same size as quat.

Extended Capabilities

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

Version History

Introduced in R2020a