This is an example of how event detection works in MATLAB with integrator ODE45. A simple rod bounces and tumbles on flat ground until it finally begins sliding.
- MAIN_simulate.m -- Run this first!
- deriveCollisions.m -- Derives contact map equations to determine how the rod acts after a collision. This file auto-generates:
- DiscreteCollisionsPt1.m
- DiscreteCollisionsPt2.m
- slidingPhase.m -- Equations of motion for the sliding rod.
- flightPhase.m -- Equations of motion for the flying rod.
- contact.m -- Conditions passed to ODE45 so it can determine when events occur and what to do.
- animate.m -- Draw the scene and show what happened during the simulation.