This programm is a slight improvement of a contribution from another user, published in Apr 2012 " 13 dof motorcycle model " version 1.2 by Wesley. It is an implementation of a multi body system which can simulate the behaviour of a motorcycle. Hence the motorcycle is assumed to be made of 6 separate rigid bodies linked by joints.(It's properties are described by 56 parameters matching for a Yamaha FJR 1300). The motorcycle parts are rear wheel, swingarm, main body, steering head, front fork and front wheel. Using the Euler-Lagrange formalism of classical mechanics 13 second order non linear ordinary differential equations of motion are derived. This system of 13 2nd order ODE's describes the motion of the motorcyle as a function of the forces applied by the rider (engine torque, steering torque, front/rear brake force) . Linearized to 26 coupled first order ODE's this system of equations can be provided to one of the matlab build-in ODEsolver's as a RightHandSide function, that computes the second derivative for each of the 13 generalized cordinates (q_i 's) at time t ( generalized accelerations ). This way i computed simulations of two scenarios, a wheelie and a stoppie. The output, a table with 13 q's (column's) for each time step (0.01s) , is then transformated "back" from configuration-space to position-vectors and rotation-matrices, that define the position of a reference point(center of mass) and the orientation of a coordinate frame attached to each of the six rigid bodies, using code of the function "void animate()" provided by wesley, that takes the vector of generalized cordinates (q's) as input and plots the motorcycle in the configuation described by the q's.
animate() is called repeatedly to create the animation. I don't want to explain the additional functionality of the GUI in too much detail, becaus i think it's intuitive. Several instruments display the forces , velocities etc. .. at each simulation-time index ( 01.20s <--displayed in the middle of the speedo , bottom right). The instruments can independently be en/disabled through the menu "force-elements". Furthermore you can Pause/Play/Stop the animation via the according buttons. Manipulate the axis's apperance (grid,box on/off , backgroundcolor) through it's context menu ( accessible by right-click).
The sliders for the generalized cordinates display the current configuration and can be toggeled visible on/off through the menu "pi slider". Unfortunately matlab is only capable of rendering 4 to 6 frames per second (number xxx fps in the top middle) so i implemented the programm in another language.
Choose which animation you want to see, by un- or commenting the "load('stoppie_3.mat')" line in the source code of "App_Moto_1.m"
Thank's and compliment to Wesley for his excellent contribution, the system of equations it this big, it can not be stated without the heavy use of subexpressions.
Lucas Tassilo Scharbrodt (2023). 13 DOF motorcycle model W. Ooms (https://www.mathworks.com/matlabcentral/fileexchange/67975-13-dof-motorcycle-model-w-ooms), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: motorcycle model
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!