Project 4: Simulating a Bouncing Ball with Simulink
Build a Simulink model of a bouncing ball and compare it to an analytic solution.
Project Overview
| Attribute | Value |
|---|---|
| Difficulty | Level 2: Intermediate |
| Time Estimate | Weekend |
| Main Language | MATLAB + Simulink |
| Alternative Languages | Python (SimPy), Modelica |
| Knowledge Area | Simulation and dynamics |
| Tools | Simulink |
| Main Book | “System Dynamics” by Katsuhiko Ogata |
What you’ll build: A Simulink model that simulates a ball falling and bouncing with a restitution coefficient.
Why it teaches MATLAB: Simulink teaches block-diagram modeling and continuous-time systems.
Core challenges you’ll face:
- Building integrator chains
- Implementing collision detection and bounce
- Comparing numeric vs analytic results
Real World Outcome
You will run the simulation and see the ball’s height over time with decreasing bounce heights.
Example Output:
Simulation time: 10 s
Bounces detected: 6
Saved plot: bounce_height.png
Verification steps:
- Compare bounce heights against expected restitution ratio
- Validate free-fall segments against analytic curves
The Core Question You’re Answering
“How do continuous-time equations become a block simulation?”
This is the essence of Simulink modeling.
Concepts You Must Understand First
Stop and research these before coding:
- Second-order motion
- How do acceleration, velocity, and position relate?
- Book Reference: “System Dynamics” by Katsuhiko Ogata, Ch. 2
- Restitution coefficient
- How does it control bounce height?
- Book Reference: “Classical Mechanics” by John Taylor, Ch. 4
- Event handling
- How do you detect ground contact in a simulation?
- Book Reference: “System Dynamics” by Katsuhiko Ogata, Ch. 4
Questions to Guide Your Design
- Model structure
- How will you chain integrators for velocity and position?
- Where will you insert the bounce logic?
- Validation
- How will you compare to analytic free-fall equations?
- How will you test different restitution values?
Thinking Exercise
Bounce Ratio
If a ball drops from 10 meters and restitution is 0.8, what height should the first bounce reach?
Questions while working:
- How does energy relate to height?
- Why does the bounce ratio square the restitution coefficient?
The Interview Questions They’ll Ask
Prepare to answer these:
- “What is a restitution coefficient?”
- “How do you model continuous-time systems in Simulink?”
- “Why do you need event detection in simulations?”
- “How do integrators represent physics?”
- “How do you validate a simulation model?”
Hints in Layers
Hint 1: Starting Point Start with a simple free-fall model without bouncing.
Hint 2: Next Level Add a condition to reverse velocity at ground contact.
Hint 3: Technical Details Use a saturation or relational operator to detect collisions.
Hint 4: Tools/Debugging Plot height and velocity to confirm physics.
Books That Will Help
| Topic | Book | Chapter |
|---|---|---|
| Motion equations | “System Dynamics” by Katsuhiko Ogata | Ch. 2 |
| Restitution | “Classical Mechanics” by John Taylor | Ch. 4 |
| Event handling | “System Dynamics” by Katsuhiko Ogata | Ch. 4 |
Implementation Hints
- Keep block layout readable with clear labels.
- Start with fixed time step to simplify debugging.
- Log signals for analysis outside Simulink.
Learning Milestones
- First milestone: You can simulate free fall in Simulink.
- Second milestone: You can implement bounce behavior.
- Final milestone: You can validate the model against analytic physics.