You are on page 1of 31

UNIVERSIDAD NACIONAL DE TRUJILLO

Facultad de Ingeniera Qumica


Escuela de Ingeniera Qumica

Integrantes:

Bracamonte Len, Rosmery


Campos Dvila, Gabriela
Florin Domnguez, Kiara
Varas Gamboa, Ingrid Pamela

Tema:

Ecuaciones Diferenciales
Ordinarias

Libro:

Nieves Domnguez

Fecha:

27/11/214

2014

UNIVERSIDAD NACIONAL DE TRUJILLO

CONTENIDO
EJERCICIO 7.5

..PGINA

610
EJERCICIO 7.6

......PGINA

610
PROBLEMA

7.7

.....PGINA

610
PROBLEMA 7.8 .....PGINA 610
PROBLEMA 6.49

PGINA

530

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

PROBLEMA 7.5
Se hace llegar un gasto de alimentacin de 7 L/s al tanque de la figura, cuando la altura de un
fluido en l es de 5 m. Treinta minutos despus, este gasto es interrumpido por falla de la
bomba, que se repara y arranca una hora despus. Determine el gasto necesario para que el
nivel se recupere y se mantenga en 5 m. As como el tiempo necesario para alcanzar este nivel
(rgimen permanente). El flujo de salida es de 3.457 L/s ininterrumpidamente.

Solucin

1. Hacemos un balance:
Acumulacin= Flujo de Entrada Flujo de Salida

2. Hallar

a partir de v (volumen del tanque)

2.1. De la figura 7.29 hallamos la relacin de r y a

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


2.2. Reemplazamos el valor de r

2.3. Luego derivamos con respecto a t


*

3. Hallar

(flujo de entrada)

3.1. Dato del problema: gasto de alimentacin 7L/s


[ ]
3.2. Necesitamos el valor en (m3/min)

