
function demo_derivazione1

% f=@(x) exp(x);
% df=@(x) exp(x);
% x0=0;

f=@(x) 1./(1+x.^2);
df=@(x) -2*x./(1+x.^2).^2;
x0=5;

f0=feval(f,x0);
df0=feval(df,x0);

format long e
df0

eev=-(7:0.01:9);
h=10.^eev;
x=x0+h;

sol=1;

f1=feval(f,x);
diffv=(f1-f0)./(x-x0);

ea=abs(diffv-df0);

% dd=length(x)/2;
% 
% for ii=1:dd
%     fprintf('\n \t $%1.1e$ & $%1.3e$ & $%1.1e$ & $%1.3e$\\\\',h(ii),ea(ii),h(ii+dd),ea(ii+dd));
% end

loglog(h,ea,'r+','LineWidth',2,...
                       'MarkerEdgeColor','k',...
                       'MarkerFaceColor','g',...
                       'MarkerSize',2);