Main Content

quatdivide

Divide quaternion by another quaternion

Description

example

n= quatdivide(q,r)calculates the result of quaternion divisionnfor two given quaternions,qandr. For more information on the input and output quaternion forms, seeAlgorithms.

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

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×40.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×40.7273 0.1212 0.2424 -0.6061 1.2727 0.0121 -0.7758 -0.4606

Input Arguments

collapse all

Numerator quaternion, specified in am-by-4 matrix of real numbers containingmquaternions or a 1-by-4 matrix of reall numbers containing one quaternion.

Example:[1 0 1 0]

Data Types:double

Denominator quaternion, specified in am-by-4 matrix of real numbers containingmquaternions 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 anm-by-4 matrix of real numbers.

Algorithms

The quaternions have the form of

q = q 0 + i q 1 + j q 2 + k q 3

and

r = r 0 + i r 1 + j r 2 + k r 3 .

The resulting quaternion from the division has the form of

t = q r = t 0 + i t 1 + j t 2 + k t 3 .

where

t 0 = ( r 0 q 0 + r 1 q 1 + r 2 q 2 + r 3 q 3 ) r 0 2 + r 1 2 + r 2 2 + r 3 2 t 1 = ( r 0 q 1 r 1 q 0 r 2 q 3 + r 3 q 2 ) r 0 2 + r 1 2 + r 2 2 + r 3 2 t 2 = ( r 0 q 2 + r 1 q 3 r 2 q 0 r 3 q 1 ) r 0 2 + r 1 2 + r 2 2 + r 3 2 t 3 = ( r 0 q 3 r 1 q 2 + r 2 q 1 r 3 q 0 ) r 0 2 + r 1 2 + r 2 2 + r 3 2 .

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