Upload
galena-barlow
View
38
Download
1
Embed Size (px)
DESCRIPTION
Ecuaciones Diferenciales Ordinarias. Ecuaciones Diferenciales Ordinarias. Problemas de valor inicial Campo de direcciones Métodos numéricos para el problema de valor inicial Método de Euler Método de Heun Método de Euler modificado Método de Runge-Kutta. Problemas de valor inicial. - PowerPoint PPT Presentation
Citation preview
Ecuaciones Diferenciales Ordinarias
Problemas de valor inicial Campo de direcciones Métodos numéricos para el problema de valor
inicial Método de Euler Método de Heun Método de Euler modificado Método de Runge-Kutta
Problemas de valor inicial
Ecuación diferencial
Condición inicial
Ejemplo: modelo de población de Verhulst
y t f t y t t a b( ) ( , ( )) , [ , ]
y a y( ) 0
y t ay t by t y t y( ) ( ) ( ) , ( )20 0
Campo de direcciones
Curvas solución de una ecuación diferencial
Pendiente de las curvas solución
Campo de direcciones
y y t t a b ( ) , [ , ]
m y t f t y t t a b ( ) ( , ( )) , [ , ]
( , ) ( , ( , )), [ , ], [ , ]t y f t y t a b y c d 1
Campo de direcciones
t=a:h:b; y=c:h:d;
[tt,yy] = meshgrid(t,y);
uno = ones(size(tt));
dy = f(tt,yy);
quiver(tt,yy,uno,dy)
Campo de direcciones
0 0.5 1 1.5 2 2.5 3
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5Ecuación LogísticaEcuación Logística
Métodos numéricos para el P.V.I.
Problema de Valor Inicial
Discretización
Forma integral del problema de valor inicial
y t y t f s y s dst
t
( ) ( ) ( , ( )) 00
y t f t y t t a b y a y( ) ( , ( )), [ , ], ( ) 0
a t t t b
y y t y y t y y tn
n n
0 1
0 0 1 1
( ), ( ), ( )
Métodos numéricos para el P.V.I.
Error local del método iterativo
Error máximo
Convergencia
Método de orden p:
e y y tk k k ( )
E h max ek
k( )
limE hh
0
0( )
E h Mh M constp( ) , .
Método de Euler
Forma integral de la ecuación diferencial
Aproximación (Fórmula de los rectángulos)
Paso fijo
Método de Euler: para k=1,2...,n
y t y t f t y t dtt
t
( ) ( ) ( , ( ))1 00
1
y y t t f t y1 0 1 0 0 0 ( ) ( , )
y y hf t y1 0 0 0 ( , )
y y hf t yk k k k 1 ( , )
Método de Euler
function [t,y]=mieuler(a,b,y0,n)
h=(b-a)/n; t=a:h:b;
y=zeros(size(t)); y(1)=y0;
for k=1:n
y(k+1)=y(k)+h*f(t(k),y(k));
end
Soluciones aproximadas (Euler)
0 0.5 1 1.5 2 2.5 3
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5Ecuación LogísticaEcuación Logística
Método de Heun
Forma integral de la ecuación diferencial
Aproximación (Fórmula de los trapecios)
Aproximación por Euler (predicción)
Método de Heun (correccción)
y t y t f t y t dtt
t
( ) ( ) ( , ( ))1 00
1
f t y dt h f t y f t yt
t
( , ) / ( ( , ) ( , ))0
1
2 0 0 1 1
y y hf t yp1 0 0 0 ( , )
y y h f t y f t yp1 0 0 0 1 12 / ( ( , ) ( , ))
Método de Heun
function [t,y]=heun(a,b,y0,n) h=(b-a)/n; t=a:h:b; y=zeros(size(t)); y(1)=y0; for k=1:n k1=f(t(k),y(k)); ykp=y(k)+h*k1; k2=f(t(k+1),ykp); y(k+1)=y(k)+h/2*(k1+k2); end
Método de Euler modificado
Forma integral de la ecuación diferencial
Aproximación (Fórmula del punto medio)
Aproximación por Euler
Método de Euler modificado
y t y t f t y t dtt
t
( ) ( ) ( , ( ))1 00
1
f t y dt hf t h y t ht
t
( , ) ( / , ( / ))0
1
0 02 2
y t h y y h f t y( / ) / ( , )/0 1 2 0 0 02 2
y y hf t h y1 0 0 1 22 ( / , )/
Método de Euler modificado
function [t,y]=eulermod(a,b,y0,n)
h=(b-a)/n; t=a:h:b;
y=zeros(size(t)); y(1)=y0;
for k=1:n
yk2=y(k)+h/2*f(t(k),y(k));
y(k+1)=y(k)+h*f(t(k)+h/2,yk2));
end
Método de Runge-Kutta
Forma integral de la ecuación diferencial
Aproximación de la integral (Regla de Simpson)
y t y t f t y t dtt
t
( ) ( ) ( , ( ))1 00
1
f t y dt
hf t y f t y f t y
t
t
( , )
( ( , ) ( , ) ( , ))/ /
0
1
640 0 1 2 1 2 1 1
Método de Runge-Kutta (cont.)
Estimaciones previas
Aplicación de la fórmula
y y h k k k k1 0 1 2 3 46 2 2 / ( )
k f t y
k f t h y h k
k f t h y h k
k f t h y hk
1 0 0
2 0 0 1
3 0 0 2
4 0 0 3
2 2
2 2
( , )
( / , / )
( / , / )
( , )
Método de Runge-Kutta
function [t,y]=rungekut(a,b,y0,n) h=(b-a)/n; t=a:h:b; y=zeros(size(t)); y(1)=y0; for k=1:n k1=f(t(k),y(k)); tk2=t(k)+h/2; k2=f(tk2,y(k)+h/2*k1); k3=f(tk2,y(k)+h/2*k2); k4=f(t(k+1),y(k)+h*k3); y(k+1)=y(k)+h/6*(k1+2*k2+2*k3+k4); end
Comparación de métodos
Método Orden delerror
Evaluacionesfuncionales
Euler h 1
Heun h2 2
Eulermodificado
h2 2
Runge-Kutta h4 4