Simulation of a ball bouncing over hilly terrain in 2D. Designed as a tutorial for event detection in Matlab.
Matthew Kelly (2021). Bouncing-Ball: Tutorial for ode45 events. (https://github.com/MatthewPeterKelly/Bouncing_Ball_Matlab), GitHub. Retrieved .
Hi Mohamed, the code for the interactive graphics was written by Jira Doke at Mathworks, which he provides in the comments on the bottom of Pick of the Week page:
Is it possible to send me the updated code with the interactive part demonstrated in the video here http://blogs.mathworks.com/pick/2016/03/04/bouncing-ball-animation-using-events-with-ode/?
My email is firstname.lastname@example.org
Thank you, much appreciated!
Thanks! I made the ground a set of smooth analytic functions so that the root-solving in the event detection would behave nicely, and so I didn't have to worry about the domain of the function. That being said, as long as ground height is a valid smooth function it the code should run fine.
I could imagine a new implementation of the groundHeight() function that uses a cubic spline to interpolate a set of discrete data, rather than using sine waves. I don't have time to code it up now, but I'm happy to look at pull requests to the GitHub repo if you end up adding that feature.
Excellent! Why not update the function 'groundHeight' so that you can deal with discrete data of ground?(I'm looking forward to an 'interpolation' of every kind of ground :D).
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!