Talk:PlanetPhysics/Direction Cosine Matrix to Euler 312 Angles

Original TeX Content from PlanetPhysics Archive
%%% This file is part of PlanetPhysics snapshot of 2011-09-01 %%% Primary Title: direction cosine matrix to Euler 312 angles %%% Primary Category Code: 45.40.-f %%% Filename: DirectionCosineMatrixToEuler312Angles.tex %%% Version: 3 %%% Owner: bloftin %%% Author(s): bloftin %%% PlanetPhysics is released under the GNU Free Documentation License. %%% You should have received a file called fdl.txt along with this file. %%% If not, please write to gnu@gnu.org. \documentclass[12pt]{article} \pagestyle{empty} \setlength{\paperwidth}{8.5in} \setlength{\paperheight}{11in}

\setlength{\topmargin}{0.00in} \setlength{\headsep}{0.00in} \setlength{\headheight}{0.00in} \setlength{\evensidemargin}{0.00in} \setlength{\oddsidemargin}{0.00in} \setlength{\textwidth}{6.5in} \setlength{\textheight}{9.00in} \setlength{\voffset}{0.00in} \setlength{\hoffset}{0.00in} \setlength{\marginparwidth}{0.00in} \setlength{\marginparsep}{0.00in} \setlength{\parindent}{0.00in} \setlength{\parskip}{0.15in}

\usepackage{html}

% this is the default PlanetMath preamble. as your knowledge % of TeX increases, you will probably want to edit this, but % it should be fine as is for beginners.

% almost certainly you want these \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts}

% used for TeXing text within eps files %\usepackage{psfrag} % need this for including graphics (\includegraphics) %\usepackage{graphicx} % for neatly defining theorems and propositions %\usepackage{amsthm} % making logically defined graphics %\usepackage{xypic}

% there are many more packages, add them here as you need them

% define commands here

\begin{document}

Starting with a \htmladdnormallink{direction cosine matrix}{http://planetphysics.us/encyclopedia/DirectionCosineMatrix.html} (DCM), we need to determine the three Euler angles. The connection is made by comparing the DCM elements with the combined \htmladdnormallink{Euler 312 Sequence}{http://planetphysics.us/encyclopedia/Euler312Sequence.html}. 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 \htmladdnormallink{matrix}{http://planetphysics.us/encyclopedia/Matrix.html} is

\begin{equation} DCM = \left[ \begin{array}{ccc} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{array} \right] \end{equation}

The Euler 312 sequence is

\begin{equation} R_2(\psi)R_1(\theta)R_3(\phi) = \left[ \begin{array}{ccc} c_{\psi} c_{\phi} - s_{\psi} s_{\theta} s_{\phi} & c_{\psi} s_{\phi} + s_{\psi} s_{\theta} c_{\phi} & -s_{\psi} c_{\theta} \\ -s_{\phi} c_{\theta} & c_{\theta} c_{\phi} & s_{\theta} \\ s_{\psi} c_{\phi} + c_{\psi} s_{\theta} s_{\phi} & s_{\psi} s_{\phi} - c_{\psi} s_{\theta} c_{\phi} & c_{\psi} c_{\theta} \end{array} \right] \end{equation}

If we examine the element in coloum 3 row 2, then by inspection

$A_{23} = sin(\theta)$

Solving for $\theta$ yields

\begin{equation} \theta = sin^{-1}(A_{23}) \end{equation}

Care must now be taken when evaluating the inverse sine. It is a multivalued \htmladdnormallink{function}{http://planetphysics.us/encyclopedia/Bijective.html}, which will have values of $\theta$ and $\pi - \theta$. Analytically, the convention is to choose the principle value such that

$-\pi/2 \le \theta \le \pi/2$

If a numerical \htmladdnormallink{program}{http://planetphysics.us/encyclopedia/SupercomputerArchitercture.html} is used, a function asin usually does this for us. The next step is to analyze the ratio $\dfrac{A_{21}}{A_{22}}$. Using these values from the Euler sequence we get

$\dfrac{A_{21}}{A_{22}}= \dfrac{-sin(\phi) cos(\theta) }{cos(\phi) cos(\theta) }$

Rearranging the minus sign and using the tangent yields

$tan(\phi) = \dfrac{-A_{21}}{A_{22}}$

Solving the quadrant ambiquity 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 $ \left[ \begin{array}{cc} y & x \\ + & + \\ \end{array} \right] $

so if x and y are both positive, then $0 \le \phi \le \pi /2$. Similarily for the other quadrant possibilites

quadrant 2 $ \left[ \begin{array}{cc} y & x \\ + & - \\ \end{array} \right] $

quadrant 3 $ \left[ \begin{array}{cc} y & x \\ - & - \\ \end{array} \right] $

quadrant 4 $ \left[ \begin{array}{cc} y & x \\ - & + \\ \end{array} \right] $

Ofcourse, it is much simplier 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 $\dfrac{A_{13}}{A_{33}}$ which gives the \htmladdnormallink{relation}{http://planetphysics.us/encyclopedia/Bijective.html} $\dfrac{A_{13}}{A_{33}} = \dfrac{-sin(\psi) cos(\theta)}{cos(\psi) cos(\theta) }$

Canceling terms and rearrangeing gives us

$\psi = tan^{-1}(\dfrac{-A_{13}}{A_{33}})$

which uses the same method to resolove quadrant ambiguity as above. To summarize, we will give the \htmladdnormallink{formulas}{http://planetphysics.us/encyclopedia/Formula.html} for the conversion from a direction cosine matrix to the Euler 312 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].

$$\phi = atan2(-A_{21}, A_{22})$$ $$\theta = asin(A_{23})$$ $$\psi = atan2(-A_{13}, A_{33})$$

\end{document}