% This is a front end for ODE-solving using any solver that takes the same
% arguments as euler.m.  Step size is fixed. It is a slight
% improvement of ode_fixed --- allows the user to specify all
% the desired time points explicitly (like Octave's lsode).
% CCK 2009-Mar-01

function x = ode_fixed2(solver, ode, x0, t)

Nt = numel(t); % Number of time points, including initial conditions
Ndim = numel(x0); % How big is the phase space?
x = zeros(Nt, Ndim); % each row is a state at a given timestep.
x(1,:) = x0;

for n = 2:Nt
   h = t(n) - t(n-1);
   x(n,:) = solver(ode, x(n-1,:), t(n-1), h);
      % This is counterintuitive --- 
      % pass function handle as ode rather than %ode.
end