% Initialization step
% h_vect = []; err_vect = []; h = 0.2; 

t=0:0.05:3;
x = -1 - t + 2 * exp(t);           % The exact solution
h_vect = [h_vect h];               % The new step size vector
[s y]  = eul ('ypt', 0, 3, 1, h);  % The approximate solution
plot(t, x, s, y, 'o')              % Plot both
z = -1 - s + 2 * exp(s);           % The exact solution at the s points
maxerror = max(abs(z - y))         % The biggest error
err_vect = [err_vect maxerror];    % The new error vector
h_vect                             % Display the vector of step sizes
err_vect                           % Display the vector of errors
h = h / 2;                         % The step size for the next time

% See error
% loglog(h_vect, err_vect); xlabel('Step size'); ylabel('Maximum error'); grid  

