I have to simulate a cylinder moving in transverse direction due to an external force (no damping). The equation of motion is: $M\frac{d^2Y}{dt^2}+kY = F_Y$My confusion is regarding $kY$, how to get displacement when the cylinder is not at $(0,0)$ but at an arbitrary position say, $x_c=0.5, y_c=0.5$. The cylinder should oscillate freely about the ($0.5,0.5$) point. I would like to solve this equation using Euler method, what will be the $Y$ in this scenario. My version is:Y = Y0 + dt * V0;V = V0 + dt * (-K * Y0 + FY) / M;V0 and Y0 are the values at old/previous time step.
Equation of Motion Moving Cylinder, Displacement due to spring force
finite difference