Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random |  
Login
create new user
Username:
Password:
forget your password?
Main Menu
Sections

Meta

Talkback

Downloads

Information
[parent] example of quaternion kinematics and angular velocity (Example)

Quaternion kinematics and angular velocity: examples, exercises, and solutions

This companion article belongs to the PhysicsLibrary entry quaternion kinematics and angular velocity. All exercises are stated first. Complete solutions appear only after the exercise section so that the article is self study friendly.

1 Convention declaration

We use the attitude quaternion q = Iq B, Hamilton multiplication, scalar-first display notation, and

˙q = 1q ωB
    2
(1)

for body resolved angular velocity, while

˙q = 1-ωIq
    2
(2)

for inertial resolved angular velocity.

2 Exercises

Exercise 1

Starting from a short time body frame rotation increment, derive

     1-  B
q˙=  2qω  .
(3)

Exercise 2

Starting from an inertial frame rotation increment, derive

    1
˙q = -ωI q.
    2
(4)

Exercise 3

Show that the body resolved and inertial resolved equations are equivalent if

ωI = qωBq ∗.
(5)

Exercise 4

Let

    1 + k
q = -√----
       2
(6)

and let the body resolved angular velocity be

      ⌊    ⌋
        0.2
ωB  = ⌈  0 ⌉ rad∕s.
         0
(7)

Compute q.

Exercise 5

For the same attitude in Exercise 4, find the inertial resolved angular velocity ωI and verify that the inertial rate equation gives the same q.

Exercise 6

Derive the scalar and vector equations

˙q  = − 1-q ⋅ ωB,
 w     2
(8)

     1-(    B         B)
q˙=  2  qwω  +  q × ω   .
(9)

Exercise 7

Derive the 4 × 4 right multiplication rate matrix ΩR(ω) for scalar-first ordering.

Exercise 8

Derive the 4 × 4 left multiplication rate matrix ΩL(ω) for scalar-first ordering.

Exercise 9

Prove that the continuous quaternion kinematic equation preserves the norm of a unit quaternion.

Exercise 10

Starting from q(0) = 1, let

       ⌊   ⌋
         0
ωB  =  ⌈ 0 ⌉  rad ∕s
        0.4
(10)

be constant. Find q(t) exactly.

Exercise 11

For the angular rate in Exercise 10, compute the exact quaternion after Δt = 0.5 s.

Exercise 12

Use one forward Euler step with Δt = 0.5 s for Exercise 10. Compute the norm of the unnormalized result and compare it with the exact quaternion.

Exercise 13

A body mounted gyro reports

      ⌊      ⌋
         0.01
ωB  = ⌈ − 0.02⌉ rad∕s
         0.03
(11)

for Δt = 0.01 s. Form the first order incremental quaternion.

Exercise 14

Explain why replacing an attitude trajectory q(t) by q(t) requires replacing q(t) by q(t) but does not change the physical motion.

Exercise 15

A program stores quaternions scalar last and uses the body rate matrix written for scalar-first ordering without permuting the state. Explain the resulting bug and how to correct it.

Exercise 16

A programmer uses

˙q = 1ωBq
    2
(12)

for a quaternion q = Iq B driven by body resolved gyro measurements. What is wrong, and what symptom would you expect for rotations not aligned with a principal coordinate axis?

3 Solutions

Solution 1

Over dt, the body frame incremental rotation is

           1  B         2
δqB =  1 + -ω  dt + O (dt).
           2
(13)

Since it is resolved about the current body axes, it composes on the right:

q(t + dt) = q (t)δqB.
(14)

Thus

q(t-+-dt) −-q(t)  1-     B
       dt       = 2 q(t)ω   + O (dt),
(15)

and taking dt 0 gives

|----------|
|    1-  B |
q˙=  2qω  .|
------------
(16)

Solution 2

For an inertial resolved increment,

δqI = 1 + 1ωI dt + O (dt2),
          2
(17)

and the increment composes on the left:

q(t + dt) = δqIq(t).
(18)

Therefore

------------
|    1     |
|˙q = -ωI q.|
-----2------
(19)

Solution 3

Using

 I      B ∗
ω  = qω  q
(20)

and qq = 1,

  I      B  ∗      B
ω q =  qω  qq =  qω  .
(21)

Multiplying by 12 proves that the two kinematic equations are identical.

Solution 4

Write

      1     1         B
q =  √--+  √--k,     ω  =  0.2i.
      2      2
(22)

Then

       (  1     1   )
qωB  =   √---+ √--k   (0.2i)
           2     2
       0.2-   0.2-
     = √ -i + √ -j,
         2      2
(23)

because ki = j. Hence

|--------------|
|    0.1       |
|˙q = √--(i + j).
-------2--------
(24)

Solution 5

The attitude is a +90 rotation about z, so a body frame +x vector is mapped into inertial +y. Therefore

      ⌊   ⌋
        0
ωI =  ⌈0.2⌉  rad∕s,    ωI  = 0.2j.
        0
(25)

Then

             (           )
  I           -1--   -1--
ω  q = (0.2j)  √ 2 +  √ 2k
       0.2    0.2
    =  √--j + √--i,
         2      2
