clear all
close all
A = 16 * toeplitz ([-2, 1, 0]);
y0 = [sqrt(2)/2;1;sqrt(2)/2];
b = @(y) y.^2;
f = @(y) A*y+b(y);
tstar = 1;
tsrif = 5000;
ts = tsrif;
yee = y0;
yeexp = y0;
k = tstar / ts;
P = phi1m(k*A);
for n = 1:ts
  yee = yee + k*f(yee);
  yeexp = yeexp + k*P*f(yeexp);
end
yrif = yee;
tsrange = 10:10:100;
counter = 0;
for ts = tsrange
  counter = counter+1;
  yee = y0;
  yeexp = y0;
  k = tstar / ts;
  P = phi1m(k*A);
  for n = 1:ts
    yee = yee + k*f(yee);
    yeexp = yeexp + k*P*f(yeexp);
  end
  erree(counter) = norm(yee-yrif);
  erreexp(counter) = norm(yeexp-yrif);
end
loglog(tsrange,erree,'*',tsrange,erreexp,'o')
legend('Eulero esplicito','Eulero esponenziale')  
