You are on page 1of 7

Universidad de las Fuerzas Armadas

ESPE
Departamento de Ciencias Exactas

Area: Ecuaciones Diferenciales Ordinarias

Foro 3 de Metodos Numericos

NRC: 1184

Vinicio Chuqui

5 de agosto de 2017

1
METODOS NUMERICOS

Resolver el siguiente ejercicio

1. Encuentre la forma de la matriz solucion de la siguiente EDO por el metodo de diferencias


finitas, para 8 subintervalos y una aproximacion polinomica de la solucion. Adjunte el
grafico de la aproximacion.
y 00 0,5y 0 = 1 cos2 (x)
y(0) = 0
y(1) = 0,25

Solucion
Tenemos la ecuacion diferencial de la siguiente forma
00 0
y cy = f (x)

donde
y(a) = k1
y(b) = k2
A continuacion discretizamos el intervalo obteniendo:
ba
h=
n
donde n es el numero de subintervalos.

Mediante las formulas de diferencias finitas para y 00 y y 0 tenemos:


yk+1 2yk + yk1
yk00 =
h2
yk+1 yk1
yk0 =
2h
Reemplazamos en la ecuacion diferencial y obtenemos:
yk+1 2yk + yk1 yk+1 yk1
c = f (xk )
h2 2h
Resolviendo
ch
yk+1 2yk + yk1 (yk+1 yk1 ) = h2 f (xk )
2
Tenemos
ch ch
I yk+1 (1 ) 2yk + yk1 (1 + ) = h2 f (xk )
2 2
Para

k=1
ch ch
y2 (1 ) 2y1 + y0 (1 + ) = h2 f (x1 )
2 2

2
METODOS NUMERICOS

k=2
ch ch
y3 (1 ) 2y2 + y1 (1 + ) = h2 f (x2 )
2 2
k=3
ch ch
y4 (1 ) 2y3 + y2 (1 + ) = h2 f (x3 )
2 2
k =n1
ch ch
yn (1 ) 2yn1 + yn2 (1 + ) = h2 f (xn1 )
2 2

Con las ecuaciones anteriores construimos la matriz para el sistema de ecuaciones

Ay = F


ch
2 (1 )
2
0 0 0 0 0
(1 + ch ) ch

2 (1 ) 0 0 0 0
2 2

ch ch


0 (1 + ) 2 (1 ) 0 0 0
A=
2 2
ch ch
0 0 (1 + ) 2 (1 ) 0 0

. 2 2
. .. .. .. .. .. ..
. . . . . . .


ch
0 0 0 0 0 (1 + ) 2
2

y1


y2



y3
y=


y4

..
.
yn1
ch
h2 f (x1 ) k1 (1 + )
2


2

h f (x2 )



F =
h2 f (x3 )




h2 f (x4 )

..
.
ch

2
h f (xn1 ) k2 (1 )
2

3
METODOS NUMERICOS

Resolvemos la ecuacion diferencial

y 00 0,5y 0 = 1 cos2 (x)


y(0) = 0
y(1) = 0,25
Donde tenemos:
y 00 cy 0 = f (x)
entonces:
c = 0,5
a = 0 , k1 = 0
b = 1 , k2 = 0,25

Para 8 subintervalos:
ba 10 1
h= = =
n 8 8
Nuestro intervalo es:
1 1 3 1 5 3 7
I = [0 1]
8 4 8 2 8 4 8
Reemplazamos valores para crear nuestra matriz

ch 0,5(1/8) 31
(1 )=1 =
2 2 32
ch 0,5(1/8) 33
(1 + ) = 1 + =
2 2 32
31
2 0 0 0 0 0
32
33 31
2 0 0 0 0
32 32
33 31
0 2 0 0 0
32 32
33 31

A= 0 0 2 0 0


32 32
33 31
0 0 0 2 0
32 32
33 31
0 0 0 0 2
32 32

33

0 0 0 0 0 2
32

4
METODOS NUMERICOS


y1



y2




y3



y=
y4




y5




y6


y7

1
f (1/8) 0(33/32)
64
1
f (1/4)
64
1
f (3/8)
64
1

F = f (1/2)


64
1
f (5/8)
64
1
f (3/4)
64

1

f (7/8) 0,25(31/32)
64
Resolvemos el sistema de ecuaciones

y1 0,0002428717
31
2 0 0 0 0 0
32
y2

0,0009563862

33 31
2 0 0 0 0

32 32

33 31
y3 0,0020961807

2
0 0 0 0
32 32
33 31


A= 0 0 2 0 0 y4 = 0,0035913882


32 32
33 31
0 0 0 2 0
y5 0,005349044

32 32

33 31

0 0 0 0 2

32 32 y6 0,0072598656


33

0 0 0 0 0 2
32 y7 0,2329824527

Obtenemos:

5
METODOS NUMERICOS


0 0

1/8


0,0168635839


1/4


0,0350658472


3/8


0,0554296875

x=
1/2
y=
0,0792711233


5/8


0,1083579557


3/4


0,14484429518

7/8 0,1911758734
1 0,25

Utilizando la aproximacion polinomial encontramos el polinomio de Lagrange

Polinomio de Lagrange

577,38x8 2237,3x7 +3527,4x6 2910,6x5 +1345,4x4 344,72x3 +44,751x2 2,0894x1

Grafico Polinomio de Lagrange

CODIGO EN OCTAVE
Polinomio de Lagrange

function P=InterLagrange(x,y)
%P=InterLagrange([0 1/8 1/4 3/8 1/2 5/8 3/4 7/8 1],

6
METODOS NUMERICOS

[0 0.0168635839 0.0350658472 0.0554296875


0.0792711233 0.083579557 0.1448429518 0.1911758734 0.25])
n=length(x);
L=zeros(n,n);
for k=1:n
V=1;
for j=1:n
if k~=j
V=conv(V,poly(x(j)))/(x(k)-x(j));
endif
endfor
L(k,:)=V;
endfor
P=y*L
x1=min(x):0.001:max(x);%para graficar
y1=polyval(P,x1);%Usamos el comando polyval, polinomio
plot(x1,y1,b,x,y,or)
P=polyout(P,x);
endfunction

Ejecucion del programa

P = 577.38*x^8 - 2237.3*x^7 + 3527.4*x^6 - 2910.6*x^5 +


1345.4*x^4 - 344.72*x^3 + 44.751*x^2 - 2.0894*x^1 + 0
>>

Referencias
[1] Steven C. Chapra. Metodos Numericos para Ingenieros. McGraw Hill:2006.
[2] J. Mathews, D. Fink. Metodos Numericos con MATLAB. Prentice Hall:1999.

You might also like