Extending 1D ball bouncing simulation to 2D
Mostra commenti meno recenti
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 Commenti
Adam Danz
il 30 Ago 2021
Sounds like a fairly clear starting point. What's your question? Where do you need help?
Rohit Kharat
il 31 Ago 2021
The way the text reads, it seems that friction modeling is very simplified. Much like using the coefficient of restitution to describe the relationship between the y-component of approach and rebound velocities, it seems that you are to use a similar proportionality to describe the overall relationship between the x-components before and after the contact event.
If that interpretation is correct, then the x-component of velocity would be a piecewise-constant function, where the relative change in value at each step is the same.
Rohit Kharat
il 31 Ago 2021
You should already have the equations of motion that you need. Conceptually, you can analyze the system between contact events as any other ballistic motion problem. You have a given x,y velocity, gravity dictates a parabolic trajectory until the ball makes contact with the ground again. At that point, the sign of the y-component of velocity is flipped and the magnitude multiplied by the coefficient of restitution (less than 1). Simultaneously, the x-component of velocity is multiplied by what the text is referring to as a damping rate (another coefficient less than 1). The contact position and the reduced velocity vector are the initial conditions for the next cycle. Since we're neglecting aerodynamic drag, the x-component of velocity is constant between contact events.
Walter Roberson
il 31 Ago 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.
Rohit Kharat
il 1 Set 2021
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!