Extending 1D ball bouncing simulation to 2D
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rohit Kharat
am 30 Aug. 2021
Bearbeitet: Image Analyst
am 1 Sep. 2021
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 Kommentare
Walter Roberson
am 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.
Akzeptierte Antwort
Image Analyst
am 1 Sep. 2021
Bearbeitet: Image Analyst
am 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.)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!