function [x1] = newtonp(p, x0, N)
% n : polinom fokszama = vektor merete-1
%
n = max(size(p))-1;
% pd : p derivalt vektora
%
pd = zeros(1,n);
% polinom derivalasa
%
for k=1:n, pd(k)=(n-k+1)*p(k); end;
% most indul a Newton-modszer
%
for k=1:N,
    x1 = x0-polyval(p, x0)/polyval(pd, x0);
    x0 = x1;
end;
