function [tvals,yvals] = FixedAB(f,t0,y0,h,d,n)
%
% Produces an approximate solution to the initial value problem
%
% y'(t) = f(t,y(t)) y(t0) = y0
%
% using a strategy that is based upon a d-th order
% Adams-Bashforth method. Stepsize is fixed.
%
% f is a handle that references a function of the form f(t,y).
% t0 = initial time.
% y0 = initial condition vector.
% h = stepsize.
% d = order of method. (1<=d<=5).
% n = number of steps to be taken,
%
% tvals is a column vector with tvals(j) = t0 + (j-1)h, j=1:n+1
% yvals is a matrix with yvals(j,:) = approximate solution at tvals(j), j=1:n+1

[tvals,yvals,fvals] = ABStart(f,t0,y0,h,d);
tc = tvals(d);
yc = yvals(d,:)';
fc = fvals(:,d);

for k=d:n
% Take a step and then update.
[tc,yc,fc] = ABStep(f,tc,yc,fvals,h,d);
tvals = [tvals; tc];
yvals = [yvals; yc'];
fvals = [fc fvals(:,1:d-1)];
end