You are on page 1of 89

UniversidadNacionaldeTrujillo

FacultaddeIngenieraQumica
EscueladeIngenieraQumica

EJERCICIOS
TERCER EXAMEN PARCIAL
CURSO

MTODOSNUMRICOS

DOCENTE

Dr.GUILLERMOEVANGELISTABENITES

INTEGRANTES :

CICLO

ALIAGAROJAS,Yolanda
PACHECOMENDOZA,Carlos
PANTARIVERA,Pal
TORRESVELSQUEZ,Andrs
ZAVALETABUSTAMANTE,Franco

VI

Trujillo -

Per

2014

Mtodos Numricos para Ingeniera


Ecuaciones Diferenciales Ordinarias
Ejercicios Propuestos
Antonio Nieves Steven C. Chapra
1) Nieves, A.; Dominguez, Federico. Mtodos Numricos aplicados a la
Ingeniera.4ta Edicin:
Ejercicio 7.29:
Resuelva el siguiente PVI con el mtodo de Runge-Kutta de cuarto orden:
ANTONIO NIEVES

dy
=z
dx
PVI
y ( 0 )=1
y ( 1 )=?

dz
=y
dx
PVI
z ( 0 )=1
z ( 1 )= h=0.1

SOLUCIN EN MATLAB:
-

