Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I am having a problem implementing 4th Order Runge Kutta (RK4) to solve a non linear ODE.

dy/dt = B(t) - A(t)*y(t)^2 where the coefficients A(t) and B(t) are specific to the problem I am working on.

For the test case I am running I specify a sinusoidal signal and from this signal I calculate A(t) and B(t). While the magnitudes of these coefficients are functions of time they are not functions of the frequency of the sinusoidal function I am specify. I am sure you are all familiar with the algorithm but having it will help me explain.

y(i+1) = y(i) + h/6*(k1 + 2k2 + 2k3 + k4)

k1, k2, k3 and k4 are functions of A(t), B(t) and y(t). As I mentioned above the coefficients A and B are not functions of the frequency of the sinusoid so the values of k1, k2, k3 and k4 are also not functions of the frequency.

My problem is that the values of the k coefficients are quite large. So when I use a high frequency signal the large values of k are compensated by the very small value of h so that the second term on the right hand side h/6*(k1 ...) is the same order of magnitude as y(i). If the frequency is small then I would think I could use a larger timestep h but the k coefficients are still very large so h/6*(k1 ...) >> y(i) and the method is unstable.

Is there anything I can do other than just using a very small time step for the low frequency cases? Perhaps some way of scaling the coefficients? Or should I just use a different method? It just seems wrong that for a lower frequency I need a smaller time step.

Thanks for your help.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# RK4 Time step question

Loading...

Similar Threads - step question | Date |
---|---|

I Question about second order linear differential equations | Aug 21, 2017 |

System of ODEs with RK4 & step doubling in Fortran : damping | Nov 12, 2015 |

Steps to solving L{u(t−2)e3t}? | May 31, 2015 |

First-Order Equations: don't understand a simplification step | Feb 5, 2015 |

Solving PDE with smoothing - Time step Query | Dec 3, 2014 |

**Physics Forums - The Fusion of Science and Community**