function [seq]=newton3(func,fderiv,init,tol)
% implements Newton's method using a FOR loop
% outputs the sequence of iterates as a column vector

f=inline(func,'x');
fprime=inline(fderiv,'x');

x(1)=init;

for k=1:100
    if abs( f(x(k)) ) <= tol
        break
    end
    x(k+1)=x(k) - f(x(k))/fprime(x(k)) ;
end

seq=x.';
end
