Euler Angles

DOWNLOAD Mathematica Notebook EulerAngles

According to Euler's rotation theorem, any rotation may be described using three angles. If the rotations are written in terms of rotation matrices D, C, and B, then a general rotation A can be written as

 A=BCD.
(1)

The three angles giving the three rotation matrices are called Euler angles. There are several conventions for Euler angles, depending on the axes about which the rotations are carried out. Write the matrix A as

 A=[a_(11) a_(12) a_(13); a_(21) a_(22) a_(23); a_(31) a_(32) a_(33)].
(2)

The so-called "x-convention," illustrated above, is the most common definition. In this convention, the rotation given by Euler angles (phi,theta,psi), where

1. the first rotation is by an angle phi about the z-axis using D,

2. the second rotation is by an angle theta in [0,pi] about the former x-axis (now x^') using C, and

3. the third rotation is by an angle psi about the former z-axis (now z^') using B.

Note, however, that several notational conventions for the angles are in common use. Goldstein (1980, pp. 145-148) and Landau and Lifschitz (1976) use (phi,theta,psi), Tuma (1974) says (psi,theta,phi) is used in aeronautical engineering in the analysis of space vehicles (but claims that (phi,theta,psi) is used in the analysis of gyroscopic motion), while Bate et al. (1971) use (Omega,i,omega). Goldstein remarks that continental authors usually use (psi,theta,phi), and warns that left-handed coordinate systems are also in occasional use (Osgood 1937, Margenau and Murphy 1956-64). Varshalovich (1988, pp. 21-23) uses the notation (alpha,beta,gamma) or (alpha^',beta^',gamma^') to denote the Euler angles, and gives three different angle conventions, none of which corresponds to the x-convention.

Here, the notation (phi,theta,psi) is used, a convention that could be used in versions of the Wolfram Language prior to 6 as RotationMatrix3D[phi, theta, psi] (which could be run after loading Geometry`Rotations`) and RotateShape[g, phi, theta, psi] (which could be run after loading Geometry`Shapes`). In the x-convention, the component rotations are then given by

D=[cosphi sinphi 0; -sinphi cosphi 0; 0 0 1]
(3)
C=[1 0 0; 0 costheta sintheta; 0 -sintheta costheta]
(4)
B=[cospsi sinpsi 0; -sinpsi cospsi 0; 0 0 1],
(5)

so

a_(11)=cospsicosphi-costhetasinphisinpsi
(6)
a_(12)=cospsisinphi+costhetacosphisinpsi
(7)
a_(13)=sinpsisintheta
(8)
a_(21)=-sinpsicosphi-costhetasinphicospsi
(9)
a_(22)=-sinpsisinphi+costhetacosphicospsi
(10)
a_(23)=cospsisintheta
(11)
a_(31)=sinthetasinphi
(12)
a_(32)=-sinthetacosphi
(13)
a_(33)=costheta
(14)

To obtain the components of the angular velocity omega in the body axes, note that for a matrix

 A=[A_1 A_2 A_3],
(15)

it is true that

[a_(11) a_(12) a_(13); a_(21) a_(22) a_(23); a_(31) a_(32) a_(33)][omega_x; omega_y; omega_z]=[a_(11)omega_x+a_(12)omega_y+a_(13)omega_z; a_(21)omega_x+a_(22)omega_y+a_(23)omega_z; a_(31)omega_x+a_(32)omega_y+a_(33)omega_z]
(16)
=A_1omega_x+A_2omega_y+A_3omega_z.
(17)

Now, omega_z corresponds to rotation about the phi axis, so look at the omega_z component of Aomega,

omega_phi=A_3omega_z
(18)
=[sinpsisintheta; cospsisintheta; costheta]phi^..
(19)

The line of nodes corresponds to a rotation by theta about the xi-axis, so look at the omega_xi component of Bomega,

omega_theta=B_1omega_xi
(20)
=B_1theta^.
(21)
=[cospsi; -sinpsi; 0]theta^..
(22)

Similarly, to find rotation by psi about the remaining axis, look at the omega_psi component of Bomega,

omega_psi=B_3omega_psi
(23)
=B_3psi^.
(24)
=[0; 0; 1]psi^..
(25)

Combining the pieces gives

 omega=[sinpsisinthetaphi^.+cospsitheta^.; cospsisinthetaphi^.-sinpsitheta^.; costhetaphi^.+psi^..]
(26)

For more details, see Goldstein (1980, p. 176) and Landau and Lifschitz (1976, p. 111).

The x-convention Euler angles are given in terms of the Cayley-Klein parameters by

phi=-2iln[+/-(alpha^(1/2)gamma^(1/4))/(beta^(1/4)(1+betagamma)^(1/4))],-2iln[+/-(ialpha^(1/2)gamma^(1/4))/(beta^(1/4)(1+betagamma)^(1/4))]
(27)
psi=-2iln[+/-(alpha^(1/2)beta^(1/4))/(gamma^(1/4)(1+betagamma)^(1/4))],-2iln[+/-(ialpha^(1/2)beta^(1/4))/(gamma^(1/4)(1+betagamma)^(1/4))]
(28)
theta=+/-2cos^(-1)(+/-sqrt(1+betagamma)).
(29)

In the "y-convention,"

phi_x=phi_y+1/2pi
(30)
psi_x=psi_y-1/2pi.
(31)

Therefore,

sinphi_x=cosphi_y
(32)
cosphi_x=-sinphi_y
(33)
sinpsi_x=-cospsi_y
(34)
cospsi_x=sinpsi_y,
(35)

giving rotation matrices

D=[-sinphi cosphi 0; -cosphi -sinphi 0; 0 0 1]
(36)
C=[1 0 0; 0 costheta sintheta; 0 -sintheta costheta]
(37)
B=[sinpsi -cospsi 0; cospsi sinpsi 0; 0 0 1]
(38)

and A is given by

a_(11)=-sinpsisinphi+costhetacosphicospsi
(39)
a_(12)=sinpsicosphi+costhetasinphicospsi
(40)
a_(13)=-cospsisintheta
(41)
a_(21)=-cospsisinphi-costhetacosphisinpsi
(42)
a_(22)=cospsicosphi-costhetasinphisinpsi
(43)
a_(23)=sinpsisintheta
(44)
a_(31)=sinthetacosphi
(45)
a_(32)=sinthetasinphi
(46)
a_(33)=costheta.
(47)

In the "xyz (pitch-roll-yaw) convention," theta is pitch, psi is roll, and phi is yaw.

D=[cosphi sinphi 0; -sinphi cosphi 0; 0 0 1]
(48)
C=[costheta 0 -sintheta; 0 1 0; sintheta 0 costheta]
(49)
B=[1 0 0; 0 cospsi sinpsi; 0 -sinpsi cospsi]
(50)

and A is given by

a_(11)=costhetacosphi
(51)
a_(12)=costhetasinphi
(52)
a_(13)=-sintheta
(53)
a_(21)=sinpsisinthetacosphi-cospsisinphi
(54)
a_(22)=sinpsisinthetasinphi+cospsicosphi
(55)
a_(23)=costhetasinpsi
(56)
a_(31)=cospsisinthetacosphi+sinpsisinphi
(57)
a_(32)=cospsisinthetasinphi-sinpsicosphi
(58)
a_(33)=costhetacospsi.
(59)

A set of parameters sometimes used instead of angles are the Euler parameters e_0, e_1, e_2 and e_3, defined by

e_0=cos(phi/2)
(60)
e=[e_1; e_2; e_3]=n^^sin(phi/2).
(61)

Using Euler parameters (which are quaternions), an arbitrary rotation matrix can be described by

a_(11)=e_0^2+e_1^2-e_2^2-e_3^2
(62)
a_(12)=2(e_1e_2+e_0e_3)
(63)
a_(13)=2(e_1e_3-e_0e_2)
(64)
a_(21)=2(e_1e_2-e_0e_3)
(65)
a_(22)=e_0^2-e_1^2+e_2^2-e_3^2
(66)
a_(23)=2(e_2e_3+e_0e_1)
(67)
a_(31)=2(e_1e_3+e_0e_2)
(68)
a_(32)=2(e_2e_3-e_0e_1)
(69)
a_(33)=e_0^2-e_1^2-e_2^2+e_3^2
(70)

(Goldstein 1980, p. 153).

If the coordinates of two sets of n points x_i and x_i^' are known, one rotated with respect to the other, then the Euler rotation matrix can be obtained in a straightforward manner using least squares fitting. Write the points as arrays of vectors, so

 [x_1^' ... x_n^']=A[x_1 ... x_n].
(71)

Writing the arrays of vectors as matrices gives

 X^'=AX
(72)
 X^'X^(T)=AXX^(T),
(73)

and solving for A gives

 A=X^'X^(T)(XX^(T))^(-1).
(74)

However, we want the angles theta, phi, and psi, not their combinations contained in the matrix A. Therefore, write the 3×3 matrix

 A=[f_1(theta,phi,psi) f_2(theta,phi,psi) f_3(theta,phi,psi); f_4(theta,phi,psi) f_5(theta,phi,psi) f_6(theta,phi,psi); f_7(theta,phi,psi) f_7(theta,phi,psi) f_9(theta,phi,psi)]
(75)

as a 1×9 vector

 f=[f_1(theta,phi,psi); |; f_9(theta,phi,psi)].
(76)

Now set up the matrices

 [(partialf_1)/(partialtheta)|_(theta_i,phi_i,psi_i) (partialf_1)/(partialphi)|_(theta_i,phi_i,psi_i) (partialf_1)/(partialpsi)|_(theta_i,phi_i,psi_i); | | |; (partialf_9)/(partialtheta)|_(theta_i,phi_i,psi_i) (partialf_9)/(partialphi)|_(theta_i,phi_i,psi_i) (partialf_9)/(partialpsi)|_(theta_i,phi_i,psi_i)][dtheta; dphi; dpsi]=df.
(77)

Using nonlinear least squares fitting then gives solutions which converge to (theta,phi,psi).

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.