x=pi/4;

f=@sin;             % function handle
fprimex=cos(x);     % f'(x)

% f=@sqrt;                %function handle
% fprimex=1/(2*sqrt(x));  % f'(x)

for i=1:16
    h(i)=10^(-i);
%   Df(i)=derivative1(f,x,h(i));
   Df(i)=derivative2(f,x,h(i));
   e(i)=abs( Df(i) - fprimex );
end

a=[h', Df', e']
[emin,i]=min(e)
