RK4:
--------------------------------------------------------------------------
Fourth order Runge-Kutta. Called function is of the form:
Fun(x,t,varargin)
Accepts optional arguments that are passed through to Fun. Time is also
optional.
This version is streamlined and designed to take advantage of MATLAB's
function handles feature (MATLAB versions 6 and up only). Passing a
string function name (version 5) will also work but is slower.
Since version 1.
--------------------------------------------------------------------------
Form:
x = RK4( Fun, x, h, t, varargin )
--------------------------------------------------------------------------
------
Inputs
------
Fun Function Fun(x,{t,...})
x State (column vector)
h Independent variable step
t Current time
p1... Optional arguments
-------
Outputs
-------
x Updated state
--------------------------------------------------------------------------