Extending 1D ball bouncing simulation to 2D
조회 수: 11 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2021년 8월 31일
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.
채택된 답변
Image Analyst
2021년 9월 1일
편집: Image Analyst
2021년 9월 1일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!