function output = rungekutta(x,dt,f)
%RUNGEKUTTA Numerical integration (prediction).
% RUNGEKUTTA(X,DT,F) uses a fourth-order Runge-Kutta
% prediction routine to determine the next value of a
% function based on the current value. X can be any
% number or array of numbers, DT is the time step for
% integration, and F is the name of the function to
% integrate (with single quotes).
%
% Example:
% position2 = rungekutta(position1,0.01,'equations')
k1 = dt*feval(f,x);
k2 = dt*feval(f,x+k1./2);
k3 = dt*feval(f,x+k2./2);
k4 = dt*feval(f,x+k3);
output = x+(k1+2.*k2+2.*k3+k4)./6;