top of page
Bouncing

 

We have a function called bounceserr.m. This function is supposed to simulate the bouncing of an imperfectly elastic ball from the walls of a 2D box. It expects a numberof bounces, the width and height of the box and a loss coefficient. The loss coefficient determines how much the velocity perpendicular to a wall decreases during a collision. 1 is perfectly elastic, 0 is perfectly inelastic (but this case is not allowed since there is no bouncing). The function picks a random start location and a random direction. It then computes all the places the ball hits the wall, and graphs the trajectory of the ball.
 
To test the code, make sure to consider loss coefficients of 1, 0.99, 0.9, 0.8, 0.5 and 0.1

 

 

 

bottom of page