Solving non linear ODE numerically

58 Views Asked by At

I want to solve the following eqation numerically"
$ mx''+kx = f(x,\dot{x},t)$

The funciton $f(x,\dot{x},t)$ and is the assumed to be an external load, it changes every time step and is assumed to have the form: $f(x,\dot{x},t) \approx C1x + C2 \dot{x} $. Which allows for rewriting:

$ mx''+kx = \frac{df}{dx}x + \frac{df}{d\dot{x}}\dot{x} $

I tried solving the equation by use of a Runge Kutta scheme, and discretized the differentials by using data from the previous timestep. But it explodes after a few time steps.

I hoped one of you had a suggestios...