I am trying to build a simple program where an object undergoes simple harmonic motion, where a force is initially applied, than undergoes SHM until coming to a stop. My problem is that my program runs forever without the object ever stops,(as if there is no external force acting on the object to slow it down)
How could I add a force to slow it down to its initial equilibrium point?
Here is what I have so far: given a mass, initial force applied, spring constant-K I calculate
amplitude = mass*gravity + Force(applied) / K omega = sqrt(K/mass) initPos = mass*gravity / K
to find postion at time t = initalPosition + amplitude*cos(omega*t)
but this system will never end, it keeps oscillating for ever. How can I add a force to stop the oscillation over a period of time??
sorry for the long post!
thank you
You can multiply by a damping factor, so $x(t)=x(0)+Acos(\omega t)\exp(-bt)$ where you choose $b$ to make it damp as fast as you want.