(26)

which gives exactly the same q as Exercise 4.

Solution 6

Using the scalar vector Hamilton product,

                 (                         )
(qw,q )(0,ωB ) =  − q ⋅ ωB, qw ωB + q × ωB  .
(27)

Multiplying by 12 gives the required scalar and vector equations.

Solution 7

Expanding B in scalar-first ordering gives

|---------⌊---------------------⌋--|
|           0   − ωx  − ωy  − ωz   |
|         | ω    0     ω    − ω |  |
|ΩR (ω ) = |⌈  x          z      y|⌉ .|
|           ωy  − ωz   0     ωx    |
|           ωz   ωy   − ωx   0     |
------------------------------------
(28)

Thus q4 = (12)ΩRq4.

Solution 8

Expanding ωIq gives

|---------⌊---------------------⌋--|
|           0   − ωx  − ωy  − ωz   |
|         |ω     0    − ω    ω  |  |
|ΩL(ω ) = |⌈  x           z    y |⌉ .|
|          ωy    ωz    0    − ωx   |
------------ωz--−-ωy---ωx----0------
(29)

Thus q4 = (12)ΩLq4.

Solution 9

Both ΩR and ΩL are skew symmetric. Therefore

d
--(qT4q4 ) = 2qT4q˙4 =  qT4Ωq4  = 0.
dt
(30)

Hence the exact continuous equation preserves q.

Solution 10

The angular speed magnitude is 0.4 rads and the axis is k. Therefore

|----------------------------|
q (t) = cos(0.2t) + k sin (0.2t).
------------------------------
(31)

The physical rotation angle is 0.4t radians.

Solution 11

At t = 0.5 s,

ωt    0.4(0.5)
---=  --------= 0.1.
2        2
(32)

Thus

q(0.5) = cos(0.1) + ksin(0.1)
(33)

or numerically

|--------------------------------|
-q(0.5) ≈-0.995004--+-0.0998334k.-|
(34)

Solution 12

At q0 = 1,

      1
q˙0 =  -(0.4k) = 0.2k.
      2
(35)

A forward Euler step gives

 E
q1 = 1 + (0.5)(0.2k ) = 1 + 0.1k.
(36)

Its norm is

        √ --------  √ ----
∥qE1 ∥ =   1 + 0.12 =   1.01 ≈ 1.00499.
(37)

The exact quaternion from Exercise 11 has norm exactly one.

Solution 13

The first order increment is

          1-B
δq ≈ 1 +  2ω  Δt.
(38)

Therefore

|----------------------------------------|
|δq ≈ 1 + 0.00005i − 0.00010j + 0.00015k. |
------------------------------------------
(39)

Solution 14

If q(t) satisfies the kinematic equation, multiplying the entire trajectory by 1 gives the same physical orientation because q and q represent the same rotation. Differentiating q(t) gives q(t). The kinematic equation is linear in q, so the sign reversed pair remains a valid solution describing the same physical motion.

Solution 15

The matrix sign pattern assumes the state order [qw,qx,qy,qz]T . A scalar-last array uses a different ordering, so direct multiplication associates the wrong coefficients with the wrong state components. The state and matrix must be permuted consistently, or the quaternion must be converted to scalar-first ordering before applying the formula.

Solution 16

For q = Iq B and body resolved gyro measurements, the correct equation is

     1-  B
q˙=  2qω  .
(40)

Using ωBq treats the numerical components as though they were resolved in the inertial frame. For single axis rotations aligned with an axis that commutes with the current quaternion, the error can be hidden. For general three-dimensional motion, the attitude will propagate with incorrect coupling and sign behavior because quaternion multiplication is not commutative.

License

This article is an original synthesis prepared for PhysicsLibrary and intended for release under CC BY-SA 4.0.


"example of quaternion kinematics and angular velocity" is owned by bloftin.
(view preamble)
View style:
See Also: quaternion series overview and article guide, Notation Quaternions for Physics and Engineering: Orientation, quaternion definition and basic algebra, example of quaternion definition and basic algebra, quaternion product, example of quaternion product, quaternion conjugate, example of quaternion conjugate, quaternion norm, example of quaternion norm, quaternion inverse, example of quaternion inverse

Keywords:  quaternion, angular velocity, quaternion kinematics, attitude propagation, gyroscope, exercises, worked solutions

This object's parent.

Cross-references: quaternion multiplication, commutes, formula, magnitude, speed, program, motion, norm, kinematic, matrix, vector, scalar, velocity, quaternion, section, quaternion kinematics and angular velocity
There is 1 reference to this object.

This is version 2 of example of quaternion kinematics and angular velocity, born on 2026-08-24, modified 2026-08-27.
Object id is 1106, canonical name is ExampleOfQuaternionKinematicsAndAngularVelocity.
Accessed 130 times total.

Classification:
Physics Classification45.40.-f (Dynamics and kinematics of rigid bodies)
 02.40.Yy (Geometric mechanics )
 02.10.Hh (Rings and algebras)
Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:

No messages.

Interact
rate | post | correct | update request | add example | add (any)