view scripts/quaternion/qderiv.m @ 3426:f8dde1807dee

[project @ 2000-01-13 08:40:00 by jwe]
author jwe
date Thu, 13 Jan 2000 08:40:53 +0000
parents 1e7532b9173b
children a892190f4977
line wrap: on
line source

function Dmat = qderivmat(Omega)
# function Dmat = qderivmat(Omega)
# Derivative of a quaternion.
#   Let Q be a quaternion to transform a vector from a fixed frame to
#      a rotating frame.  If the rotating frame is rotating about the 
#      [x,y,z] axes at angular rates [wx, wy, wz], then the derivative
#      of Q is given by
#   Q' = qderivmat(Omega)*Q
#
#   If the passive convention is used (rotate the frame, not the vector),
#   then Q' = -qderivmat(Omega)*Q; see the accompanying document
#   quaternion.ps for details.

Omega = vec(Omega);
if(length(Omega) != 3)
   error("qderivmat: Omega must be a length 3 vector.");
endif

Dmat = 0.5*[ 0.0,  Omega(3), -Omega(2),  Omega(1); ...
 	  -Omega(3),      0.0,  Omega(1),  Omega(2); ...
  	  Omega(2), -Omega(1),      0.0,  Omega(3); ...
 	  -Omega(1), -Omega(2), -Omega(3),      0.0 ];
endfunction