clear all
close all
odefun = @(t, y) y;
y0 = 1;
m = 100;
tspan = linspace (0, 1, m + 1);
[tout, yout] = euleroesplicito (odefun, tspan, y0);
plot (tout, yout, '*', tout, exp(tout))
legend ('numerical solution','exact solution')
mrange = (10:10:100);
counter = 0;
for m = mrange
  counter = counter + 1;
  tspan = linspace (0, 1, m + 1);
  [tout, yout] = euleroesplicito (odefun, tspan, y0);
  err(counter) = abs (yout(m+1) - exp(1));
end
figure
loglog (mrange, err, '*', mrange, mrange .^ (-1))
  
