% Use of quaternions to numerically solve the problem of the spinning top
% The top is released with an angular velocity of 1000 revolutions per
% minute(rpm) around its axis of symmetry (the body z axis), which makes
% an angle of 60 ° with the vertical (the inertial Z axis).
Ran into some bugs on this:
* Matrix B wasn't declared
* Should specify g
* Add a transpose to MoX to make it a 3x1
* QXx was not defined
* use a incremented variable for t instead of w(t)
* You'll also probably need to normalize the quaternion regularly to avoid additive errors.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.