% This is a sample "m-file" for MATLAB which calls the % MATLAB function f1.m. % kmax=16; x=1; for k=1:kmax h(k)=10^(-k); % fprime(k)=(f1(x+h(k))-f1(x))/h(k); fprime(k)=(f1(x+h(k))-f1(x-h(k)))/(2*h(k)); end loglog(h,abs(fprime-cos(1)))