% Unit 3 (MATLAB Course @ UAM)
% (c) Alexander Knebe

function [x0, n] = NewRaph(f, fderiv, x0)

eps = 1e-8;
n   = 0;
while abs(f(x0))>eps
   x0 = x0 - f(x0)/fderiv(x0);
   n  = n + 1;   
end

end