12.07.2015 Views

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 33: Quaternions 29733 QuaternionsQuaternions are hypercomplex numbers used to represent spatial rotations in three dimensions.This set of routines provides a useful basis for working with quaternions in<strong>Octave</strong>. A tutorial is in the <strong>Octave</strong> source, scripts/quaternion/quaternion.ps.These functions were written by A. S. Hodel, Associate Professor, Auburn University.[a, b, c, d] = quaternion (w)[vv, theta] = quaternion (w)w = quaternion (a, b, c, d)w = quaternion (vv, theta)Construct or extract a quaternionw = a*i + b*j + c*k + dfrom given data.Function FileFunction FileFunction FileFunction Fileqconj (q)Conjugate of a quaternion.q = [w, x, y, z] = w*i + x*j + y*k + zqconj (q) = -w*i -x*j -y*k + zFunction Fileqderiv (omega)Derivative of a quaternion.Function FileLet 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 byQ’ = qderivmat (omega) * QIf the passive convention is used (rotate the frame, not the vector), thenQ’ = -qderivmat (omega) * Qqderivmat (omega)Derivative of a quaternion.Function FileLet 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 byQ’ = qderivmat (omega) * QIf the passive convention is used (rotate the frame, not the vector), thenQ’ = -qderivmat (omega) * Q.qinv (q)Return the inverse of a quaternion.q = [w, x, y, z] = w*i + x*j + y*k + zqmult (q, qinv (q)) = 1 = [0 0 0 1]Function File

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!