Extending 1D ball bouncing simulation to 2D

11 views (last 30 days)
The task is to extend the 1D ball bouncing simulation to two dimensions (x and y), and plot the ball motion for several bounces, including horizontal and vertical motion versus time and versus each other.For the horizontal motion we can assume that the ball slips when in contact with ground and that this slippage causes a proportional reduction in horizontal velocity. We can choose an initial condition so that the ball moves to the right and I have to show how the bouncing dies out over time with a coefficient of restitution of less than 1. You may choose your own values for coefficient of restitution and horizontal damping rate.
  7 Comments
Walter Roberson
Walter Roberson on 31 Aug 2021
To add to this: just like the ballode example, you need to call ode45() using event functions, and the event functions (contact with the floor detected) must signal for termination. The ode45() call will terminate, and you adjust the boundary conditions the way DGM indicates, and then you call ode45() again with the new boundary conditions.
Do not try to use if statements or whatever inside the code to detect bouncing and try to do everything in one run: the mathematics of the techniques used by the ode*() functions requires that you stop the run at each discontinuity.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 1 Sep 2021
Edited: Image Analyst on 1 Sep 2021
Can't you just replace your 1-D y with z, then make a new y for the second dimension? Then you'll have a Vx and Vy instead of only a Vx. Then after each bounce you need to decrease the Vx and Vy by the appropriate amount due to the slippage. (The attached demos are generic, with nothing specific to your slipping simultation.)

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!