function [x4,x5] = rkf45_step2(x,t,h)
%
%  This function computes a single step of Runge-Kutta-Fehlberg 4/5.
%  It returns both estimates of x(k+1).
%
%         [x4,x5] = rkf45_step2(x,t,h)
%
%  Input parameters:
%  -----------------
%
%     x   :=  Value of the state vector at time t.
%
%     t   :=  Simulation time at the beginning of the step.
%
%     h   :=  Desired step length, can be either positive or negative.
%
%  Output parameters:
%  ------------------
%
%     x4  :=  4th order approximation of the state vector at time (t+h).
%
%     x5  :=  5th order approximation of the state vector at time (t+h).
%
%  Function calls:
%  ---------------
%
%  This function calls various times the function:
%
%           [xxdot] = st_eq2(xx,tt)
%
%  to compute the state derivative at a given time, tt, and for a given value
%  of the state vector, xx, using the state-space model of the system to be
%  simulated.
%
xdot   = st_eq2(x,t);
%
xP1    = x + (1/4)*h*xdot;
tP1    = t + (1/4)*h;
xP1dot = st_eq2(xP1,tP1);
%
xP2    = x + (3/32)*h*xdot + (9/32)*h*xP1dot;
tP2    = t + (3/8)*h;
xP2dot = st_eq2(xP2,tP2);
%
xP3    = x + (1932/2197)*h*xdot - (7200/2197)*h*xP1dot + (7296/2197)*h*xP2dot;
tP3    = t + (12/13)*h;
xP3dot = st_eq2(xP3,tP3);
%
xP4    = x + (439/216)*h*xdot - 8*h*xP1dot + (3680/513)*h*xP2dot - (845/4104)*h*xP3dot;
tP4    = t + h;
xP4dot = st_eq2(xP4,tP4);
%
xP5    = x - (8/27)*h*xdot + 2*h*xP1dot - (3544/2565)*h*xP2dot + (1859/4104)*h*xP3dot ...
         - (11/40)*h*xP4dot;
tP5    = t + (1/2)*h;
xP5dot = st_eq2(xP5,tP5);
%
x4 = x + (25/216)*h*xdot + (1408/2565)*h*xP2dot + (2197/4104)*h*xP3dot - (1/5)*h*xP4dot;
x5 = x + (16/135)*h*xdot + (6656/12825)*h*xP2dot + (28561/56430)*h*xP3dot ...
     - (9/50)*h*xP4dot + (2/55)*h*xP5dot;
%
return