método de interpolación de newton.pdf

1
Método de interpolación de Newton (28, pág 116) function p=newtonp(tx,ty) n=length(tx); p=[ty(1)]; raices=[]; for k=2:n raices=[raices tx(k-1)]; q=poly(raices); A=(ty(k)-polyval(p,tx(k)))/polyval(q,tx(k)); p=[0 p]+A*q; end >> p=[1 -5 1]; >> tx=[-1 1 2 3]; >> ty=[polyval(p,-1),polyval(p,1),polyval(p,2),10]; >> q=newtonp(tx,ty) q = 1.8750 -2.7500 -6.8750 4.7500 >> polyval(q,0) ans =4.7500 Mg. Roger Mestas Chávez

Upload: oscar-torres

Post on 10-Apr-2016

7 views

Category:

Documents


3 download

TRANSCRIPT

Método de interpolación de Newton (28, pág 116) function p=newtonp(tx,ty) n=length(tx); p=[ty(1)]; raices=[]; for k=2:n raices=[raices tx(k-1)]; q=poly(raices); A=(ty(k)-polyval(p,tx(k)))/polyval(q,tx(k)); p=[0 p]+A*q; end >> p=[1 -5 1];

>> tx=[-1 1 2 3];

>> ty=[polyval(p,-1),polyval(p,1),polyval(p,2),10];

>> q=newtonp(tx,ty)

q = 1.8750 -2.7500 -6.8750 4.7500

>> polyval(q,0)

ans =4.7500

Mg. Roger Mestas Chávez