NormQuat.m 198 B

12345
  1. % normalise the quaternion
  2. function quaternion = normQuat(quaternion)
  3. quatMag = sqrt(quaternion(1)^2 + quaternion(2)^2 + quaternion(3)^2 + quaternion(4)^2);
  4. quaternion(1:4) = quaternion / quatMag;