home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts / quaternion / qderivmat.m < prev    next >
Text File  |  1998-10-23  |  860b  |  24 lines

  1. function Dmat = qderivmat(Omega)
  2. # function Dmat = qderivmat(Omega)
  3. # Derivative of a quaternion.
  4. #   Let Q be a quaternion to transform a vector from a fixed frame to
  5. #      a rotating frame.  If the rotating frame is rotating about the 
  6. #      [x,y,z] axes at angular rates [wx, wy, wz], then the derivative
  7. #      of Q is given by
  8. #   Q' = qderivmat(Omega)*Q
  9. #
  10. #   If the passive convention is used (rotate the frame, not the vector),
  11. #   then Q' = -qderivmat(Omega)*Q; see the accompanying document
  12. #   quaternion.ps for details.
  13.  
  14. Omega = vec(Omega);
  15. if(length(Omega) != 3)
  16.    error("qderivmat: Omega must be a length 3 vector.");
  17. endif
  18.  
  19. Dmat = 0.5*[ 0.0,  Omega(3), -Omega(2),  Omega(1); ...
  20.        -Omega(3),      0.0,  Omega(1),  Omega(2); ...
  21.         Omega(2), -Omega(1),      0.0,  Omega(3); ...
  22.        -Omega(1), -Omega(2), -Omega(3),      0.0 ];
  23. endfunction
  24.