%
% controllo ordine della approssimazione alle
% differenze centrate
%
xi = 0 ;
xf = 10 ;
[x10,y10]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),10);
[x20,y20]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),20);
[x40,y40]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),40);
[x80,y80]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),80);
[x160,y160]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),160);
[x320,y320]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),320);
[x640,y640]=BVPsolve(xi,yesatta(xi),xf,yesatta(xf),640);

err10  = max(abs(y10-yesatta(x10')));
err20  = max(abs(y20-yesatta(x20')));
err40  = max(abs(y40-yesatta(x40')));
err80  = max(abs(y80-yesatta(x80')));
err160 = max(abs(y160-yesatta(x160')));
err320 = max(abs(y320-yesatta(x320')));
err640 = max(abs(y640-yesatta(x640')));

[s,err]=sprintf('log(E10/E20)/log(2)   = %f\n',log(err10/err20)/log(2)) ;
disp(s);
[s,err]=sprintf('log(E20/E40)/log(2)   = %f\n',log(err20/err40)/log(2)) ;
disp(s);
[s,err]=sprintf('log(E40/E80)/log(2)   = %f\n',log(err40/err80)/log(2)) ;
disp(s);
[s,err]=sprintf('log(E80/E160)/log(2)  = %f\n',log(err80/err160)/log(2)) ;
disp(s);
[s,err]=sprintf('log(E160/E320)/log(2) = %f\n',log(err160/err320)/log(2)) ;
disp(s);
[s,err]=sprintf('log(E320/E640)/log(2) = %f\n',log(err320/err640)/log(2)) ;
disp(s);
