Main Content

quatdivide

Divide quaternion by another quaternion

Description

n = quatdivide(q,r) calculates the result of quaternion division n for two given quaternions, q and r. For more information on the input and output quaternion forms, see Algorithms.

Aerospace Toolbox uses quaternions that are defined using the scalar-first convention.

example

Examples

collapse all

Divide one 1-by-4 quaternions by another 1-by-4 quaternion.

q = [1 0 1 0];
r = [1 0.5 0.5 0.75];
d = quatdivide(q, r)
d = 1×4

    0.7273    0.1212    0.2424   -0.6061

Divide a 2-by-4 quaternion by a 1-by-4 quaternion.

q = [1 0 1 0; 2 1 0.1 0.1];
r = [1 0.5 0.5 0.75];
d = quatdivide(q, r)
d = 2×4

    0.7273    0.1212    0.2424   -0.6061
    1.2727    0.0121   -0.7758   -0.4606

Input Arguments

collapse all

Numerator quaternion, specified in a m-by-4 matrix of real numbers containing m quaternions or a 1-by-4 matrix of real numbers containing one quaternion.

Example: [1 0 1 0]

Data Types: double

Denominator quaternion, specified in a m-by-4 matrix of real numbers containing m quaternions or a 1-by-4 matrix of real numbers containing one quaternion.

Example: [1 0.5 0.5 0.75]

Data Types: double

Output Arguments

collapse all

Quaternion quotients, returned in an m-by-4 matrix of real numbers.

Algorithms

The quaternions have the form of

q=q0+iq1+jq2+kq3

and

r=r0+ir1+jr2+kr3.

The resulting quaternion from the division has the form of

t=qr=rq=t0+it1+jt2+kt3.

where

t0=(r0q0+r1q1+r2q2+r3q3)r02+r12+r22+r32t1=(r0q1r1q0r2q3+r3q2)r02+r12+r22+r32t2=(r0q2+r1q3r2q0r3q1)r02+r12+r22+r32t3=(r0q3r1q2+r2q1r3q0)r02+r12+r22+r32.

References

[1] Stevens, Brian L. and Frank L. Lewis. Aircraft Control and Simulation. 2nd ed. Wiley–Interscience, 2003.

Extended Capabilities

Version History

Introduced in R2006b