RungeKutta4thOrder:

% Fourth order Runge-Kutta. 
 Called function is of the form:

 Fun(t,x,varargin)

 Accepts optional arguments that are passed through to Fun. 
--------------------------------------------------------------------------
   Form:
   x = RK4( Fun, x, t, h, varargin )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   Fun                Function    Fun(x,{t,...})
   x                  State (column vector)
   t                  Current time
   h                  Time step
   p1...              Optional arguments

   -------
   Outputs
   -------
   x                  Updated state

--------------------------------------------------------------------------