function px = newtonpoly(knot,cf,x) % Calculates the values px of Newton's interpolation polynomial at x % knot : nodes of the polynomial % cf : vector containing the values of the function at the nodes % x : vector [c,w] = divdiff(knot,cf); lw=length(w); px = w(1); y = 1; for k = 2:lw y = y.*(x-knot(k-1)); px = px+w(k)*y; end