Talk:PlanetPhysics/Direction Cosine Matrix to Euler 323 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 323 angles %%% Primary Category Code: 45.40.-f %%% Filename: DirectionCosineMatrixToEuler323Angles.tex %%% Version: 1 %%% 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 323 sequence}{http://planetphysics.us/encyclopedia/Euler323Sequence.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 323 sequence is

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

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

$A_{33} = cos(\theta)$

Solving for $\theta$ yields

\begin{equation} \theta = cos^{-1}(A_{33}) \end{equation}

Care must now be taken when evaluating the inverse cosine. It is a multivalued \htmladdnormallink{function}{http://planetphysics.us/encyclopedia/Bijective.html}. Analytically, the convention is to choose the principle value such that

$0 \le \theta \le \pi$

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

$\dfrac{A_{32}}{A_{31}}= \dfrac{sin(\theta) sin(\phi)}{sin(\theta) cos(\phi)}$

Rearranging and using the tangent yields

$tan(\phi) = \dfrac{A_{32}}{A_{31}}$

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

Canceling terms and rearrangeing gives us

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

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 232 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_{32}, A_{31})$$ $$\theta = acos(A_{33})$$ $$\psi = atan2(A_{23}, -A_{13})$$

\end{document}