Está en la página 1de 7

Interpolación de Newton. Jose Daniel Gomez Barrios.

Ejercicio 1
%Ejercicio 1
X = [ 1 4 5 6 ];
Y = [0 1.386294 1.609437 1.791759];
[C,D] = newpoly(X,Y)

C =

0.0079 -0.1384 0.9889 -0.8584

D =

0 0 0 0
1.3863 0.4621 0 0
1.6094 0.2231 -0.0597 0
1.7918 0.1823 -0.0204 0.0079

x = [1 4 5 6]; y = [0 1.386294 1.609437 1.791759];

[C,D] = newpoly(X,Y)

xx = -2:0.1:6;

yy = C(4)+C(3)*xx.^1+C(2)*xx.^2+C(1)*xx.^3;

plot(x,y,'o',xx,yy),title('Polinomio interpolador de Newton')

xlabel('x'), ylabel('y'), grid

%Vector residual

R = y-(C(5)+C(4)*x+C(3)*x.^2+C(2)*x.^3+C(1)*x.^4)

C=

0.1917 -3.4000 19.6083 -40.9000 27.5000


D=

3.0000 0 0 0 0

0 -3.0000 0 0 0

5.0000 5.0000 4.0000 0 0

8.0000 1.5000 -1.1667 -1.2917 0

2.0000 -6.0000 -2.5000 -0.3333 0.1917

R=

-3.0000 -7.7137 -6.3906 -0.2082

Polinomio interpolador de Newton


20

-20

-40
y

-60

-80

-100
-2 -1 0 1 2 3 4 5 6
x
%Ejercicio 2
X = [0 0.2 0.4 0.6 0.8 1 1.2]; Y = [0 0.203 0.423 0.684 1.030 1.557
2.572];
[C,D] = newpoly(X,Y)

C =

2.7561 -7.4349 8.2248 -3.9193 1.0166 0.9137 0

D =

0 0 0 0 0 0 0
0.2030 1.0150 0 0 0 0 0
0.4230 1.1000 0.2125 0 0 0 0
0.6840 1.3050 0.5125 0.5000 0 0 0
1.0300 1.7300 1.0625 0.9167 0.5208 0 0
1.5570 2.6350 2.2625 2.0000 1.3542 0.8333 0
2.5720 5.0750 6.1000 6.3958 5.4948 4.1406 2.7561

x = [0 0.2 0.4 0.6 0.8 1 1.2]; y = [0 0.203 0.423 0.684 1.030 1.557
2.572];
[C,D] = newpoly(X,Y)

xx = -2:0.1:6;
yy =
C(7)+C(6)*xx+C(5)*xx.^2+C(4)*xx.^3*+C(3)*xx.^4+C(2)*xx.^5+C(1)*xx.^6;
plot(x,y,'o',xx,yy),title('Polinomio interpolador de Newton')
xlabel('x'), ylabel('y'), grid

C =

0.1917 -3.4000 19.6083 -40.9000 27.5000

D =

3.0000 0 0 0 0
0 -3.0000 0 0 0
5.0000 5.0000 4.0000 0 0
8.0000 1.5000 -1.1667 -1.2917 0
2.0000 -6.0000 -2.5000 -0.3333 0.1917
Polinomio interpolador de Newton
20

-20

-40
y

-60

-80

-100
-2 -1 0 1 2 3 4 5 6
x

%Ejercicio 3
X = [0 1 2 3 4 5 6];
Y = [0 1 8 27 64 125 216];
[C,D] = newpoly(X,Y)

C =

0 0 0 1 0 0 0

D =

0 0 0 0 0 0 0
1 1 0 0 0 0 0
8 7 3 0 0 0 0
27 19 6 1 0 0 0
64 37 9 1 0 0 0
125 61 12 1 0 0 0
216 91 15 1 0 0 0
polinomio interpolador de newton
250

200

150

100
y

50

-50
-2 -1 0 1 2 3 4 5 6
x

%Ejercicio 4
X = [0 0.5 1 1.5 2 3 3.5 4];
Y = [1.9 2.39 2.71 2.98 3.2 3.2 2.98 2.74];
[C,D] = newpoly(X,Y)

C =

Columns 1 through 7

-0.0024 0.0312 -0.1385 0.2115 0.0858 -0.6348 1.2572

Column 8

1.9000

D =

Columns 1 through 7

1.9000 0 0 0 0 0 0
2.3900 0.9800 0 0 0 0 0
2.7100 0.6400 -0.3400 0 0 0 0
2.9800 0.5400 -0.1000 0.1600 0 0 0
3.2000 0.4400 -0.1000 0 -0.0800 0 0
3.2000 0 -0.2933 -0.0967 -0.0387 0.0138 0
2.9800 -0.4400 -0.2933 0 0.0387 0.0258 0.0034
2.7400 -0.4800 -0.0400 0.1267 0.0507 0.0040 -0.0062

Column 8

0
0
0
0
0
0
0
-0.0024

polinomio interpolador de newton


200

-200

-400

-600
y

-800

-1000

-1200

-1400

-1600
-2 -1 0 1 2 3 4 5 6
x
% Ejercicio 5
X = [1 2 3 5 6];
Y = [4.75 4 5.25 19.75 36];
[C,D] = newpoly(X,Y)

C =

0 0.2500 -0.5000 -1.0000 6.0000

D =

4.7500 0 0 0 0
4.0000 -0.7500 0 0 0
5.2500 1.2500 1.0000 0 0
19.7500 7.2500 2.0000 0.2500 0
36.0000 16.2500 3.0000 0.2500 0

polinomio interpolador de newton


40

35

30

25

20
y

15

10

0
-2 -1 0 1 2 3 4 5 6
x

También podría gustarte