Home > FR3DSource > zAngleOfRotation.m

zAngleOfRotation

PURPOSE ^

zAngleOfRotation calculates the angle of rotation from a rotation matrix R

SYNOPSIS ^

function [alpha] = zAngleOfRotation(R)

DESCRIPTION ^

 zAngleOfRotation calculates the angle of rotation from a rotation matrix R
 A good online reference is:
 http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/mech/mech_review7.html

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % zAngleOfRotation calculates the angle of rotation from a rotation matrix R
0002 % A good online reference is:
0003 % http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/mech/mech_review7.html
0004 
0005 function [alpha] = zAngleOfRotation(R)
0006 
0007 alpha = 2*acos(min(1,sqrt(trace(R)+1)/2));
0008 
0009 % occasionally trace(R) is slightly greater than 3, making alpha complex
0010 %[trace(R)-3]
0011 %[ sqrt(trace(R)+1)/2 alpha]

Generated on Fri 03-Apr-2009 09:52:35 by m2html © 2003