So far I managed to derive a simple method to simulate pendulums directly using the rigid pendulum equation (c is a negative constant)m
I do know Euler's method, which is really simple. But how do I apply it to second derivatives? That's the trick here.
I found that if I broke this equation into two by defining a variable ω,
I can easily apply Euler's method using the finite differences approximation,
Therefore, I can convert this into a form useful for programming,
This is easily done by iteration; simply keep track of the index i and the values of ω and θ. By choosing the Δt to be small, one can approximate the pendulum with some precision. I have tested the method and it seems to be quite stable, though I'm not sure how good the precision.


0 comments:
Post a Comment