Beruflich Dokumente
Kultur Dokumente
NDICE
Introduccin...2
Principios Tericos....3
Material y Mtodos....9
Procedimiento en MATLAB...10
Ejercicio 5.1....10
ODE Lineal13
ODE no Lineal...17
Ejercicio 5.4....22
Mtodo de Euler....31
Ejercicio 5.10..37
Mtodo de Euler........38
Conclusiones....44
Bibliografa..44
1
Ingeniera Qumica
INTRODUCCIN
mejor los fenmenos fsicos. A menudo, estos modelos conducen a una ecuacin que
continen algunas derivadas de una funcin desconocida. Esta ecuacin se denomina una
ecuacin diferencial
las ciencias, vamos a analizar en este apartado una serie de problemas prcticos donde
2
Ingeniera Qumica
INICIAL)
dy
=f (x , y) .
dx
o, en trminos matemticos,
y i+1= yi + h (1)
desde un valor anterior yi a un nuevo valor yi+1 en una distancia h. Esta frmula se
aplica paso a paso para calcular un valor posterior y, por lo tanto, para trazar la
trayectoria de la solucin.
MTODO DE EULER
=f ( x i , y i )
y i+1= yi + f ( xi , y i ) h .. (2)
3
Ingeniera Qumica
h.
intervalo
y 'i=f ( x i , y i ) (3)
Se utiliza para extrapolar linealmente a yi+1:
0
y i+1= yi + f (x i , y i )h (4)
4
Ingeniera Qumica
intervalo:
y 'i+1=f (x i+1 , y 0i+1) (5)
el punto medio:
y 'i+1 /2=f ( x i+1/ 2 , y i +1/ 2) (7)
Que se supone representa una aproximacin vlida de la pendiente
mejorar la solucin.
5
Ingeniera Qumica
y i+1= yi + ( x i , y i , h ) h . (9)
=a 1 k 1+ a2 k 2+ +a n k n (10)
k 1=f ( x i , y i )
k 2=f ( x i+ p 1 h , y i +q11 k 1 h )
k 3 =f ( x i+ p 2 h , y i +q 21 k 1 h+q 22 k 2 h )
.
.
.
.
.
6
Ingeniera Qumica
Donde las p y las q son constantes. Observe que las k son relaciones de recurrencia.
Euler.
Los mtodos RK de segundo orden usan la funcin incremento con dos trminos (n =
diferencial es cuadrtica.
Donde:
K 1=f ( x i , yi ) (11 a)
7
Ingeniera Qumica
orden. El resultado de tal desarrollo genera seis ecuaciones con ocho incgnitas.
Por lo tanto, se deben dar a priori los valores de dos de las incgnitas con la
obtiene es
1
y i+1= yi + ( k 1 +4 k 2 +k 3 ) h(12)
6
Donde
k 1=f ( x i , y i )
1 1
(
k 2=f x i + h , y i+ k 1 h
2 2 )
k 3 =f ( x i+ h , y ik 1 h+2 k 2 h )
k 1=f ( x i , y i )
1 1
( )
k 2=f x i + h , y i+ k 1 h
2 2
1 1
k =f ( x + h , y + k h)
3 i i 2
2 2
8
Ingeniera Qumica
k 4=f ( xi +h , y i +k 3 h )
MATERIAL Y MTODOS
Runge-Kute.
PROCEDIMIENTO EN MATLAB
EJERCICIO 5.1
9
Ingeniera Qumica
hace que el flujo de salida sea una funcin no lineal de la altura. Ambos casos se
Balance de masa:
d V
=F F out
dt
donde:
P = densidad
V = volumen
F = caudal msico
10
Ingeniera Qumica
d Ah
=F F out
dt
dh F Fout
=
dt A
modelo es
dh F C v h
=
dt A
dh F C v h
=
dt A
11
Ingeniera Qumica
Euler.
Comience con una t de 0,5 y de nuevo con t = 0,05 para determinar una
t aceptable.
b. Repita la parte a para el caso no lineal (Fout es proporcional a h1/2
MTODO DE EULER
Para h=0.5
SOLUCIN
12
Ingeniera Qumica
fprintf('\n\t\t\t\t y(1)=?')
fprintf('\n\t\t\t\t h(0)=4')
fprintf('\n\n\t\t\t\t MTODO DE EULER\n')
fprintf('\t\t\t\t-----------------------------')
fprintf('\n\t\t\t\t i t(i) h(i) \n')
fprintf('\t\t\t\t---------------------------\n')
fprintf('\t\t\t\t %2d %5.1f %8.5f\n',i,t(1),h(1))
for i=1:10
h(i+1)=h(i)+r*((Fin-(Cvl*h(i)))/(p*A));
t(i+1)=t(i)+r;
fprintf('\t\t\t\t %2d %5.1f
%8.5f\n',i,t(i+1),h(i+1));
end
fprintf('\t\t\t\t--------------------------------------\n')
plot(t,h,'*-m')
grid on
title('Mtodo de Euler')
xlabel('Tiempo(h)')
ylabel('Masa dentro del Tanque(lb)')
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Autores: Antonio Nieves-Federico Domnguez *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.1 PARTE A *
* Profesor: Dr. Ing. GUILLERMO EVANGELISTA BENITES*
******************************************************
MTODO DE EULER
-----------------------------
i t(i) h(i)
---------------------------
0 0.0 4.00000
1 0.5 4.11318
2 1.0 4.21835
3 1.5 4.31608
4 2.0 4.40690
5 2.5 4.49129
6 3.0 4.56972
7 3.5 4.64260
8 4.0 4.71032
13
Ingeniera Qumica
9 4.5 4.77325
10 5.0 4.83173
--------------------------------------
Para
h=0.05.
SOLUCIN
14
Ingeniera Qumica
fprintf('\t\t\t\t-----------------------------')
fprintf('\n\t\t\t\t i t(i) h(i) \n')
fprintf('\t\t\t\t---------------------------\n')
fprintf('\t\t\t\t %2d %5.1f %8.5f\n',i,t(1),h(1))
for i=1:10
h(i+1)=h(i)+r*((Fin-(Cvl*h(i)))/(p*A));
t(i+1)=t(i)+r;
fprintf('\t\t\t\t %2d %5.1f
%8.5f\n',i,t(i+1),h(i+1));
end
fprintf('\t\t\t\t--------------------------------------\n')
plot(t,h,'*-r')
grid on
title('Mtodo de Euler')
xlabel('Tiempo(h)')
ylabel('Masa dentro del Tanque(lb)')
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.1 PARTE A *
* Profesor: Dr.GUILLERMO EVANGELISTA BENITES*
******************************************************
MTODO DE EULER
-----------------------------
i t(i) h(i)
---------------------------
0 0.0 4.00000
1 0.1 4.01132
2 0.1 4.02256
3 0.2 4.03371
4 0.2 4.04479
5 0.3 4.05579
6 0.3 4.06672
7 0.3 4.07756
8 0.4 4.08833
9 0.4 4.09902
10 0.5 4.10964
---------------------------
15
Ingeniera Qumica
c. Repita la
parte a.
para el
caso no
lineal (
MTODO DE EULER
Para h=0.5
SOLUCIN
16
Ingeniera Qumica
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.1 PARTE B *
* Profesor: Dr. GUILLERMO EVANGELISTA BENITES*
******************************************************
Resuelva el siguiente PVI
dh/dy=(FinCvh)/p*A LINEAL
dh/dy=(FinCvh^0.5)/p*A NO LINEAL
h(0)=4
y(1)=?
MTODO DE EULER
-----------------------------
i t(i) h(i)
---------------------------
0 0.0 4.00000
1 0.5 4.11318
17
Ingeniera Qumica
2 1.0 4.22238
3 1.5 4.32780
4 2.0 4.42961
5 2.5 4.52798
6 3.0 4.62306
7 3.5 4.71500
8 4.0 4.80393
9 4.5 4.88997
10 5.0 4.97325
-------------------------------
18
Ingeniera Qumica
Para h=0.05
SOLUCIN
19
Ingeniera Qumica
h(i+1)=h(i)+r*((Fin-(Cv_nl*((h(i))^0.5)))/(p*A));
t(i+1)=t(i)+r;
fprintf('\t\t\t\t %2d %5.1f
%8.5f\n',i,t(i+1),h(i+1));
end
fprintf('\t\t\t\t--------------------------------------\n')
plot(t,h,'*-r')
grid on
title('Mtodo de Euler')
xlabel('Tiempo(h)')
ylabel('Masa dentro del Tanque(lb)')
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.1 PARTE B *
* Profesor: Dr.GUILLERMO EVANGELISTA BENITES*
******************************************************
Resuelva el siguiente PVI
dh/dy=(FinCvh)/p*A LINEAL
dh/dy=(FinCvh^0.5)/p*A NO LINEAL
h(0)=4
y(1)=?
MTODO DE EULER
-----------------------------
i t(i) h(i)
---------------------------
0 0.0 4.00000
1 0.1 4.01132
2 0.1 4.02260
3 0.2 4.03383
4 0.2 4.04503
20
Ingeniera Qumica
5 0.3 4.05619
6 0.3 4.06731
7 0.3 4.07839
8 0.4 4.08943
9 0.4 4.10044
10 0.5 4.11140
------------------------------
EJERCICIO 5.4
A k2 B
21
Ingeniera Qumica
1 1
k 1=1 min , k 2=0.5 min
C A =1 C B =0 ( gmol/ L )
O O
conjunto de ODEs:
dCA
=k 1 C A + k 2 C B
dt
d CB
=k 1 C Ak 2 C B
dt
Resuelva este sistema ODE-IVP utilizando el mtodo de Euler en Excel con un paso
de tiempo de 0,1 min y repita con un paso de tiempo de 0,01 min. Si se produce una
diferencia significativa (comparar los valores en un momento especfico para ver si son
diferentes), repita con un paso de tiempo de 0,001, etc. hasta que se encuentre un tiempo
grfico.
22
Ingeniera Qumica
MTODO DE EULER
SOLUCIN
23
Ingeniera Qumica
Cb(i+1)=Cb(i)+h*((k1*Ca(i))-(k2*Cb(i)));
t(i+1)=t(i)+h;
fprintf('%3d %5.2f %8.5f %8.5f \n',
i,t(i+1),Ca(i+1),Cb(i+1))
end
fprintf('---------------------------------------------\n')
fprintf('Tamao de paso h= %4.3f \n', h)
fprintf('Valor de Cacalculado= %8.5f \n', Ca(i+1))
fprintf('Valor de Cbcalculado= %7.5f \n', Cb(i+1))
plot(t,Ca,'*-r')
hold on
plot(t,Cb,'<-c')
grid on
title('Mtodo de Euler')
xlabel('Tiempo')
ylabel('Concentracin')
RESULTADO
** MTODO DE EULER
-----------------------------------------------
i t Ca_cal Cb_cal
-----------------------------------------------
0 0.00 1.00000 0.00000
1 0.10 0.90000 0.10000
2 0.20 0.81500 0.18500
3 0.30 0.74275 0.25725
4 0.40 0.68134 0.31866
24
Ingeniera Qumica
25
Ingeniera Qumica
SOLUCIN
26
Ingeniera Qumica
RESULTADO
27
Ingeniera Qumica
28
Ingeniera Qumica
d y1 b
=b1 y 1 1 y 21 y 1 ( 0 )=0.03
dt b2
d y2
=b3 y 1 y2 ( 0 ) =0.0
dt
donde
t= tiempo adimensional, 0 t 1
29
Ingeniera Qumica
b1=13.1
b2=0.94
b3 =1.71
30
Ingeniera Qumica
z(i+1)=z(i)+h*(b3*y(i));
x(i+1)=x(i)+h;
fprintf('%3d %5.2f %8.5f %8.5f \n',
i,x(i+1),y(i+1),z(i+1));
end
fprintf('---------------------------------------\n')
fprintf('Tamao de paso h= %4.3f \n', h)
fprintf('Valor de Ycalculado= %8.5f \n', y(i+1))
fprintf('Valor de Zcalculado= %7.5f \n', z(i+1))
plot(x,y,'*-m')
hold on
plot(x,z,'<-c')
grid on
title('Mtodo de Euler')
xlabel('Tiempo')
ylabel('Concentracin de Penicilina')
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.9 *
* Profesor: Dr.GUILLERMO EVANGELISTA BENITES*
******************************************************
y'= ((b1*y)-((b1/b2)*(y^2))), y(0)= 0.03
z'= (b3*y), z(0) =0.0
** MTODO DE EULER
---------------------------------------
i x Ycal Zcal
---------------------------------------
0 0.00 0.03000 0.00000
1 0.10 0.06805 0.00513
2 0.20 0.15073 0.01677
3 0.30 0.31653 0.04254
31
Ingeniera Qumica
32
Ingeniera Qumica
En todos los casos, experimente con el paso del tiempo para asegurar una solucin
exacta.
SOLUCIN
33
Ingeniera Qumica
L(i+1)=(b3*(y(i)+h));
y(i+1)=y(i)+h*(K(i)+K(i+1))/2;
z(i+1)=z(i)+h*(L(i)+L(i+1))/2;
x(i+1)=x(i)+h;
fprintf('%3d %5.2f %8.5f %8.5f \n',
i,x(i+1),y(i+1),z(i+1));
end
fprintf('---------------------------------------\n')
fprintf('Tamao de paso h= %4.3f \n', h)
fprintf('Valor de Ycalculado= %8.5f \n', y(i+1))
fprintf('Valor de Zcalculado= %7.5f \n', z(i+1))
plot(x,y,'*-m')
hold on
plot(x,z,'<-c')
grid on
title('Mtodo de Runge-Kutta')
xlabel('Tiempo')
ylabel('Concentracin')
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.9 *
* Profesor: Dr.GUILLERMO EVANGELISTA BENITES*
****************************************************** y'= ((b1*y)-
((b1/b2)*(y^2))), y(0)= 0.03
z'= (b3*y), z(0) =0.0
** MTODO DE RUNGE-KUTTA
---------------------------------------
i x Y_cal Z_cal
---------------------------------------
0 0.00 0.03000 0.00000
1 0.10 0.06386 0.01368
2 0.20 0.13766 0.03315
3 0.30 0.28741 0.06524
4 0.40 0.54462 0.12294
5 0.50 0.84053 0.22462
34
Ingeniera Qumica
35
Ingeniera Qumica
ds ksx
=
dt k s+ s
s ( 0 )=s o , x ( 0 )=x 0
dx ksx
=y bx
dt ks + s
Donde
36
Ingeniera Qumica
37
Ingeniera Qumica
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.10 *
* Profesor: Dr.GUILLERMO EVANGELISTA BENITES*
******************************************************
** MTODO DE EULER
---------------------------------------
i A scal xcal
---------------------------------------
0 0.00 1000.00000 100.00000
1 0.10 950.98039 102.35098
2 0.20 900.85900 104.75470
3 0.30 849.61923 107.21193
4 0.40 797.24612 109.72338
5 0.50 743.72703 112.28961
6 0.60 689.05251 114.91104
7 0.70 633.21762 117.58788
8 0.80 576.22381 120.31998
9 0.90 518.08186 123.10676
10 1.00 458.81636 125.94693
---------------------------------------
Tamao de paso h= 0.100
Valor de s calculado= 458.81636
Valor de x calculado= 125.94693
38
Ingeniera Qumica
39
Ingeniera Qumica
40
Ingeniera Qumica
K(i+1)=(-(k*(s(i)+(h))*(x(i)+(h)))/(Ks+(s(i)+(h))));
L(i+1)=(((y*k*(s(i)+(h))*(x(i)+(h)))/(Ks+(s(i)+(h))))-
(b*(x(i)+(h))));
s(i+1)=s(i)+h*(K(i)+K(i+1))/2;
x(i+1)=x(i)+h*(L(i)+L(i+1))/2;
A(i+1)=A(i)+h;
fprintf('%3d %5.2f %8.5f %8.5f \n',
i,A(i+1),s(i+1),x(i+1));
end
fprintf('---------------------------------------\n')
fprintf('Tamao de paso h= %4.3f \n', h)
fprintf('Valor de s calculado= %8.5f \n', s(i+1))
fprintf('Valor de x calculado= %7.5f \n', x(i+1))
plot(A,s,'*-m')
hold on
plot(A,x,'<-c')
grid on
title('Mtodo de Runge-Kutta')
xlabel('Tiempo')
ylabel('Concentracin de Penicilina')
RESULTADO
******************************************************
* Libro: MTODOS NUMRICOS APLICADOS A LA INGENIERA *
* Captulo 5. Ecuaciones Diferenciales Ordinarias *
* Ejercicio 5.10 *
* Profesor: Dr.GUILLERMO EVANGELISTA BENITES*
****************************************************** s'= (-(k*s*x)/
(Ks+s)), s(0)= 1000
x'= (((y*k*s*x)/(Ks+s))-(b*x)), x(0) =100
** MTODO DE RUNGE-KUTTA
---------------------------------------
Iter A scal xcal
---------------------------------------
0 0.00 1000.00000 100.00000
1 0.01 993.87217 100.29389
2 0.03 987.72707 100.58861
3 0.04 981.56467 100.88415
4 0.05 975.38493 101.18053
5 0.06 969.18783 101.47774
6 0.07 962.97332 101.77578
7 0.09 956.74137 102.07465
8 0.10 950.49195 102.37436
9 0.11 944.22503 102.67491
10 0.12 937.94057 102.97630
.
.
.
.
41
Ingeniera Qumica
CONCLUSIONES
Gracias a la literatura revisada se pudo ver que el mejor mtodo con menor
BIBLIOGRAFA
42
Ingeniera Qumica
Mxico: Patria.
Graw Hill.
[3] Nakamura, S. (2013). Mtodos numricos aplicados con software. Espaa: Pearson.
43