Vous êtes sur la page 1sur 5

TANQUE DE MEZCLA

1. Archivo de funcion en Matlab

function f=fdifrk4(fo, ce ,fs , c, v, t)

f=(fo*ce-fs*c)/(v+(fo-fs)*t);

2. Programacion para el caso de flujos diferentes

fprintf('\n \tRESOLUCION DE ECUACIONES POR METODO RK4 \n')

fo=input('ingrese flujo de entrada F1=');

fs=input('ingrese flujo de salida F2=');

ce=input('ingrese concentracion de entrada Ce=');

v=input('ingrese volumen inicial Vo=');

t0=input('ingrese el tiempo inicial t0=');

t1=input('ingrese el tiempo final t1=');

c0=input('Ingrese la concentracion inicial c0=');

h=input('Ingrese el ancho de paso h=');

i=1;

n=(t1-t0)/h;

x=t0;

y=c0;

fprintf('------------------------------------------------------------
--------------------------\n');

fprintf(' METODO DE RK4\n')

fprintf(' itera t c k1 k2 k3
k4 ci\n')

fprintf('------------------------------------------------------------
--------------------------\n');

while i<=n

conta=i;

k1=feval('fdifrk4',fo, ce ,fs , c0, v, t0);

t=t0+(h/2);

c=c0+(h/2)*k1;

k2=feval('fdifrk4',fo, ce ,fs , c, v, t);


c=c0+(h/2)*k2;

k3=feval('fdifrk4',fo, ce ,fs , c, v, t);

t=t0+h;

c=c0+h*k3;

k4=feval('fdifrk4',fo, ce ,fs , c, v, t);

c1=c0+(h/6)*(k1+2*k2+2*k3+k4);

t1=t0+h;

i=i+1;

t0=t1;

c0=c1;

fprintf('%3.0f%12.4f%12.4f%12.4f%12.4f%12.4f%12.4f%12.4f\n',conta,t,c
,k1,k2,k3,k4,c1);

x=[x,t0];

y=[y,c0];

end

fprintf('\n El punto aproximado ci es = %8.6f\n',c1);

fprintf('------------------------------------------------------------
--------------------------\n');

fprintf('-------------------------------CASO:FLUJOS
DIFERENTES---------------------------------\n');

fprintf('------------------------------------------------------------
--------------------------\n');

plot(x,y)

grid on

title('METODO RK4')

xlabel('TIEMPO(MIN)'),ylabel('CONCENTRACION EN LA SALIDA (Kg/L)');

3. Respuesta del modelo matemático cambiando los datos


3.1. Caso 1
3.2. Caso 2
3.3. Caso 3

Vous aimerez peut-être aussi