CSPICE_XF2RAV determines the rotation matrix and angular
velocity of the rotation from a state transformation matrix.
Given:
xform operator(s) that transform state vector(s) from some frame
"frame1" to another frame "frame2."
Either [6,6] = size(xform); double = class(xform)
or [6,6,n] = size(xform); double = class(xform)
the call:
[rot, av] = cspice_xf2rav(xform)
returns:
rot rotation matrix/matrices that gives the transformation from
some frame "frame1" to another frame "frame2".
If [6,6] = size(xform)
then [3,3] = size(rot); double = class(rot)
If [6,6,n] = size(xform)
then [3,3,n] = size(rot); double = class(rot)
av the angular velocities vector/matrix of the transformation.
If [6,6] = size(xform)
then [3,1] = size(av); double = class(av)
If [6,6,n] = size(xform)
then [3,n] = size(av); double = class(av)
If 'p' is the position of a fixed point in "frame2,"
then from the point of view of "frame1," 'p' rotates
(in a right handed sense) about an axis parallel to
'av'. Moreover the rate of rotation in radians per unit
time is given by the length of 'av'.
More formally, the velocity 'v' of 'p' in "frame1" is
given by
t
v = av x ( rot * p )
The components of 'av' are given relative to "frame1."
'rot' and 'av' return with the same vectorization
measure, N, as 'xform'.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
%
% Load a set of kernels: an SPK file, a PCK file
% and a leapseconds file. Use a meta kernel
% for convenience.
%
cspice_furnsh( 'standard.tm' )
%
% Create an array of 10001 ephemeris times based at July 1 2007.
%
et = [0: 10000]* cspice_spd + cspice_str2et( 'July 1 2007' );
%
% Calculate the state transformation matrices from J2000 to IAU_MOON
% for 'et'.
%
xform = cspice_sxform( 'J2000', 'IAU_MOON', et );
%
% Convert the set of 'xform' matrices to the corresponding rotation
% matrices and angular velocity vectors.
%
[ rot, av ] = cspice_xf2rav(xform);
%
% Use the converted outputs from cspice_xf2rav to recompute a set
% of state transformation matrices.
%
strans = cspice_rav2xf( rot, av );
%
% Calculate the maximum value of the absolute difference between
% 'xform' and 'strans'.
%
disp( 'Vector:' )
fprintf( ...
'Maximum absolute difference between rotation matrices: %8.6e\n', ...
max( max( max( abs(strans  xform) ) ) ) )
%
% It's always good form to unload kernels after use,
% particularly in MATLAB due to data persistence.
%
cspice_kclear
MATLAB outputs:
Maximum absolute difference between rotation matrices: 1.694066e21
In this case, a value on the order of 21 indicates numerical
equivalence.
This routine is an inverse of the routine cspice_rav2xf.
For important details concerning this module's function, please refer to
the CSPICE routine xf2rav_c.
MICE.REQ
Mice Version 1.0.2, 09MAR2015, EDW (JPL)
Edited I/O section to conform to NAIF standard for Mice documentation.
Mice Version 1.0.1, 06MAY2009, EDW (JPL)
Added MICE.REQ reference to the Required Reading section.
Mice Version 1.0.0, 11APR2007, EDW (JPL)
State transformation to rotation and angular velocity
