RK45:
--------------------------------------------------------------------------
Fourth/fifth order Runge-Kutta.
Called function is of the form:
Fun(x,t,p1,p2,...)
Accepts optional arguments that are passed through to Fun.
Time is also optional.
This function will integrate Fun from the current t to t + hMax.
Since version 1.
--------------------------------------------------------------------------
Form:
[x, hLast] = RK45( Fun, x, h, hMax, hMin, tol, t, varargin )
--------------------------------------------------------------------------
------
Inputs
------
Fun Function Fun(x,t,p1,p2...)
x State (column vector)
h Independent variable step
hMax Maximum step size
hMin Minimum step size
tol Tolerance on error
t Current time
varargin Optional arguments
-------
Outputs
-------
x Updated state
hLast Independent variable step
--------------------------------------------------------------------------
Reference: Cash, J.R., A. H. Karp, "A Variable Order Runge-Kutta Method
for Initial Value Problems with Rapidly Varying Right-Hand
Sides," ACM Trans. on Math. Soft., Vol. 16, No.3, Sept.
1990, pp 201-222.
--------------------------------------------------------------------------