
graphsetup         % sets fonts, line types in graphs

N = (1:40)';       % column
h = 2.^(-N);       % values of h for approx

yp = (exp(1+h) - exp(1))./h;    % FD approx for each h 


err = abs(yp - exp(1));    %  error

% loglog plot of h vs. error 

figure(1)
loglog(h,err,'*')
xlabel('\fontsize{16} h'),ylabel('\fontsize{16} error')
title('\fontsize{16} My amazing graph!')

grid

% simple table of results

format short e
disp(' ')
disp('        h          err          err/h ')
disp('   -------------------------------------')
disp([h err err./h])
format long e
disp(' ')