4. Hallar

) (

(flujo de salida)

4.1. Dato del problema: flujo de salida 3.457 L/s


[ ]
4.2. Necesitamos el valor en (m3/min)
(

) (

5. Reemplazamos los valores encontrados en la primera ecuacin:

Acumulacin= Flujo de Entrada Flujo de Salida

5.1.

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


5.2. Pero queremos

5.3. Entonces
(

)*

) (

5.4. Despejamos
)*

6. Despus de 30 minutos ya no hay flujo de alimentacin; por lo tanto la ecuacin de


acumulacin quedara de esta forma:

Acumulacin= Flujo de Entrada Flujo de Salida


(

) (

)*

6.1. Tomamos el tiempo de nuevo y sabemos que a t(0), a=4.934627


6.2. El equipo deja de funcionar 1 hora entonces hallamos la acumulacin
t(60); a= 2.9129 m
6.3. El tiempo encontrado para que el nivel del fluido del tanque regrese a
5.00 m es t= 3834.386 min

Hallamos en Gasto Necesario y el Tiempo en MATLAB


-METODO DE RUNGE-KUTTA 4to ORDEN-

EN EL EDITOR
(1)
%UNIVERSIDAD NACIONAL DE TRUJILLO
%FACULTAD DE INGENIERA QUMICA
%MTODOS NUMRICOS
%BRACAMONTE,CAMPOS,FLORIN,VARAS

Mtodos Numricos

en

UNIVERSIDAD NACIONAL DE TRUJILLO


%EJERCICIO #7.5- NIEVES- parte 1
function f
clc, clear all
%dy/dx=da/dt
syms x y
fprintf('\n \tRESOLUCION DE ECUACIONES DIFERENCIALES \n')
fprintf('\n \tPOR MEDIO RUNGE-KUTTA DE ORDEN 4\n')
fprintf('\n \tProblema 7.5\n')
f=(0.42-0.2074*y^0.5)*(4/(3.1416*y^2)); %funcin para la acumulacin
x0=0; % t=0
x1=30; %t= min
y0=5; %h=m
n=10;
h=(x1-x0)/n; %tamao del paso
xs=x0:h:x1;
disp('Resultados:')
fprintf(' \n');
fprintf('------------------------\n')
fprintf('it
t(0)
a(t) \n');
fprintf('------------------------\n')
for i=1:n
it=i-1;
x0=xs(i);
x=x0;
y=y0;
k1=h*eval(f);
x=x0+h/2;
y=y0+k1/2;
k2=h*eval(f);
x=x0+h/2;
y=y0+k2/2;
k3=h*eval(f);
x=x0+h;
y=y0+k3;
k4=h*eval(f);
y0=y0+(k1+2*k2+2*k3+k4)/6;
fprintf('\n%d %12.2f%10.4f\n',it,x0,y0);
end
fprintf('------------------------\n')
fprintf('\n');
fprintf('\n El punto aproximado a(m) es = %8.4f m\n',y0);

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

(2)
%UNIVERSIDAD NACIONAL DE TRUJILLO
%FACULTAD DE INGENIERA QUMICA
%MTODOS NUMRICOS
%BRACAMONTE,CAMPOS,FLORIN,VARAS
%EJERCICIO #7.5- NIEVES- parte 2
function f
clc, clear all
%dy/dx=da/dt
syms x y
fprintf('\n \tRESOLUCION DE ECUACIONES DIFERENCIALES \n')
fprintf('\n \tPOR MEDIO RUNGE-KUTTA DE ORDEN 4\n')
fprintf('\n \tProblema 7.5\n')
f=(-0.2074*y^0.5)*(4/(3.1416*y^2));
x0=30; % t=0
x1=90; %t= min
y0=4.9346; %h=m
n=10;
h=(x1-x0)/n;
xs=x0:h:x1;
disp('Resultados:')
fprintf(' \n');
fprintf('------------------------\n')
fprintf('it
t(0)
a(t) \n');

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


fprintf('------------------------\n')
for i=1:n
it=i-1;
x0=xs(i);
x=x0;
y=y0;
k1=h*eval(f);
x=x0+h/2;
y=y0+k1/2;
k2=h*eval(f);
x=x0+h/2;
y=y0+k2/2;
k3=h*eval(f);
x=x0+h;
y=y0+k3;
k4=h*eval(f);
y0=y0+(k1+2*k2+2*k3+k4)/6;
fprintf('\n%d %12.2f%10.4f\n',it,x0,y0);
end
fprintf('------------------------\n')
fprintf('\n');
fprintf('\n El punto aproximado a(m) es = %8.4f m\n',y0);
end

(3)
%UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


%FACULTAD DE INGENIERA QUMICA
%MTODOS NUMRICOS
%BRACAMONTE,CAMPOS,FLORIN,VARAS
%EJERCICIO #7.5- NIEVES- parte 3
function f
clc, clear all
%dy/dx=da/dt
syms x y
fprintf('\n \tRESOLUCION DE ECUACIONES DIFERENCIALES \n')
fprintf('\n \tPOR MEDIO RUNGE-KUTTA DE ORDEN 4\n')
fprintf('\n \tProblema 7.5\n')
f=(0.42-0.2074*y^0.5)*(4/(3.1416*y^2));
x0=90; % t=0
x1=7630.83; %t= min
y0=2.9129; %h=m
n=10;
h=(x1-x0)/n;
xs=x0:h:x1;
disp('Resultados:')
fprintf(' \n');
fprintf('------------------------\n')
fprintf('it
t(0)
a(t) \n');
fprintf('------------------------\n')
for i=1:n
it=i-1;
x0=xs(i);
x=x0;
y=y0;
k1=h*eval(f);
x=x0+h/2;
y=y0+k1/2;
k2=h*eval(f);
x=x0+h/2;
y=y0+k2/2;
k3=h*eval(f);
x=x0+h;
y=y0+k3;
k4=h*eval(f);
y0=y0+(k1+2*k2+2*k3+k4)/6;
fprintf('\n%d %12.2f%10.4f\n',it,x0,y0);
end
fprintf('------------------------\n')
fprintf('\n');
fprintf('\n El punto aproximado a(m) es = %8.4f m\n',y0);
tiempo=7630.83;
G00=(0.42)*tiempo;
fprintf('\n El gasto necesario es = %8.4f L\n',G00);
tiempohoras=(tiempo/60);
fprintf('\n El tiempo necesario(rgimen permanente). = %8.4f
min\n',tiempo);
fprintf('\n El tiempo necesario(rgimen permanente). = %8.4f
horas\n',tiempohoras);
format short
ezplot(f),grid on,axis([0 0.15 -1000 1000])
line([-1000,0;1000,0],[0,-10;0,10000],'color','r')
end

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

7. Resultados (1)- tomando desde t (0) hasta t (30)


RESOLUCION DE ECUACIONES DIFERENCIALES

POR MEDIO RUNGE-KUTTA DE ORDEN 4

Problema 7.5

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


Resultados:
-----------------------it

t(0)

a(t)

-----------------------0

0.00 4.9933

3.00 4.9867

6.00 4.9801

9.00 4.9735

12.00 4.9669

15.00 4.9604

18.00 4.9539

21.00 4.9475

24.00 4.9410

27.00 4.9346

-----------------------El punto aproximado a(m) es = 4.9346 m


>>

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

8. Resultados (2)- tomando desde el t (30) hasta t (60) cuando se para la bomba
Problema 7.5
Resultados:
-----------------------it t(0) a(t)
-----------------------0
30.00 4.7868
1
36.00 4.6317
2
42.00 4.4685
3
48.00 4.2958
4
54.00 4.1120
5
60.00 3.9149
6
66.00 3.7017
7
72.00 3.4684
8
78.00 3.2087
9
84.00 2.9129
-----------------------El punto aproximado a(m) es = 2.9129 m

9. Resultados (3)- hallamos el tiempo y el gasto necesario para recuperar nivel de tanque

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


RESOLUCION DE ECUACIONES DIFERENCIALES
POR MEDIO RUNGE-KUTTA DE ORDEN 4
Problema 7.5
Resultados:
-----------------------it t(0) a(t)
-----------------------0
90.00 20.8184
1
844.08 19.6144
2 1598.17 18.3250
3 2352.25 16.9324
4 3106.33 15.4128
5 3860.42 13.7326
6 4614.50 11.8452
7 5368.58 9.6906
8 6122.66 7.2488
9 6876.75 5.0000
-----------------------El punto aproximado a(m) es = 5.0000 m
El gasto necesario es = 3204.9486 L
El tiempo necesario(rgimen permanente). = 7630.8300 min
El tiempo necesario(rgimen permanente). = 127.1805 horas
>>

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

10. Grfica de la Funcin

PROBLEMA 7.6.
La aplicacin de las leyes de Kirchhoff en un circuito cerrado da lugar a sistemas de ecuaciones
diferenciales del tipo

Se tienen las siguientes condiciones iniciales:


( )

Calcule

( )e

( )

( ) con pasos de tiempo 0.05, 0.1, 0.5 y 1.0

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

SOLUCIN MATEMTICA:
k1
k2
k3
k4

=
=
=
=

fI1(t(i),I1(i),I2(i));
fI1(t(i)+h/2,I1(i)+h*k1/2,I2(i)+h*c1/2);
fI1(t(i)+h/2,I1(i)+h*k2/2,I2(i)+h*c2/2);
fI1(t(i) + h,I1(i)+h*k3,I2(i)+h*c3);

Los valores de t e

iniciales son to=0 e I1o = 0

(1)
Evaluamos k1, k2, k3, k4 con el mtodo de Runge-kutta de cuarto orden:
k1
k2
k3
k4

=
=
=
=

fI1(t(i),I1(i),I2(i));
fI1(t(i)+h/2,I1(i)+h*k1/2,I2(i)+h*c1/2);
fI1(t(i)+h/2,I1(i)+h*k2/2,I2(i)+h*c2/2);
fI1(t(i) + h,I1(i)+h*k3,I2(i)+h*c3);

Los valores de t e

iniciales son to=0 e I2o = 0

(2)
Evaluamos c1, c2, c3, c4 con el mtodo de Runge-kutta de cuarto orden:

c1
c2
c3
c4

=
=
=
=

fI2(t(i),I1(i),I2(i));
fI2(t(i)+h/2,I1(i)+h*k1/2,I2(i)+h*c1/2);
fI2(t(i)+h/2,I1(i)+h*k2/2,I2(i)+h*c2/2);
fI2(t(i)+h,I1(i)+h*k3,I2(i)+h*c3);

CDIGO EN MATLAB

Mtodo Runge-kutta (en function):

function [t,I1,I2] = edork4(t0,tf,I1o,I2o,h)


%
% MTODO DE RUNGE KUTTA 4TO ORDEN
t(1) = t0;

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


I1(1) = I1o;
I2(1) = I2o;
i = 1;
while t(i)<tf
t(i+1) = t0 + i*h;
% Sucesin de aproximaciones siguientes
k1 = fI1(t(i),I1(i),I2(i));
c1 = fI2(t(i),I1(i),I2(i));
k2 = fI1(t(i)+h/2,I1(i)+h*k1/2,I2(i)+h*c1/2);
c2 = fI2(t(i)+h/2,I1(i)+h*k1/2,I2(i)+h*c1/2);
k3 = fI1(t(i)+h/2,I1(i)+h*k2/2,I2(i)+h*c2/2);
c3 = fI2(t(i)+h/2,I1(i)+h*k2/2,I2(i)+h*c2/2);
k4 = fI1(t(i)+h,I1(i)+h*k3,I2(i)+h*c3);
c4 = fI2(t(i)+h,I1(i)+h*k3,I2(i)+h*c3);
I1(i+1)= I1(i)+h*(k1+2*k2+2*k3+k4)/6;
I2(i+1)= I2(i)+h*(c1+2*c2+2*c3+c4)/6;
i = i + 1;
end

Funcin 1 (en function):


function fI1 = fI1(t,I1,I2)

fI1 = -4*I1 + 3*I2 + 6;


end

Funcin 2 (en function):


function fI2 = fI2(t,I1,I2)

fI2 = -2.4*I1 + 1.6*I2 + 3.6;


end

Programa (en script) :

clc, clear all, close all, clf


to = 0;
tf = 3;
I1o = 0;
I2o = 0;
%% MTODO DE RUNGE KUTTA 4TO ORDEN
h = 0.05;

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


[t,I1,I2] = edork4(to,tf,I1o,I2o,h);
l1 = length(I1);
fprintf('\n
Mtodo RK 4to Orden')
fprintf('\n ----------------------------------------------')
fprintf('\n
iter.
t
I1
I2')
fprintf('\n ----------------------------------------------\n')
for j = 1:l1
fprintf('
%d
%.2f
%.4f
%.4f
\n',j,t(j),I1(j),I2(j))
end
fprintf(' ------------------------------------------------\n')
fprintf('Nmero de iteraciones: %d para h = %.4f \n',l1,h)
fprintf('Valor calculado de I1 = %.2f e I2 = %.2f\n\n',I1(l1),I2(l1))
subplot(2,2,1); plot(t,I1,t,I2)
xlabel('tiempo'), ylabel('Corriente'), title('MTODO RUNGE KUTTA 4TO
ORDEN con paso h = 0.05')
legend('I1','I2')
grid on
%% MTODO DE RUNGE KUTTA 4TO ORDEN
h = 0.1;
[t,I1,I2] = edork4(to,tf,I1o,I2o,h);
l1 = length(I1);
fprintf('\n
Mtodo RK 4to Orden')
fprintf('\n ----------------------------------------------')
fprintf('\n
iter.
t
I1
I2')
fprintf('\n ----------------------------------------------\n')
for j = 1:l1
fprintf('
%d
%.2f
%.4f
%.4f
\n',j,t(j),I1(j),I2(j))
end
fprintf(' ------------------------------------------------\n')
fprintf('Nmero de iteraciones: %d para h = %.4f \n',l1,h)
fprintf('Valor calculado de I1 = %.2f e I2 = %.2f\n\n',I1(l1),I2(l1))
subplot(2,2,2); plot(t,I1,t,I2)
xlabel('tiempo'), ylabel('Corriente'), title('MTODO RUNGE KUTTA 4TO
ORDEN con paso h = 0.1')
legend('I1','I2')
grid on
%% MTODO DE RUNGE KUTTA 4TO ORDEN
h = 0.5;
[t,I1,I2] = edork4(to,tf,I1o,I2o,h);
l1 = length(I1);
fprintf('\n
Mtodo RK 4to Orden')
fprintf('\n ----------------------------------------------')
fprintf('\n
iter.
t
I1
I2')
fprintf('\n ----------------------------------------------\n')
for j = 1:l1
fprintf('
%d
%.2f
%.4f
%.4f
\n',j,t(j),I1(j),I2(j))
end
fprintf(' ------------------------------------------------\n')
fprintf('Nmero de iteraciones: %d para h = %.4f \n',l1,h)
fprintf('Valor calculado de I1 = %.2f e I2 = %.2f\n\n',I1(l1),I2(l1))
subplot(2,2,3); plot(t,I1,t,I2)
xlabel('tiempo'), ylabel('Corriente'), title('MTODO RUNGE KUTTA 4TO
ORDEN con paso h = 0.5')
legend('I1','I2')
grid on
%% MTODO DE RUNGE KUTTA 4TO ORDEN

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


h = 1;
[t,I1,I2] = edork4(to,tf,I1o,I2o,h);
l1 = length(I1);
fprintf('\n
Mtodo RK 4to Orden')
fprintf('\n ----------------------------------------------')
fprintf('\n
iter.
t
I1
I2')
fprintf('\n ----------------------------------------------\n')
for j = 1:l1
fprintf('
%d
%.2f
%.4f
%.4f
\n',j,t(j),I1(j),I2(j))
end
fprintf(' ------------------------------------------------\n')
fprintf('Nmero de iteraciones: %d para h = %.4f \n',l1,h)
fprintf('Valor calculado de I1 = %.2f e I2 = %.2f\n\n',I1(l1),I2(l1))
subplot(2,2,4); plot(t,I1,t,I2)
xlabel('tiempo'), ylabel('Corriente'), title('MTODO RUNGE KUTTA 4TO
ORDEN paso h = 1')
legend('I1','I2')
grid on

SOLUCIN MATLAB:

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO


PROBLEMA 7.7
UN capacitor de 0.001 farads est conectado en serie con una fem de 20
volts y una inductancia de 0.4 henries. Si t = 0, Q = 0 e I = 0, encuentre una
ecuacin para modelar este circuito y use el mtodo de Runge Kutta de
tercer orden para hallar el valor de Q a distintos tiempos (vase ejercicio
7.5).
SOLUCIN MATEMTICA

Cambio de variable:

( )
( )

( )

( )

CDIGO EN MATLAB

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

SOLUCIN EN MATLAB

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

Mtodos Numricos

UNIVERSIDAD NACIONAL DE TRUJILLO

BIBLIOGRAFA
MTODOS NUMRICOS APLICADOS A LA INGENIERA ANTONIO
NIEVES, DOMNGUEZ IV EDICIN

Mtodos Numricos

You might also like