% Newtonov interpolacijski polinom - uporaba algoritma 4.3.1 % Vrednost Newtonovega interpolacijskega polinoma x = [0:0.1:0.3]; f = sin(x); t = 2; alg431 p = diag(a); xx = [0:0.001:0.4]; y1 = nip(p,1,x,xx)-sin(xx); y2 = nip(p,2,x,xx)-sin(xx); y3 = nip(p,3,x,xx)-sin(xx); figure(1) hold off plot(xx,y2,'g',xx,y3,'b') axis(axis) hold on plot(xx,y1,'r'), grid figure(2) semilogy(xx,abs([y1; y2; y3])), grid