a=-1; b=1;
ftype=1;

N_vett=3:40;
LN=length(N_vett);
res=exact_results(ftype);

for index=1:LN;
    N=N_vett(index);
    [x_tpz,w_tpz,I_tpz,x_simp,w_simp,I_simp,x_jac,w_jac,I_jac,x_cc,w_cc,I_cc,timing]=demo_block(N,a,b,ftype);
    relerr_tpz(index)=abs(I_tpz-res)/abs(res);
    relerr_simp(index)=abs(I_simp-res)/abs(res);
    relerr_jac(index)=abs(I_jac-res)/abs(res);
    relerr_cc(index)=abs(I_cc-res)/abs(res);
end

hold off;
semilogy(N_vett,relerr_tpz,'ro-'); hold on;
semilogy(N_vett,relerr_simp,'k.-'); hold on;
semilogy(N_vett,relerr_jac,'m+-'); hold on;
semilogy(N_vett,relerr_cc,'g:'); 

fprintf('\n \t [LINEA ROSSA  ]: TRAPEZI CM. ');
fprintf('\n \t [LINEA NERA   ]: SIMPSON CM. ');
fprintf('\n \t [LINEA MAGENTA]: GAUSS LEGE. ');
fprintf('\n \t [LINEA VERDE  ]: CLENSHAW C. ');

% legend('tpz','simp','gl','cc');
