%Sets the tol to 10% error
tol = 10;

%Init error
err = 1000;

%Init timestep to be small
u = 0.01;

%Counter
i = 1 ;

%Loop for finding time steps
while err > tol
    
    %Calc val and error at this time step
    [a, b] = euler_explicit(@(x, y) 3*exp(-201*x) - 5*exp(-x), @(x, y) -201*y - 1000*exp(-x), -2, 0, 1, u);
    
    %Sets error for tol
    err = b;
    
    %Decreases timestep 
    u = 1/i;
    
    %Increases counter for decreasing time step
    i = i + 1;
    
end

%Time step disp
disp(['The number of steps is ', num2str(u)]);

%%
%The number of steps is 0.0097087
