%No feval when use anonomous function definition
function [r,fr,logre]=newtonzeros(fh,dfh,x0)
%outputs:r=estimate of root,fr=f(x),logre=log10(error)
steps=0;
x=x0;
re=1e-8;
myrel=1;
while myrel>re && (steps<20)
    xold=x;
    x=x-fh(x)/dfh(x);
    steps=steps+1;
    myrel=abs((x-xold)/x);
    logre(steps)=log10(myrel);
end
r=x;
fr=fh(x);