This Matlab programme simulates a Lagrange top, which is a symmetric top spinning in a gravitational field. To call it, type

kreisel([1,10],[0;pi;pi/2;0;0;0])

The first parameter is a time interval \([t_0,t_\text{end}]\) and the second parameter are the initial conditions of the Euler angles \([\varphi,\dot{\varphi},\vartheta,\dot{\vartheta},\psi,\dot{\psi}]\).

The spinning top zip folder contains the code, typed documentation and a Mathematica notebook in which I derive the ordinary differential equations which are solved numerically in Matlab.