Cdigo de Programacin:
clc, clear all, close all
format compact
%% INGRESO
syms x y z xp1 xp2 yp1 zp1 yp2 zp2 yp3 zp3
fprintf('\n\n')
f1=input('
Ingrese la funcin dy/dx = ');
f2=input('
Ingrese la funcin dz/dx = ');
x0 = input('
Ingrese el valor inicial de x, x(0)
y0 = input('
Ingrese el valor inicial de y, y(0)
z0 = input('
Ingrese el valor inicial de z, z(0)
xf = input('
Ingrese el valor final de x, x(f) =
h= input('
Ingrese el valor de h, h = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
i=1;
n = (xf - x0)/h;
g1=subs(f1,{x,y,z},{xp1,yp1,zp1});
g2=subs(f2,{x,y,z},{xp1,yp1,zp1});
m1=subs(f1,{x,y,z},{xp1,yp2,zp2});
m2=subs(f2,{x,y,z},{xp1,yp2,zp2});
n1=subs(f1,{x,y,z},{xp2,yp3,zp3});
n2=subs(f2,{x,y,z},{xp2,yp3,zp3});
xp(1) = x0;

= ');
= ');
= ');
');

yp(1) = y0;
zp(1) = z0;
fprintf('\n\t\t\t============================================')
fprintf('\n\t\t\t
MTODO DE RUNGE-KUTTA (4to Orden)')
fprintf('\n\t\t\t============================================')
fprintf('\n\t\t\t
i
x
y
z')
fprintf('\n\t\t\t============================================')
fprintf('\n\t\t\t
%2d
%6.4f
%6.4f
%6.4f\n',i,xp(1),yp(1),zp(1))
while i<=n
x = x0;
y = y0;
z = z0;
ky1=eval(f1);
kz1=eval(f2);
xp1=x0+h/2;
yp1=y0+ky1*h/2;
zp1=z0+kz1*h/2;
ky2=eval(g1);
kz2=eval(g2);
yp2=y0+ky2*h/2;
zp2=z0+kz2*h/2;
ky3=eval(m1);
kz3=eval(m2);
xp2=x0+h;
yp3=y0+ky3*h;
zp3=z0+kz3*h;
ky4=eval(n1);
kz4=eval(n2);
x1 = x0+h;
y1=y0+h*(ky1+2*ky2+2*ky3+ky4)/6;
z1=z0+h*(kz1+2*kz2+2*kz3+kz4)/6;
x0 = x1;
xp(i+1) = x1;
y0 = y1;
yp(i+1) = y1;
z0 = z1;
zp(i+1) = z1;
fprintf('\t\t\t
%2d
%4.4f
%4.4f
%4.4f\n',i+1,x1,y1,z1)
i = i + 1;
end
fprintf('\t\t\t============================================\n')
plot(xp,yp,'r','linewidth',2)
hold on
plot(xp,zp,'--b','linewidth',2)
plot(xp,yp,'ok','linewidth',2)
plot(xp,zp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}y (Roja) & z (Azul)')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}x')
title('\color[rgb]{0 .5 .5}\fontsize{15}MTODO DE RUNGE-KUTTA
(4to Orden)')

SOLUCIN EN EXCEL:

x vs. Y & x vs. Z


1.5
1
0.5

y& z

0.2

0.4

0.6

-0.5
-1
-1.5

Datos de Entrada:

0.8

1.2

Valor inicial de x: C11


Valor inicial de y: R11
Valor inicial de z: S11

Valores predefinidos:
-

Valor de h: Celda J9

Celdas de Clculo (N=Nmero de Fila):


*Nota: N empieza desde fila 13
-

X: CN =C(N-1)+$J$9
Ky1: DN =S(N-1)
Kz1: EN =R(N-1)
Yest1: FN=R(N-1)+0.5*DN*$J$8
Zest1: GN =S(N-1)+0.5*EN*$J$8
Ky2: HN =GN
Kz2: IN =FN
Yest2: JN =R(N-1)+0.5*HN*$J$8
Zest2: KN =S(N-1)+0.5*IN*$J$8
Ky3: LN =KN
Kz3: MN =JN
Yest3: NN =R(N-1)+LN*$J$8
Zest3: ON =S(N-1)+MN*$J$8
Ky4: PN =ON
Kz4: QN =NN
Y: RN =R(N-1)+(1/6)*(DN+2*HN+2*LN+PN)*$J$8
Z: SN =S(N-1)+(1/6)*(EN+2*IN+2*MN+QN)*$J$8

SOLUCIN EN POLYMATH:
-

Ecuaciones de Entrada:
x(0) = 0
x(f) = 1
d(z)/d(x) = y
z(0) = -1
d(y)/d(x) = z
y(0) = 1

Tabla de Resultados:

Grfico:

Ejercicio 7.31:

Resuelva el siguiente PVI con el mtodo de Runge-Kutta de cuarto orden con


h=0.1

d2 y
dy
+ 2 + 2 y =0
2
dx
dx

PVI

y ( 0 )=1

dy
=1
dx x=0
y (1 ) =?

ANLISIS:
-

Sustituyendo:
dy
=w
dx

Tendramos un sistema de ecuaciones de primer orden de la siguiente


manera:
dy
=w
dx
dw
=2 w2 y
dx

Con estas consideraciones, podremos aplicar el mtodo numrico


correspondiente para la resolucin de la ecuacin.

SOLUCIN EN MATLAB:
-

Cdigo de Programacin:
clc, clear all, close all
format compact
%% INGRESO

syms x y w xp1 xp2 yp1 wp1 yp2 wp2 yp3 wp3


fprintf('\n\n')
f1=input('
Ingrese la funcin dy/dx = ');
f2=input('
Ingrese la funcin dw/dx = ');
x0 = input('
Ingrese el valor inicial de x, x(0) = ');
y0 = input('
Ingrese el valor inicial de y, y(0) = ');
w0 = input('
Ingrese el valor inicial de w, w(0) = ');
xf = input('
Ingrese el valor final de x, x(f) = ');
h= input('
Ingrese el valor de h, h = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
i=0;
n = (xf - x0)/h;
g1=subs(f1,{x,y,w},{xp1,yp1,wp1});
g2=subs(f2,{x,y,w},{xp1,yp1,wp1});
m1=subs(f1,{x,y,w},{xp1,yp2,wp2});
m2=subs(f2,{x,y,w},{xp1,yp2,wp2});
n1=subs(f1,{x,y,w},{xp2,yp3,wp3});
n2=subs(f2,{x,y,w},{xp2,yp3,wp3});
xp(1) = x0;
yp(1) = y0;
wp(1) = w0;
fprintf('\n\t\t\t========================================')
fprintf('\n\t\t\t
MTODO DE RUNGE-KUTTA (4to Orden)')
fprintf('\n\t\t\t========================================')
fprintf('\n\t\t\t
i
t
y
w')
fprintf('\n\t\t\t========================================')
fprintf('\n\t\t\t
%2d
%6.4f
%6.4f
%6.4f\n',i,xp(1),yp(1),wp(1))
while i+1<=n
x = x0;
y = y0;
w = w0;
ky1=eval(f1);
kw1=eval(f2);
xp1=x0+h/2;
yp1=y0+ky1*h/2;
wp1=w0+kw1*h/2;
ky2=eval(g1);
kw2=eval(g2);
yp2=y0+ky2*h/2;
wp2=w0+kw2*h/2;
ky3=eval(m1);
kw3=eval(m2);
xp2=x0+h;
yp3=y0+ky3*h;
wp3=w0+kw3*h;
ky4=eval(n1);
kw4=eval(n2);
x1 = x0+h;
y1=y0+h*(ky1+2*ky2+2*ky3+ky4)/6;
w1=w0+h*(kw1+2*kw2+2*kw3+kw4)/6;
x0 = x1;
xp(i+1) = x1;
y0 = y1;
yp(i+1) = y1;
w0 = w1;
wp(i+1) = w1;
fprintf('\t\t\t
%2d
%6.4f
%6.4f
%6.4f\n',i+1,x1,y1,w1)
i = i + 1;
end

fprintf('\t\t\t========================================\n')
fprintf('\n\t\t\tEl valor de y estimado es: %6.4f\n',y1)
plot(xp,yp,'r','linewidth',2)
hold on
plot(xp,yp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}y')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}x')
title('\color[rgb]{0 .5 .5}\fontsize{15}MTODO DE RUNGE-KUTTA
(4to Orden)')

SOLUCIN EN EXCEL:

x vs. Y
1.2
1
0.8

0.6
0.4
0.2
0

0.2

0.4

0.6

Datos de Entrada:
-

Valor inicial de x: C9
Valor inicial de y: R9
Valor inicial de w: S9

Valores predefinidos:
-

Valor de h: Celda J7

0.8

1.2

Celdas de Clculo (N=Nmero de Fila):


*Nota: N empieza desde fila 10
-

X: CN =C(N-1)+J$7
Ky1: DN =S(N-1)
Kw1: EN =-2*S(N-1)-2*R(N-1)
Yest1: FN=R(N-1)+0.5*DN*$J$7
West1: GN =S(N-1)+0.5*EN*$J$7
Ky2: HN =GN
Kw2: IN =-2*GN-2*FN
Yest2: JN =R(N-1)+0.5*HN*$J$7
West2: KN =S(N-1)+0.5*IN*$J$7
Ky3: LN =KN
Kw3: MN =-2*KN-2*JN
Yest3: NN =R(N-1)+LN*$J$7
West3: ON =S(N-1)+MN*$J$7
Ky4: PN =ON
Kw4: QN =-2*ON-2*NN
Y: RN =R(N-1)+(1/6)*(DN+2*HN+2*LN+PN)*$J$7
W: SN =S(N-1)+(1/6)*(EN+2*IN+2*MN+QN)*$J$7

SOLUCIN EN POLYMATH:
-

Ecuaciones de Entrada:
d(y)/d(x) = w
y(0) = 1
d(w)/d(x) = -2 * w - 2 * y
w(0) = -1
x(0) = 0
x(f) = 1

Tabla de Resultados:

Grfico:

Ejercicio 7.32 (Nieves):

Resuelva el siguiente PVI con el mtodo de Runge-Kutta de cuarto orden con:


a) h=0.1
b) h=0.5.

dy
=z
dx
PVI

dz
=125 y20 z
dx
y ( 0 )=0 y ( 1 )= ?
z ( 0 )=1 z ( 1 )= ?

Compare los resultados con la solucin analtica:


1 10 x
y= e
sin 5 x
5
z=e10 x (cos 5 x2 sin 5 x )

SOLUCIN EN MATLAB:
-

Cdigo de Programacin:
clc, clear all, close all
format compact
%% INGRESO
syms x y z xp1 xp2 yp1 zp1 yp2 zp2 yp3 zp3
fprintf('\n\n')
f1=input('
Ingrese la funcin dy/dx = ');
f2=input('
Ingrese la funcin dz/dx = ');
x0 = input('
Ingrese el valor inicial de x, x(0)
y0 = input('
Ingrese el valor inicial de y, y(0)
z0 = input('
Ingrese el valor inicial de z, z(0)
xf = input('
Ingrese el valor final de x, x(f) =
h= input('
Ingrese el valor de h, h = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
i=0;
n = (xf - x0)/h;
g1=subs(f1,{x,y,z},{xp1,yp1,zp1});
g2=subs(f2,{x,y,z},{xp1,yp1,zp1});
m1=subs(f1,{x,y,z},{xp1,yp2,zp2});
m2=subs(f2,{x,y,z},{xp1,yp2,zp2});
n1=subs(f1,{x,y,z},{xp2,yp3,zp3});
n2=subs(f2,{x,y,z},{xp2,yp3,zp3});

= ');
= ');
= ');
');

xp(1) = x0;
yp(1) = y0;
zp(1) = z0;
fprintf('\n\t\t\t===============================================
==')
fprintf('\n\t\t\t
MTODO DE RUNGE-KUTTA (4to Orden)')
fprintf('\n\t\t\t===============================================
==')
fprintf('\n\t\t\t
i
x
y
z')
fprintf('\n\t\t\t===============================================
==')
fprintf('\n\t\t\t
%2d
%6.4e
%6.4e
%6.4e\n',i,xp(1),yp(1),zp(1))
while i+1<=n
x = x0;
y = y0;
z = z0;
ky1=eval(f1);
kz1=eval(f2);
xp1=x0+h/2;
yp1=y0+ky1*h/2;
zp1=z0+kz1*h/2;
ky2=eval(g1);
kz2=eval(g2);
yp2=y0+ky2*h/2;
zp2=z0+kz2*h/2;
ky3=eval(m1);
kz3=eval(m2);
xp2=x0+h;
yp3=y0+ky3*h;
zp3=z0+kz3*h;
ky4=eval(n1);
kz4=eval(n2);
x1 = x0+h;
y1=y0+h*(ky1+2*ky2+2*ky3+ky4)/6;
z1=z0+h*(kz1+2*kz2+2*kz3+kz4)/6;
x0 = x1;
xp(i+2) = x1;
y0 = y1;
yp(i+2) = y1;
z0 = z1;
zp(i+2) = z1;
fprintf('\t\t\t
%2d
%4.4e
%4.4e
%4.4e\n',i+1,x1,y1,z1)
i = i + 1;
end
fprintf('\t\t\t=================================================
\n')
yanalitico=(1/5)*exp(-10*xf)*sin(5*xf);
zanalitico=exp(-10*xf)*(cos(5*xf)-2*sin(5*xf));
errory=abs((yanalitico-y1)*100/yanalitico);
errorz=abs((zanalitico-z1)*100/zanalitico);
fprintf('\n\t\t\tEl valor de y estimado es: %6.4e\n',y1)
fprintf('\n\t\t\tEl valor de y analtico es:
%6.4e\n',yanalitico)
fprintf('\n\t\t\tEl valor de z estimado es: %6.4e\n',z1)
fprintf('\n\t\t\tEl valor de z analtico es:
%6.4e\n',zanalitico)
fprintf('\n\t\t\tEl porcentaje de error para y es:
%6.4f\n',errory)

fprintf('\n\t\t\tEl porcentaje de error para z es:


%6.4f\n',errorz)
plot(xp,yp,'r','linewidth',2)
hold on
plot(xp,zp,'--b','linewidth',2)
plot(xp,yp,'ok','linewidth',2)
plot(xp,zp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}y (Roja) & z (Azul)')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}x')
title('\color[rgb]{0 .5 .5}\fontsize{15}MTODO DE RUNGE-KUTTA
(4to Orden)')
(4to Orden)')

a) h=0.5:

b) h=0.1:

SOLUCIN EN EXCEL:
a) h=0.5:

x vs. y & x vs. z


200
0

0.2

0.4

0.6

-200
-400

y (azul) & z (rojo)

-600
-800
-1000
-1200
-1400

Datos de Entrada:
-

Valor inicial de x: C12


Valor inicial de y: R12
Valor inicial de z: S12

Valores predefinidos:
-

Valor de h: Celda J9

Celdas de Clculo (N=Nmero de Fila):


*Nota: N empieza desde fila 13
-

X: CN =C(N-1)+$J$9
Ky1: DN =S(N-1)
Kz1: EN =-125*R(N-1)-20*S(N-1)

0.8

1.2

Yest1: FN=R(N-1)+0.5*DN*$J$9
Zest1: GN =S(N-1)+0.5*EN*$J$9
Ky2: HN =GN
Kz2: IN =-125*FN-20*GN
Yest2: JN =R(N-1)+0.5*HN*$J$9
Zest2: KN =S(N-1)+0.5*IN*$J$9
Ky3: LN =KN
Kz3: MN =-125*JN-20*KN
Yest3: NN =R(N-1)+LN*$J$9
Zest3: ON =S(N-1)+MN*$J$9
Ky4: PN =ON
Kz4: QN =-125*NN-20*ON
Y: RN =R(N-1)+(1/6)*(DN+2*HN+2*LN+PN)*$J$9
Z: SN =S(N-1)+(1/6)*(EN+2*IN+2*MN+QN)*$J$9

b) h=0.1:

x vs. y & x vs. z


1.2
1
0.8
0.6

y (azul) & z(rojo)


0.4
0.2
0

0.2

0.4

0.6

-0.2

Datos de Entrada:
-

Valor inicial de x: C44


Valor inicial de y: R44
Valor inicial de z: S44

Valores predefinidos:
-

Valor de h: Celda J41

Celdas de Clculo (N=Nmero de Fila):


*Nota: N empieza desde fila 45
-

X: CN =C(N-1)+$J$41
Ky1: DN =S(N-1)
Kz1: EN =-125*R(N-1)-20*S(N-1)
Yest1: FN=R(N-1)+0.5*DN*$J$41
Zest1: GN =S(N-1)+0.5*EN*$J$41
Ky2: HN =GN
Kz2: IN =-125*FN-20*GN
Yest2: JN =R(N-1)+0.5*HN*$J$41
Zest2: KN =S(N-1)+0.5*IN*$J$41
Ky3: LN =KN
Kz3: MN =-125*JN-20*KN
Yest3: NN =R(N-1)+LN*$J$41
Zest3: ON =S(N-1)+MN*$J$41
Ky4: PN =ON
Kz4: QN =-125*NN-20*ON
Y: RN =R(N-1)+(1/6)*(DN+2*HN+2*LN+PN)*$J$41

0.8

1.2

Z: SN =S(N-1)+(1/6)*(EN+2*IN+2*MN+QN)*$J$41

SOLUCIN EN POLYMATH:
-

Ecuaciones de entrada:
x(0) = 0
x(f) = 1
d(z)/d(x) = -125 * y - 20 * z
z(0) = 1
d(y)/d(x) = z
y(0) = 0

Tabla de Resultados:

Grfica:

Discusin:
Como podemos observar, los resultados analticos para el inciso a (h=0.5),
difieren enormemente de los resultados analticos usando el mtodo de RungeKutta de 4to orden (Un error de 1.05x109 % para la variable y y un error de
1.2x109 % para z). Este enorme diferencia responde a un intervalo muy grande
y poco significativo para la resolucin de la ecuacin diferencial (apenas 3
valores generados en tabla). Podemos comprobar esto en el inciso b (h=0.1),
donde un intervalo mayor genera un error menor (24.8 % para la variable y,
mientras que un 29.4% para la variable z). A pesar de ello, el error sigue siendo
muy grande, por lo que necesitaramos emplear un intervalo ms pequeo que
permita obtener un resultado ms exacto. Si empleamos, por ejemplo, h=0.01:

Como podemos observar, el error se redujo considerablemente, prximo a cero


(0.0008% para la variable y, mientras que un 0.0013% para la variable z), con
un total de 100 iteraciones.
Por otro lado, las curvas obtenidas en la grfica son idnticas a las obtenidas
en Polymath. Recordemos que ste ltimo programa nos permite obtener los
datos analticos verdaderos para la solucin de ecuaciones diferenciales
ordinarias.
Ejercicio 7.34 (Nieves):
Considere el siguiente conjunto de reacciones reversibles
k1
A

B
k
k3

Asuma que hay un mol de A solamente al inicio y tome

N A , NB y N C

como las

moles de A, B y C presentes, respectivamente.


Como

la

reaccin

verifica

volumen

proporcionales a las concentraciones.

constante

N A , NB y N C

son

Sean

K1 y K2

las constantes de velocidad de reaccin de derecha a

izquierda de la primera reaccin, respectivamente; igualmente sean

K3 y K4

aplicables a la segunda reaccin.


La velocidad de desaparicin neta de A esta dada por:
dNA
=N A K 1 + N B K 2
dx
Y para B.
dNB
=( K 2+ K 3 ) N B + N A K 1 + N C K 4
dx
Determine

N A , N B y N C , transcurridos 50 minutos del inicio de las reacciones

mediante:
K 1=0.1 min1
K 2=0.01 min1
K 3=0.09 min1
K 4 =0.009 min1

ANLISIS:
-

Como las ecuaciones para la velocidad de desaparicin neta de A y B,


estn dadas, lo que faltara es construir la ecuacin de velocidad de
aparicin de C.
Analizando las ecuaciones de reaccin, obtenemos
dN c
=k 3 N B k 4 N C
dt

Obtenidas las tres funciones (ecuaciones de velocidad), estamos listos


para aplicar el mtodo numrico correspondiente para hallar los valores
de Na, Nb y Nc, transcurridos los 50 minutos.

SOLUCIN EN MATLAB:
-

Cdigo de Programacin:

clc, clear all, close all


format compact
%% INGRESO
disp('PARA LA REACCIN:')
syms t Na Nb Nc tp1 tp2 yp1 zp1 wp1 yp2 zp2 wp2 yp3 zp3 wp3
fprintf('\n\t\t\t
A <----------> B')
fprintf('\n\t\t\t
B <----------> C')
fprintf('\n\n')
f1=input('
Ingrese la velocidad de desaparicin dNa/dt = ');
f2=input('
Ingrese la velocidad de desaparicin dNb/dt = ');
f3=input('
Ingrese la velocidad de aparicin dNc/dt = ');
y0 = input('
Ingrese el nmero de moles iniciales de A = ');
tf = input('
Ingrese el nmero de minutos transcurridos =
');
h= input('
Ingrese el valor de h, h = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
t0=0;
z0=0;
w0=0;
i=0;
n = (tf - t0)/h;
g1=subs(f1,{t,Na,Nb,Nc},{tp1,yp1,zp1,wp1});
g2=subs(f2,{t,Na,Nb,Nc},{tp1,yp1,zp1,wp1});
g3=subs(f3,{t,Na,Nb,Nc},{tp1,yp1,zp1,wp1});
m1=subs(f1,{t,Na,Nb,Nc},{tp1,yp2,zp2,wp2});
m2=subs(f2,{t,Na,Nb,Nc},{tp1,yp2,zp2,wp2});
m3=subs(f3,{t,Na,Nb,Nc},{tp1,yp2,zp2,wp2});
n1=subs(f1,{t,Na,Nb,Nc},{tp2,yp3,zp3,wp3});
n2=subs(f2,{t,Na,Nb,Nc},{tp2,yp3,zp3,wp3});
n3=subs(f3,{t,Na,Nb,Nc},{tp2,yp3,zp3,wp3});
tp(1) = t0;
yp(1) = y0;
zp(1) = z0;
wp(1) = w0;
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\t
MTODO DE RUNGE-KUTTA (4to Orden)')
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\t
i
t
Na
Nb
Nc')
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\t
%2d
%4.4f
%4.4f
%4.4f
%4.4f\n',i,tp(1),yp(1),zp(1),wp(1))
while i+1<=n
t = t0;
Na = y0;
Nb = z0;
Nc = w0;
ky1=eval(f1);
kz1=eval(f2);
kw1=eval(f3);
tp1=t0+h/2;
yp1=y0+ky1*h/2;
zp1=z0+kz1*h/2;
wp1=w0+kw1*h/2;
ky2=eval(g1);
kz2=eval(g2);
kw2=eval(g3);
yp2=y0+ky2*h/2;
zp2=z0+kz2*h/2;

wp2=w0+kw2*h/2;
ky3=eval(m1);
kz3=eval(m2);
kw3=eval(m3);
tp2=t0+h;
yp3=y0+ky3*h;
zp3=z0+kz3*h;
wp3=w0+kw3*h;
ky4=eval(n1);
kz4=eval(n2);
kw4=eval(n3);
t1 = t0+h;
y1=y0+h*(ky1+2*ky2+2*ky3+ky4)/6;
z1=z0+h*(kz1+2*kz2+2*kz3+kz4)/6;
w1=w0+h*(kw1+2*kw2+2*kw3+kw4)/6;
t0 = t1;
tp(i+2) = t1;
y0 = y1;
yp(i+2) = y1;
z0 = z1;
zp(i+2) = z1;
w0 = w1;
wp(i+2) = w1;
fprintf('\t\t\t
%2d
%4.4f
%4.4f
%4.4f
%4.4f\n',i+1,t1,y1,z1,w1)
i = i + 1;
end
fprintf('\t\t\t=================================================
==\n')
fprintf('\n\t\t\tEl nmero de moles de A transcurridos los %4.2f
minutos es: %4.4f\n',tf,y1)
fprintf('\n\t\t\tEl nmero de moles de B transcurridos los %4.2f
minutos es: %4.4f\n',tf,z1)
fprintf('\n\t\t\tEl nmero de moles de C transcurridos los %4.2f
minutos es: %4.4f\n',tf,w1)
plot(tp,yp,'r','linewidth',2)
hold on
plot(tp,zp,'--b','linewidth',2)
plot(tp,wp,':y','linewidth',2)
plot(tp,yp,'ok','linewidth',2)
plot(tp,zp,'ok','linewidth',2)
plot(tp,wp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}A (ROJO) <--> B(AZUL)
<--> C(AMARILLO)')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}MTODO DE RUNGE-KUTTA
(4to Orden)')

SOLUCIN EN EXCEL:

t vs. Na & t vs. Nb & t vs. Nc


1.2
1
0.8

Na (Azul) & Nb (Rojo) & Nc (gris)

0.6
0.4
0.2
0

10

20

30

tiempo (min)

Datos de Entrada:
-

Valor inicial de t: C11


Valor inicial de Na: Y11
Valor inicial de Nb: Z11
Valor inicial de Nc: AA11

Valores predefinidos:
-

Valor de h: Celda J8

Celdas de Clculo (N=Nmero de Fila):


*Nota: N empieza desde fila 12
-

X: CN =C(N-1)+$J$8
Ky1: DN =-0.1*Y(N-1)+0.01*Z(N-1)
Kz1: EN =-(0.01+0.09)*Z(N-1)+0.1*Y(N-1)+0.009*AA(N-1)
Kw1: FN =0.09*Z(N-1)-0.009*AA(N-1)
Yest1: GN =Y(N-1)+0.5*DN*$J$8
Zest1: HN =Z(N-1)+0.5*EN*J$8
West1:IN =AA(N-1)+0.5*FN*J$8
Ky2: JN =-0.1*GN+0.01*HN
Kz2: KN =-(0.01+0.09)*HN+0.1*GN+0.009*IN
Kw2:LN =0.09*HN-0.009*IN
Yest2: MN =Y(N-1)+0.5*JN*J$8
Zest2: NN =Z(N-1)+0.5*KN*J$8
West2:ON =AA(N-1)+0.5*LN*J$8

40

50

60

Ky3: PN =-0.1*MN+0.01*NN
Kz3: QN =-(0.01+0.09)*NN+0.1*MN+0.009*ON
Kw3: RN =0.09*NN-0.009*ON
Yest3: SN =Y(N-1)+PN*J$8
Zest3: TN =Z(N-1)+QN*J$8
West3: UN =AA(N-1)+RN*J$8
Ky4: VN =-0.1*SN+0.01*TN
Kz4: WN =-(0.01+0.09)*TN+0.1*SN+0.009*UN
Kw4: XN =0.09*TN-0.009*UN
Na: YN =Y(N-1)+(1/6)*(DN+2*JN+2*PN+VN)*J$8
Nb: ZN =Z(N-1)+(1/6)*(EN+2*KN+2*QN+WN)*J$8
Nc: AAN =AA(N-1)+(1/6)*(FN+2*LN+2*RN+XN)*J$8

SOLUCIN EN POLYMATH:
-

Ecuaciones de Entrada:
d(Nb)/d(t) = -(k2 + k3) * Nb + k1 * Na + k4 * Nc
Nb(0) = 0
d(Na)/d(t) = -k1 * Na + k2 * Nb
Na(0) = 1
d(Nc)/d(t) = k3 * Nb - k4 * Nc
Nc(0) = 0
k1 = 0.1
k3 = 0.09
k2 = 0.01
t(0) = 0
t(f) = 50
k4 = 0.009

Tabla de Resultados:

Grfico:

Discusin:
Como podemos observar, los resultados obtenidos tanto en Excel y
Matlab son los mismos. stos, a su vez, coinciden con los resultados
analticos obtenidos en Polymath. Adems, la grfica obtenida en los dos
primeros programas tambin coinciden con la grfica de los resultados
analticos obtenidos en Polymath, por lo que los resultados son los
correctos.

2) Chapra, Steven C.; Canale, Raymond P. Mtodos Numricos para


Ingenieros.6ta Edicin:
Ejercicio 28.34 (Chapra):
Se han propuesto las siguientes EDO como modelo de una epidemia:

dS
=aSI
dt
dI
=aSI rt
dt
dR
=rI
dt

Donde S= los individuos susceptibles, I= los infectados, R= los recuperados, a=


la tasa de infeccin y r= la tasa de recuperacin. Una ciudad tiene 10000
habitantes, todos los cuales son suceptibles.
a) Si un solo individuo infectado entra a la ciudad en t= 0, calcule la
progresin de la epidemia hasta que el nmero de individuos infectados
caiga por debajo de 10. Use los siguientes parmetros: a= 0.002/
(persona.semana) y r= 0.15/d. Desarrolle las grficas de serie de tiempo
de todas las variables de estado. Tambin genere una grfica de plano
de frase S vs I vs R.

SOLUCIN EN MATLAB:
-

Cdigo de Programacin:

clc, clear all, close all


format compact
%% INGRESO
syms t S I R tp1 tp2 Sp1 Ip1 Rp1 Sp2 Ip2 Rp2 Sp3 Ip3 Rp3
fprintf('\n\n')
f1=input('
Ingrese la primera ecuacin dS/dt = ');
f2=input('
Ingrese la segunda ecuacin dI/dt = ');
f3=input('
Ingrese la tercera ecuacin dR/dt = ');
S0 = input('
Ingrese el valor inicial de S, S= ');
I0 = input('
Ingrese el valor inicial de I, I= ');

R0 = input('
Ingrese el valor inicial de R, R= ');
h= input('
Ingrese el valor de h, h = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
t0=0;
i=0;
n = (tf - t0)/h;
g1=subs(f1,{t,S,I,R},{tp1,Sp1,Ip1,Rp1});
g2=subs(f2,{t,S,I,R},{tp1,Sp1,Ip1,Rp1});
g3=subs(f3,{t,S,I,R},{tp1,Sp1,Ip1,Rp1});
m1=subs(f1,{t,S,I,R},{tp1,Sp2,Ip2,Rp2});
m2=subs(f2,{t,S,I,R},{tp1,Sp2,Ip2,Rp2});
m3=subs(f3,{t,S,I,R},{tp1,Sp2,Ip2,Rp2});
n1=subs(f1,{t,S,I,R},{tp2,Sp3,Ip3,Rp3});
n2=subs(f2,{t,S,I,R},{tp2,Sp3,Ip3,Rp3});
n3=subs(f3,{t,S,I,R},{tp2,Sp3,Ip3,Rp3});
tp(1) = t0;
Sp(1) = S0;
Ip(1) = I0;
Rp(1) = R0;
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\t
MTODO DE RUNGE-KUTTA (4to Orden)')
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\t
i
t
S
I
R')
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\t
%2d
%1.1i
%1.1i
%1.1i
%1.1i\n',i,tp(1),Sp(1),Ip(1),Rp(1))
I=I0;
while I<10
t = t0;
S = S0;
I = I0;
R = R0;
kS1=eval(f1);
kI1=eval(f2);
kR1=eval(f3);
tp1=t0+h/2;
Sp1=S0+kS1*h/2;
Ip1=I0+kI1*h/2;
Rp1=R0+kR1*h/2;
kS2=eval(g1);
kI2=eval(g2);
kR2=eval(g3);
Sp2=S0+kS2*h/2;
Ip2=I0+kI2*h/2;
Rp2=R0+kR2*h/2;
kS3=eval(m1);
kI3=eval(m2);
kR3=eval(m3);
tp2=t0+h;
Sp3=S0+kS3*h;
Ip3=I0+kI3*h;
Rp3=R0+kR3*h;
kS4=eval(n1);
kI4=eval(n2);
kR4=eval(n3);
t1 = t0+h;
S1=S0+h*(kS1+2*kS2+2*kS3+kS4)/6;
I1=I0+h*(kI1+2*kI2+2*kI3+kI4)/6;

R1=R0+h*(kR1+2*kR2+2*kR3+kR4)/6;
t0 = t1;
tp(i+2) = t1;
S0 = S1;
Sp(i+2) = S1;
I0 = I1;
Ip(i+2) = I1;
R0 = R1;
Rp(i+2) = R1;
fprintf('\t\t\t
%2d
%1.0f
%1.0f
%1.0f
%1.0f\n',i+1,t1,S1,I1,R1)
i = i + 1;
end
while I>=10
t = t0;
S = S0;
I = I0;
R = R0;
kS1=eval(f1);
kI1=eval(f2);
kR1=eval(f3);
tp1=t0+h/2;
Sp1=S0+kS1*h/2;
Ip1=I0+kI1*h/2;
Rp1=R0+kR1*h/2;
kS2=eval(g1);
kI2=eval(g2);
kR2=eval(g3);
Sp2=S0+kS2*h/2;
Ip2=I0+kI2*h/2;
Rp2=R0+kR2*h/2;
kS3=eval(m1);
kI3=eval(m2);
kR3=eval(m3);
tp2=t0+h;
Sp3=S0+kS3*h;
Ip3=I0+kI3*h;
Rp3=R0+kR3*h;
kS4=eval(n1);
kI4=eval(n2);
kR4=eval(n3);
t1 = t0+h;
S1=S0+h*(kS1+2*kS2+2*kS3+kS4)/6;
I1=I0+h*(kI1+2*kI2+2*kI3+kI4)/6;
R1=R0+h*(kR1+2*kR2+2*kR3+kR4)/6;
t0 = t1;
tp(i+2) = t1;
S0 = S1;
Sp(i+2) = S1;
I0 = I1;
Ip(i+2) = I1;
R0 = R1;
Rp(i+2) = R1;
fprintf('\t\t\t
%2d
%1.0f
%1.0f
%1.0f
%1.0f\n',i+1,t1,S1,I1,R1)
i = i + 1;
end
fprintf('\n\t\t\t===============================================
====')
fprintf('\n\t\t\tEl tiempo transcurrido hasta que el nmero de
infectados')

fprintf('\n\t\t\tcaiga a debajo de 10 es: %3.0f dias\n',t1)


plot(tp,Sp,'r','linewidth',2)
hold on
plot(tp,Ip,'--b','linewidth',2)
plot(tp,Rp,':y','linewidth',2)
plot(tp,Sp,'ok','linewidth',2)
plot(tp,Ip,'ok','linewidth',2)
plot(tp,Rp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}S(ROJO)& I(AZUL) &
R(AMARILLO)')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}MTODO DE RUNGE-KUTTA
(4to Orden)')
pause
hold off
plot3(Sp,Ip,Rp,'g','linewidth',2)
hold on
plot3(Sp,Ip,Rp,'ok','linewidth',2)
grid on
xlabel('S');ylabel('I');zlabel('R');
pause

Resultados:

SOLUCIN EN EXCEL

t vs. S & t vs. I & t vs. R


12000
10000
8000

S (AZUL) & I(ROJO) % R(GRIS)

6000
4000
2000
0

10

20

30

t (dias)

Datos de Entrada:
-

Valor inicial de t: C9
Valor inicial de S: Y9
Valor inicial de I: Z9
Valor inicial de R: AA9

Valores predefinidos:
-

Valor de h: Celda K5

Celdas de Clculo (N=Nmero de Fila):


-

t:CN =C(N-1)+$K$5
Ks1: DN =-(0.002/7)*Y(N-1)*Z(N-1)
KI1: EN =(0.002/7)*Y(N-1)*Z(N-1)-0.15*Z(N-1)
KR1: FN =0.15*Z(N-1)
Sest1: GN =Y(N-1)+0.5*DN*$H$3
Iest1: HN =Z(N-1)+0.5*EN*H$3
Rest1:IN =AA(N-1)+0.5*FN*H$3
Ks2: JN =-(0.002/7)*GN*HN
KI2: KN =(0.002/7)*GN*HN-0.15*HN
KR2:LN =0.15*IN
Sest2: MN =Y(N-1)+0.5*JN*H$3
Iest2: NN =Z(N-1)+0.5*KN*H$3
Rest2:ON =AA(N-1)+0.5*LN*H$3
Ks3: PN =-(0.002/7)*MN*NN
KI3: QN =(0.002/7)*M(N)*N(N)-0.15*N(N)

40

50

60

KR3: RN =0.15*O(N)
Sest3: SN =Y(N-1)+PN*H$3
Iest3: TN =Z(N-1)+QN*H$3
Rest3: UN =AA(N-1)+RN*H$3
Ks4: VN =-(0.002/7)*S(N)*T(N)
KI4: WN =(0.002/7)*S(N)*T(N)-0.15*T(N)
KR4: XN =0.15*T(N)
S: YN =Y(N-1)+(1/6)*(DN+2*JN+2*PN+VN)*H$3
I: ZN =Z(N-1)+(1/6)*(EN+2*KN+2*QN+WN)*H$3
R: AAN =AA(N-1)+(1/6)*(FN+2*LN+2*RN+XN)*H$3

SOLUCIN EN POLYMATH:
-

Ecuaciones de Entrada:
d(R)/d(t) = r * I
R(0) = 0
d(I)/d(t) = a * S * I - r * I
I(0) = 1
d(S)/d(t) = -a * S * I
S(0) = 10000
a = 0.002 / 7
r = 0.15
t(0) = 0
t(f) = 51

Tabla de Resultados:

Discusin: Los resultados obtenidos en los dos primeros programas (Matlab y


Excel) son los mismos, por lo que ste constituye el resultado estimado a
travs del mtodo de Runge-Kutta de 4to orden. Si observamos el resultado
analtico en Polymath, para un tiempo que va desde 0 hasta 51 das (de
acuerdo al resultado estimado por el mtodo de Runge-Kutta de 4to orden),
observamos que la cantidad analtica de infectados es 7.977505, lo que da un
error mnimo y despreciable comparado con el estimado a travs de nuestro
mtodo numrico.
Sin embargo, al observar la tabla de iteraciones de Polymath:

Podemos observar que la cantidad de infectados llega a menos de 10 en la


iteracin 97, en el tiempo t=49.71896 das. Sin embargo, ya que la poblacin se
debe medir en cantidades enteras, podramos decir que el nmero cuyo
redondeo da el primer valor menor que 10 es el de la iteracin 98, cuando
t=50.12696 das. Esto quiere decir que la cantidad de infectados baja a menos
de 10 en el transcurso del da 50. ste error en la estimacin se debe al valor
de intervalo tomado (h=1). Si tomramos un valor de h menor, obtendramos un
resultado ms aproximado. No obstante, esto traera un mayor nmero de
iteraciones.

3) Gilat, Amos; Subramanian, Vish. Mtodos Numricos para Ingenieros y


Cientficos.3ra Edicin:
Ejercicio 10.43:
El istopo inestable 135Te (Peso atmico: 135) decae en funcin de:
135

135

135

135

Donde

Xe

Cs

k 1=5.78 x 103 s1 ,
12 1

k 4=1.10 x 10

k1

Te

135

k2

135

k3

k4

Xe

135

Cs

135

Ba

k 2=2.87 x 105 s1 ,

k 3 =2.09 x 105 s1 ,

. La cantidad instantnea de cada elemento se determina a

partir de la solucin del siguiente sistema de EDO:


d (Te)
=k 1 (Te)
dt

d ( Xe)
=k 2 ( I ) k 3 ( Xe)
dt

d (I )
=k 1 ( Te )k 2 (I )
dt

d (Cs)
=k 3 ( Xe )k 4 (Cs)
dt

d (Ba)
=k 4 (Cs)
dt
Utilice las comandos necesarios en MATLAB para encontrar la cantidad de
cada elemento presente en los siguientes tiempos. Plotee los resultados
utilizando grficas semilogartmicas en cada caso:
(a) Un intervalo de 10 segundos para los primeros 5 minutos
(b) Un intervalo de 1000 segundos para las siguientes 9 horas.
Las condiciones iniciales son: (Te) = 6.033 x 10 23, (I) = (Xe) = (Cs) = (Ba) = 0.
SOLUCIN EN MATLAB:
-

Cdigo de Programacin:
clc, clear all, close all
format compact
%% INGRESO

disp('PARA LA REACCIN:')
syms t Te I Xe Cs tp1 tp2 yp1 zp1 wp1 up1 yp2 zp2 wp2 up2 yp3
zp3 wp3 up3
fprintf('\n\t\t\t
Te ----------> I')
fprintf('\n\t\t\t
I ----------> Xe')
fprintf('\n\t\t\t
Xe ----------> Cs')
fprintf('\n\t\t\t
Cs ----------> Ba')
fprintf('\n\n')
k1=input('
Ingrese constante de equilibrio k1 = ');
k2=input('
Ingrese constante de equilibrio k2 = ');
k3=input('
Ingrese constante de equilibrio k3 = ');
k4=input('
Ingrese constante de equilibrio k4 = ');
f1=input('
Ingrese la velocidad de desaparicin dTe/dt = ');
f2=input('
Ingrese la velocidad de desaparicin dI/dt = ');
f3=input('
Ingrese la velocidad de aparicin dXe/dt = ');
f4=input('
Ingrese la velocidad de aparicin dCs/dt = ');
f5=input('
Ingrese la velocidad de aparicin dBa/dt = ');
y0 = input('
Ingrese el nmero de moles iniciales de Te =
');
z0 = input('
Ingrese el nmero de moles iniciales de I = ');
w0 = input('
Ingrese el nmero de moles iniciales de Xe =
');
u0 = input('
Ingrese el nmero de moles iniciales de Cs =
');
v0 = input('
Ingrese el nmero de moles iniciales de Ba =
');
tf1 = input('
Ingrese segundos para el primer intervalo =
');
tf2 = input('
Ingrese segundos para el segundo intervalo =
');
h1= input('
Ingrese el valor de primer intervalo, h1 = ');
h2= input('
Ingrese el valor de segundo intervalo, h2 = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
t0=0;
i=0;
g1=subs(f1,{t,Te,I,Xe,Cs},{tp1,yp1,zp1,wp1,up1});
g2=subs(f2,{t,Te,I,Xe,Cs},{tp1,yp1,zp1,wp1,up1});
g3=subs(f3,{t,Te,I,Xe,Cs},{tp1,yp1,zp1,wp1,up1});
g4=subs(f4,{t,Te,I,Xe,Cs},{tp1,yp1,zp1,wp1,up1});
g5=subs(f5,{t,Te,I,Xe,Cs},{tp1,yp1,zp1,wp1,up1});
m1=subs(f1,{t,Te,I,Xe,Cs},{tp1,yp2,zp2,wp2,up2});
m2=subs(f2,{t,Te,I,Xe,Cs},{tp1,yp2,zp2,wp2,up2});
m3=subs(f3,{t,Te,I,Xe,Cs},{tp1,yp2,zp2,wp2,up2});
m4=subs(f4,{t,Te,I,Xe,Cs},{tp1,yp2,zp2,wp2,up2});
m5=subs(f5,{t,Te,I,Xe,Cs},{tp1,yp2,zp2,wp2,up2});
n1=subs(f1,{t,Te,I,Xe,Cs},{tp2,yp3,zp3,wp3,up3});
n2=subs(f2,{t,Te,I,Xe,Cs},{tp2,yp3,zp3,wp3,up3});
n3=subs(f3,{t,Te,I,Xe,Cs},{tp2,yp3,zp3,wp3,up3});
n4=subs(f4,{t,Te,I,Xe,Cs},{tp2,yp3,zp3,wp3,up3});
n5=subs(f5,{t,Te,I,Xe,Cs},{tp2,yp3,zp3,wp3,up3});
tp(1) = t0;
yp(1) = y0;
zp(1) = z0;
wp(1) = w0;
up(1) = u0;
vp(1) = v0;
fprintf('\n\n')
fprintf('\n\t\t\t===============================================
=================================================')
fprintf('\n\t\t\t
MTODO DE RUNGEKUTTA (4to Orden)')

fprintf('\n\t\t\t===============================================
=================================================')
fprintf('\n\t\t\t
i
t
Te
I
Xe
Cs
Ba')
fprintf('\n\t\t\t===============================================
=================================================')
fprintf('\n\t\t\t
%2d
%4.4e
%4.4e
%4.4e
%4.4e
%4.4e
%4.4e\n',i,tp(1),yp(1),zp(1),wp(1),up(1),vp(1))
t1=0;
while t1<tf1
t = t0;
Te = y0;
I = z0;
Xe = w0;
Cs = u0;
Ba = v0;
ky1=eval(f1);
kz1=eval(f2);
kw1=eval(f3);
ku1=eval(f4);
kv1=eval(f5);
tp1=t0+h1/2;
yp1=y0+ky1*h1/2;
zp1=z0+kz1*h1/2;
wp1=w0+kw1*h1/2;
up1=u0+ku1*h1/2;
vp1=v0+kv1*h1/2;
ky2=eval(g1);
kz2=eval(g2);
kw2=eval(g3);
ku2=eval(g4);
kv2=eval(g5);
yp2=y0+ky2*h1/2;
zp2=z0+kz2*h1/2;
wp2=w0+kw2*h1/2;
up2=u0+ku2*h1/2;
vp2=v0+kv2*h1/2;
ky3=eval(m1);
kz3=eval(m2);
kw3=eval(m3);
ku3=eval(m4);
kv3=eval(m5);
tp2=t0+h1;
yp3=y0+ky3*h1;
zp3=z0+kz3*h1;
wp3=w0+kw3*h1;
up3=u0+ku3*h1;
vp3=v0+kv3*h1;
ky4=eval(n1);
kz4=eval(n2);
kw4=eval(n3);
ku4=eval(n4);
kv4=eval(n5);
t1 = t0+h1;
y1=y0+h1*(ky1+2*ky2+2*ky3+ky4)/6;
z1=z0+h1*(kz1+2*kz2+2*kz3+kz4)/6;
w1=w0+h1*(kw1+2*kw2+2*kw3+kw4)/6;
u1=u0+h1*(ku1+2*ku2+2*ku3+ku4)/6;
v1=v0+h1*(kv1+2*kv2+2*kv3+kv4)/6;
t0 = t1;
tp(i+2) = t1;

y0 = y1;
yp(i+2) = y1;
z0 = z1;
zp(i+2) = z1;
w0 = w1;
wp(i+2) = w1;
u0 = u1;
up(i+2) = u1;
v0 = v1;
vp(i+2) = v1;
fprintf('\t\t\t
%2d
%4.4e
%4.4e
%4.4e
%4.4e
%4.4e
%4.4e\n',i+1,t1,y1,z1,w1,u1,v1)
i = i + 1;
end
while t1>=tf1 && t1<(tf1+tf2)
t = t0;
Te = y0;
I = z0;
Xe = w0;
Cs = u0;
Ba = v0;
ky1=eval(f1);
kz1=eval(f2);
kw1=eval(f3);
ku1=eval(f4);
kv1=eval(f5);
tp1=t0+h2/2;
yp1=y0+ky1*h2/2;
zp1=z0+kz1*h2/2;
wp1=w0+kw1*h2/2;
up1=u0+ku1*h2/2;
vp1=v0+kv1*h2/2;
ky2=eval(g1);
kz2=eval(g2);
kw2=eval(g3);
ku2=eval(g4);
kv2=eval(g5);
yp2=y0+ky2*h2/2;
zp2=z0+kz2*h2/2;
wp2=w0+kw2*h2/2;
up2=u0+ku2*h2/2;
vp2=v0+kv2*h2/2;
ky3=eval(m1);
kz3=eval(m2);
kw3=eval(m3);
ku3=eval(m4);
kv3=eval(m5);
tp2=t0+h2;
yp3=y0+ky3*h2;
zp3=z0+kz3*h2;
wp3=w0+kw3*h2;
up3=u0+ku3*h2;
vp3=v0+kv3*h2;
ky4=eval(n1);
kz4=eval(n2);
kw4=eval(n3);
ku4=eval(n4);
kv4=eval(n5);
t1 = t0+h2;
y1=y0+h2*(ky1+2*ky2+2*ky3+ky4)/6;
z1=z0+h2*(kz1+2*kz2+2*kz3+kz4)/6;

w1=w0+h2*(kw1+2*kw2+2*kw3+kw4)/6;
u1=u0+h2*(ku1+2*ku2+2*ku3+ku4)/6;
v1=v0+h2*(kv1+2*kv2+2*kv3+kv4)/6;
t0 = t1;
tp(i+2) = t1;
y0 = y1;
yp(i+2) = y1;
z0 = z1;
zp(i+2) = z1;
w0 = w1;
wp(i+2) = w1;
u0 = u1;
up(i+2) = u1;
v0 = v1;
vp(i+2) = v1;
fprintf('\t\t\t
%2d
%4.4e
%4.4e
%4.4e
%4.4e
%4.4e
%4.4e\n',i+1,t1,y1,z1,w1,u1,v1)
i = i + 1;
end
fprintf('\t\t\t=================================================
===============================================\n')
fprintf('\n\t\t\tTranscurridos los %4.2f segundos:\n',t1)
fprintf('\n\t\t\tEl nmero de moles de Te es: %4.4e\n',y1)
fprintf('\n\t\t\tEl nmero de moles de I es: %4.4e\n',z1)
fprintf('\n\t\t\tEl nmero de moles de Xe es: %4.4e\n',w1)
fprintf('\n\t\t\tEl nmero de moles de Cs es: %4.4e\n',u1)
fprintf('\n\t\t\tEl nmero de moles de Ba es: %4.4e\n',v1)
plot(tp,yp,'r','linewidth',2)
hold on
plot(tp,yp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Te')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg) vs. N moles
de Te')
pause
hold off
plot(tp,zp,'--b','linewidth',2)
hold on
plot(tp,zp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}I')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg) vs. N moles
de I')
pause
hold off
plot(tp,wp,':y','linewidth',2)
hold on
plot(tp,wp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Xe')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg) vs. N moles
de Xe')
pause
hold off
plot(tp,up,'g','linewidth',2)
hold on
plot(tp,up,'ok','linewidth',2)
grid on

ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Cs')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de Cs')
pause
hold off
plot(tp,vp,'m','linewidth',2)
hold on
plot(tp,vp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Ba')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de Ba')
pause
hold off
semilogy(tp,yp)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Te')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de Te')
pause
semilogy(tp,zp)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}I')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de I')
pause
semilogy(tp,wp)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Xe')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de Xe')
pause
semilogy(tp,up)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Cs')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de Cs')
pause
semilogy(tp,vp)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}Ba')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}Tiempo(seg)
de Ba')

vs. N moles

vs. N moles

vs. N moles

vs. N moles

vs. N moles

vs. N moles

vs. N moles

Resultados:

Grficos:

Grficos semilogartmicos:

SOLUCIN EN EXCEL:

t (seg) vs. N moles de Te


8.00E+69
7.00E+69
6.00E+69
5.00E+69

Te

4.00E+69
3.00E+69
2.00E+69
1.00E+69
0.00E+00

5000

10000

15000

20000

25000

30000

35000

t (seg) vs. N moles de I


12
10
8

6
4
2
0

10

12

t (seg) vs. N moles de Xe


4.00E+067
3.50E+067
3.00E+067
2.50E+067

Xe

2.00E+067
1.50E+067
1.00E+067
5.00E+066
0

5000

10000

15000

20000

25000

30000

35000

25000

30000

35000

t (seg) vs. N moles de Cs


2.00E+064
0

5000

10000

15000

-2.00E+064
-4.00E+064

Cs

-6.00E+064
-8.00E+064
-1.00E+065
-1.20E+065
-1.40E+065

20000

t (seg) vs. N moles de Ba


3.00E+055
2.50E+055
2.00E+055

Ba

1.50E+055
1.00E+055
5.00E+054
0

5000

10000

15000

20000

25000

Datos de Entrada:
-

Valor inicial de t: D8
Valor inicial de Te: AN8
Valor inicial de I: AO8
Valor inicial de Xe: AP8
Valor inicial de Cs: AQ8
Valor inicial de Ba: AR8

Valores predefinidos:
-

Valor de h1: Celda J5


Valor de h2: Celda J6

Celdas de Clculo (N=Nmero de Fila):


*Desde fila 9 hasta fila 38
-

X: DN =C(N-1)+$J$5
Ky1: EN =-0.00578*AN(N-1)
Kz1: FN =0.00578*AN(N-1)-0.0000287*AO(N-1)
Kw1: GN =0.0000287*AO(N-1)-0.0000209*AP(N-1)
Ku1: HN =0.0000209*AP(N-1)-0.0000000000011*AQ(N-1)
Kv1: IN =0.0000000000011*AQ(N-1)
Yest1: JN =AN(N-1)+0.5*EN*$J$5
Zest1: KN =AO(N-1)+0.5*FN*$J$5
West1:LN =AP(N-1)+0.5*GN*$J$5
Uest1: MN =AQ(N-1)+0.5*HN*$J$5
Vest1: NN =AR(N-1)+0.5*IN*$J$5

30000

35000

Ky2: ON =-0.00578*JN
Kz2: PN =0.00578*JN-0.0000287*KN
Kw2:QN =0.0000287*KN-0.0000209*LN
Ku2: RN =0.0000209*LN-0.0000000000011*MN
Kv2: SN =0.0000000000011*MN
Yest2: TN =AN(N-1)+0.5*ON*$J$5
Zest2: UN =AO(N-1)+0.5*PN*$J$5
West2: VN =AP(N-1)+0.5*QN*$J$5
Uest2: WN =AQ(N-1)+0.5*RN*$J$5
Vest2: XN =AR(N-1)+0.5*SN*$J$5
Ky3: YN =-0.00578*TN
Kz3: ZN =0.00578*TN-0.0000287*UN
Kw3: AAN =0.0000287*UN-0.0000209*VN
Ku3: ABN =0.0000209*VN-0.0000000000011*WN
Kv3: ACN =0.0000000000011*WN
Yest3: ADN =AN(N-1)+YN*$J$5
Zest3: AEN =AO(N-1)+ZN*$J$5
West3: AFN =AP(N-1)+AAN*$J$5
Uest3: AGN =AQ(N-1)+ABN*$J$5
Vest3: AHN =AR(N-1)+ACN*$J$5
Ky4: AIN =-0.00578*ADN
Kz4: AJN =0.00578*ADN-0.0000287*AEN
Kw4: AKN =0.0000287*AEN-0.0000209*AFN
Ku4: ALN =0.0000209*AFN-0.0000000000011*AGN
Kv4: AMN =0.0000000000011*AGN
Te: ANN =AN(N-1)+(1/6)*(EN+2*ON+2*YN+AIN)*$J$5
I: AON =AO(N-1)+(1/6)*(FN+2*PN+2*ZN+AJN)*$J$5
Xe: APN =AP(N-1)+(1/6)*(GN+2*QN+2*AAN+AKN)*$J$5
Cs: AQN =AQ(N-1)+(1/6)*(HN+2*RN+2*ABN+ALN)*$J$5
Ba: ARN =AR(N-1)+(1/6)*(IN+2*SN+2*ACN+AMN)*$J$5
** Desde fila 39 hasta fila final

X: DN =C(N-1)+$J$6
Ky1: EN =-0.00578*AN(N-1)
Kz1: FN =0.00578*AN(N-1)-0.0000287*AO(N-1)
Kw1: GN =0.0000287*AO(N-1)-0.0000209*AP(N-1)
Ku1: HN =0.0000209*AP(N-1)-0.0000000000011*AQ(N-1)
Kv1: IN =0.0000000000011*AQ(N-1)
Yest1: JN =AN(N-1)+0.5*EN*$J$6
Zest1: KN =AO(N-1)+0.5*FN*$J$6
West1:LN =AP(N-1)+0.5*GN*$J$6
Uest1: MN =AQ(N-1)+0.5*HN*$J$6
Vest1: NN =AR(N-1)+0.5*IN*$J$6
Ky2: ON =-0.00578*JN
Kz2: PN =0.00578*JN-0.0000287*KN
Kw2:QN =0.0000287*KN-0.0000209*LN
Ku2: RN =0.0000209*LN-0.0000000000011*MN
Kv2: SN =0.0000000000011*MN
Yest2: TN =AN(N-1)+0.5*ON*$J$6

Zest2: UN =AO(N-1)+0.5*PN*$J$6
West2: VN =AP(N-1)+0.5*QN*$J$6
Uest2: WN =AQ(N-1)+0.5*RN*$J$6
Vest2: XN =AR(N-1)+0.5*SN*$J$6
Ky3: YN =-0.00578*TN
Kz3: ZN =0.00578*TN-0.0000287*UN
Kw3: AAN =0.0000287*UN-0.0000209*VN
Ku3: ABN =0.0000209*VN-0.0000000000011*WN
Kv3: ACN =0.0000000000011*WN
Yest3: ADN =AN(N-1)+YN*$J$6
Zest3: AEN =AO(N-1)+ZN*$J$6
West3: AFN =AP(N-1)+AAN*$J$6
Uest3: AGN =AQ(N-1)+ABN*$J$6
Vest3: AHN =AR(N-1)+ACN*$J$6
Ky4: AIN =-0.00578*ADN
Kz4: AJN =0.00578*ADN-0.0000287*AEN
Kw4: AKN =0.0000287*AEN-0.0000209*AFN
Ku4: ALN =0.0000209*AFN-0.0000000000011*AGN
Kv4: AMN =0.0000000000011*AGN
Te: ANN =AN(N-1)+(1/6)*(EN+2*ON+2*YN+AIN)*$J$6
I: AON =AO(N-1)+(1/6)*(FN+2*PN+2*ZN+AJN)*$J$6
Xe: APN =AP(N-1)+(1/6)*(GN+2*QN+2*AAN+AKN)*$J$6
Cs: AQN =AQ(N-1)+(1/6)*(HN+2*RN+2*ABN+ALN)*$J$6
Ba: ARN =AR(N-1)+(1/6)*(IN+2*SN+2*ACN+AMN)*$J$6

Solucin en Polymath:
-

Ecuaciones de Entrada:
d(Te)/d(t) = -k1 * Te
Te(0) = 6.033E23
k4 = 1.10 * 10 ^ -12
k3 = 2.09 * 10 ^ -5
t(0) = 0
t(f) = 32700
k2 = 2.87 * 10 ^ -5
k1 = 5.78 * 10 ^ -3
d(Ba)/d(t) = k4 * Cs
Ba(0) = 0
d(Cs)/d(t) = k3 * Xe - k4 * Cs
Cs(0) = 0
d(Xe)/d(t) = k2 * I - k3 * Xe
Xe(0) = 0
d(I)/d(t) = k1 * Te - k2 * I
I(0) = 0

Tabla de Resultados:

Grfico:

Discusin:
Como podemos observar, los resultados obtenidas con el mtodo de Runge
Kutta de 4to orden se alejan enormemente de los valores analticos reales
(obtenidos con Polymath), adems de ya ser incongruentes de por s (no puede
obtenerse un valor negativo para nmero de moles). Esto se debe al enorme
valor usado para el segundo intervalo (h=1000), el cual provoca un gran error
de estimacin. ste se corrige al usar un valor ms significativo (h menor). Por
ejemplo, para h2=100, obtenemos:

Grficas semilogartmicas:

Como podemos observar, los resultados obtenidos son similares a los


analticos, por lo que el error disminuye hasta hacerse insignificante. Por otra
parte, comparando la forma de las curvas obtenidas con las obtenidas en
Polymath, observamos la similitud de las mismas.
El nico problema
observable es la gran cantidad de iteraciones necesarias (354 iteraciones).

Ejercicio 10.44:
Dos tanques de reas de seccin transversal A 1 y A2 son interconectados por
una tubera de longitud L=1 ft y un rea de seccin transversal de A 0, Si la
altura inicial del fluido en ambos tanques es igual a 10 ft, y una presin de:
P=

P0 0 t <2
0t 2

Si de repente se aplica una fuerza sobre la


superficie del tanque 2, el nivel del fluido del
tanque 1 se desplaza una distancia x
(ignorando friccin), bajo la siguiente EDO no
lineal:
dx
dt

d2 x
+
d t2

[ ( )]
A
1 1
A2
2H

Donde H=10*
A1
=2 ,
A2

[ ( )] [ ( ) ]
A
A
1+ 1 + 1 1
A2
A2

A1
=10.
A0

A
x+ L 1
A0

, g=32.2 ft/s2,

P0
ft 2
=100 2 ,

Use un programa de Matlab para construir una funcin

que solucione x(t) de t=0 a t=60s. Condiciones Iniciales: x(0)=0 ft;


dx
=0(t=o)
dt
ANLISIS:
-

Reemplazando dx/dt:

dx
=w
dt

Sabiendo que
segundo orden:

d 2 x dw
=
d t 2 dt , y despejando en la EDO no lineal de

[ ( )]
1

dw P
=
dt H

A1
A2

2H

Para el caso de

t2 :

dw
=
dt

[ ( )]

A
1 1
A2
2H

SOLUCIN EN MATLAB:
-

Cdigo de Programacin:
clc, clear all, close all
format compact
%% INGRESO
syms t x w tp1 tp2 xp1 wp1 xp2 wp2 xp3 wp3
fprintf('\n\n')
g=32.2;
P0g=100;
A1A2=2;
A1A0=10;
L=1;
H=H=10*(1+A1A2)+(1-(A1A2)^2)*x+L*A1A0;
f1=input('
Ingrese la funcin, dx/dt = ');
f2=input('
Ingrese la funcin para primera condicin, dw/dt
= ');
f3=input('
Ingrese la funcin para segunda condicin, dw/dt
= ');
t0 = input('
Ingrese el valor inicial de t, t(0) = ');
x0 = input('
Ingrese el valor inicial de x, x(0) = ');
w0 = input('
Ingrese el valor inicial de w, w(0) = ');
tf = input('
Ingrese el valor final de t, t(f) = ');
h= input('
Ingrese el valor de h, h = ');
%% MTODO DE RUNGE-KUTTA (4TO ORDEN)
i=0;
n = (tf - t0)/h;
g1=subs(f1,{t,x,w},{tp1,xp1,wp1});
g2=subs(f2,{t,x,w},{tp1,xp1,wp1});
g3=subs(f3,{t,x,w},{tp1,xp1,wp1});
m1=subs(f1,{t,x,w},{tp1,xp2,wp2});
m2=subs(f2,{t,x,w},{tp1,xp2,wp2});

m3=subs(f3,{t,x,w},{tp1,xp2,wp2});
n1=subs(f1,{t,x,w},{tp2,xp3,wp3});
n2=subs(f2,{t,x,w},{tp2,xp3,wp3});
n3=subs(f3,{t,x,w},{tp2,xp3,wp3});
tp(1) = t0;
xp(1) = x0;
wp(1) = w0;
fprintf('\n\t\t\t========================================')
fprintf('\n\t\t\t
MTODO DE RUNGE-KUTTA (4to Orden)')
fprintf('\n\t\t\t========================================')
fprintf('\n\t\t\t
i
t
x
dx/dt')
fprintf('\n\t\t\t========================================')
fprintf('\n\t\t\t
%2d
%6.4f
%6.4f
%6.4f\n',i,tp(1),xp(1),wp(1))
while t0<2-h
t = t0;
x = x0;
w = w0;
kx1=eval(f1);
kw1=eval(f2);
tp1=t0+h/2;
xp1=x0+kx1*h/2;
wp1=w0+kw1*h/2;
kx2=eval(g1);
kw2=eval(g2);
xp2=x0+kx2*h/2;
wp2=w0+kw2*h/2;
kx3=eval(m1);
kw3=eval(m2);
tp2=t0+h;
xp3=x0+kx3*h;
wp3=w0+kw3*h;
kx4=eval(n1);
kw4=eval(n2);
t1 = t0+h;
x1=x0+h*(kx1+2*kx2+2*kx3+kx4)/6;
w1=w0+h*(kw1+2*kw2+2*kw3+kw4)/6;
t0 = t1;
tp(i+2) = t1;
x0 = x1;
xp(i+2) = x1;
w0 = w1;
wp(i+2) = w1;
fprintf('\t\t\t
%2d
%6.4f
%6.4f
%6.4f\n',i+1,t1,x1,w1)
i = i + 1;
end
while t0>=2-h && t0<tf
t = t0;
x = x0;
w = w0;
kx1=eval(f1);
kw1=eval(f3);
tp1=t0+h/2;
xp1=x0+kx1*h/2;
wp1=w0+kw1*h/2;
kx2=eval(g1);
kw2=eval(g3);
xp2=x0+kx2*h/2;
wp2=w0+kw2*h/2;
kx3=eval(m1);

kw3=eval(m3);
tp2=t0+h;
xp3=x0+kx3*h;
wp3=w0+kw3*h;
kx4=eval(n1);
kw4=eval(n3);
t1 = t0+h;
x1=x0+h*(kx1+2*kx2+2*kx3+kx4)/6;
w1=w0+h*(kw1+2*kw2+2*kw3+kw4)/6;
t0 = t1;
tp(i+2) = t1;
x0 = x1;
xp(i+2) = x1;
w0 = w1;
wp(i+2) = w1;
fprintf('\t\t\t
%2d
%6.4f
%6.4f
%6.4f\n',i+1,t1,x1,w1)
i = i + 1;
end
fprintf('\t\t\t========================================\n')
fprintf('\n\t\t\tEl valor estimado para x es: %4.4f ft\n',x1)
plot(tp,xp,'r','linewidth',2)
hold on
plot(tp,wp,'b','linewidth',2)
plot(tp,xp,'ok','linewidth',2)
plot(tp,wp,'ok','linewidth',2)
grid on
ylabel('\color[rgb]{0 .5 .5}\fontsize{13}x(ROJO) & w(AZUL)')
xlabel('\color[rgb]{0 .5 .5}\fontsize{13}t')
title('\color[rgb]{0 .5 .5}\fontsize{15}MTODO DE RUNGE-KUTTA
(4to Orden)')

Resultados:

.
.
.
.

SOLUCIN EN EXCEL:

.
.
.

t vs. X & t vs. W


4
3
2
1

x (AZUL) & w (ROJO)

10

20

30

-1
-2
-3
-4

t (seg)

Datos de Entrada:
-

Valor inicial de t: D9

40

50

60

70

Valor inicial de x: S9
Valor inicial de w: T9

Valores predefinidos:
-

Valor de h: Celda J6

Celdas de Clculo (N=Nmero de Fila):


*Nota: Desde fila 9 hasta fila 27
-

X: DN =D(N-1)+J$6
Kx1: EN =T(N-1)
Kw1: FN =(100/(40-3*S(N-1)))+(3/(2*(40-3*S8)))*T(N-1)^2-(96.6/(403*S(N-1)))*S(N-1)
Xest1: GN=S(N-1)+0.5*EN*$J$6
West1: HN =T(N-1)+0.5*FN*$J$6
Kx2: IN =HN
Kw2:
JN
=(100/(40-3*GN))+(3/(2*(40-3*GN)))*HN^2-(96.6/(403*GN))*GN
Xest2: KN =S(N-1)+0.5*IN*$J$6
West2: LN =T(N-1)+0.5*JN*$J$6
Kx3: MN =LN
Kw3: NN =(100/(40-3*KN))+(3/(2*(40-3*KN)))*LN^2-(96.6/(40-3*KN))*
KN
Xest3: ON =S(N-1)+MN*$J$6
West3: PN =T(N-1)+NN*$J$6
Kx4: QN =PN
Kw4:
RN
=(100/(40-3*ON))+(3/(2*(40-3*ON)))*PN^2-(96.6/(403*ON))*ON
X: SN =S(N-1)+(1/6)*(EN+2*IN+2*MN+QN)*$J$6
W: TN=T(N-1) )+(1/6)*(FN+2*JN+2*NN+RN)*$J$6
**Desde fila 28 hasta el final:

X: DN =D(N-1)+J$6
Kx1: EN =T(N-1)
Kw1: FN =(3/(2*(40-3*S8)))*T(N-1)^2-(96.6/(40-3*S(N-1)))*S(N-1)
Xest1: GN=S(N-1)+0.5*EN*$J$6
West1: HN =T(N-1)+0.5*FN*$J$6
Kx2: IN =HN
Kw2: JN =(3/(2*(40-3*GN)))*HN^2-(96.6/(40-3*GN))*GN
Xest2: KN =S(N-1)+0.5*IN*$J$6
West2: LN =T(N-1)+0.5*JN*$J$6
Kx3: MN =LN
Kw3: NN =(3/(2*(40-3*KN)))*LN^2-(96.6/(40-3*KN))* KN
Xest3: ON =S(N-1)+MN*$J$6
West3: PN =T(N-1)+NN*$J$6
Kx4: QN =PN

Kw4: RN =(3/(2*(40-3*ON)))*PN^2-(96.6/(40-3*ON))*ON
X: SN =S(N-1)+(1/6)*(EN+2*IN+2*MN+QN)*$J$6
W: TN=T(N-1) )+(1/6)*(FN+2*JN+2*NN+RN)*$J$6

SOLUCIN EN POLYMATH:
a) Para t<2s:
-

Ecuaciones de Entrada:
d(x)/d(t) = w
x(0) = 0
d(w)/d(t) = 100 / H - (-3 / (2 * H)) * w ^ 2 - 32.2 * (3 / H) * x
w(0) = 0
H = 10 * (1 + 2) + (1 - 2 ^ 2) * x + 1 * 10
t(0) = 0
t(f) = 1.9

Tabla de Resultados:

Grfico:

b) Para t 2s:
-

Ecuaciones de Entrada:
d(x)/d(t) = w
x(0) = 2.067948
d(w)/d(t) = (3 / (2 * H)) * (w ^ 2) - (96.6 / H) * x
w(0) = 0.1202163
H = 10 * (1 + 2) + (1 - 2 ^ 2) * x + 1 * 10
t(0) = 1.9
t(f) = 60

Tabla de Resultados:

Grfico:

Discusin:
Como podemos observar, los resultados estimados por el mtodo de RungeKutta de 4to orden para los dos primeros programas (Matlab y Excel) son
similares, por lo que ste constituye el valor verdadero estimado a travs de
este mtodo numrico. Al comparar estos valores con el analtico, obtenido a
travs de Polymath, observamos que existe un error mnimo y despreciable,
por lo que el valor es aceptado. Adems, el comportamiento de las curvas en
las grficas son casi las mismas.
Sin embargo, podemos observar que el valor de x es de signo negativo. Esto
se puede explicar debido a que durante los dos primeros segundos, la presin
ejercida provocar un aumento del nivel de lquido en el tanque 1. No obstante,
al llegar a los dos segundos, dicha presin desaparece, por lo que la altura
descender y subir repetitivamente hasta buscar su estabilizacin. En el
tiempo t=60 s, el nivel del lquido desciende 1.63 ft.

You might also like