PlanetPhysics/Direction Cosine Matrix to Euler 321 Angles

Starting with a direction cosine matrix (DCM), we need to determine the three Euler angles. The connection is made by comparing the DCM elements with the combined Euler 321 sequence. It is important to note that the 12 combinations of Euler angles for a given sequence can be found from a given DCM. The DCM matrix is

The Euler 321 sequence is

If we examine the element in column 3 row 1, then by inspection

Solving for yields

Care must now be taken when evaluating the inverse sine. It is a multivalued function, which will have values of and . Analytically, the convention is to choose the principle value such that

If a numerical program is used, a function arcsine() usually does this for us. The next step is to analyze the ratio . Using these values from the Euler sequence we get

Rearranging the minus sign and using the tangent yields

Solving the quadrant ambiguity caused by the inverse tangent is done by examining the signs of the numerator and denominator. Denoting y as the numerator and x as the denominator, then the quadrant is chosen by:

quadrant 1

so if x and y are both positive, then . Similarly for the other quadrant possibilities

quadrant 2

quadrant 3

quadrant 4

Of course, it is much simpler to use a calculator or numerical program that uses the atan2() function which will choose the principle value. In a similar fashion we can find the final Euler angle by looking at the ratio which gives the relation

Canceling terms and rearranging gives us

which uses the same method to resolve quadrant ambiguity as above. To summarize, we will give the formulas for the conversion from a direction cosine matrix to the Euler 313 angles in Matlab syntax. Be careful how you implement this in other numerical programs. In Matlab it goes atan2(y,x) and in Mathematica it is Arctan[x, y].