You are on page 1of 5

%Modelado y simulacion- Control de Procesos

clc; clear; format short;


[t, hde]=ode45(@balan,[0 5],[1 1.1 1.2]);
disp(' => t h1
h2 h3')
disp([t hde])
figure (1)
plot(t,hde(:,1),'dg',t,hde(:,2),'r',t,hde(:
,3),'*b'),grid on,xlabel ('Tiempo,
t'),ylabel('h1 h2 h3')
title ('altura-
tiempo'),legend('h3','h2','h1','Location','
SouthWest')
% figure (2)
% plot(hde(:,2),hde(:,1))
% figure(3)
% plot(hde(:,3),hde(:,1),'-
k',hde(:,3),hde(:,2),'*y')

%Funcion vector columna de ecuaciones


diferenciales
function [hde] = balans(~,hde)
A=100;
T=298;
molA=10;
R=8.314;%Pa*m3/molK
Cv=5;
Ro=1000;
Ro2=1.347;
Gf=Ro2/Ro;%kg/m3
Pa=101325;%Pa presion atmosferica
g=9.81; %m/s2
HT=5;%m altura del tanque
vpp=[0 0.5 0 1];
q1=100;
q3=50;
%a=[1 2];b=[0.5 1];d=[0.8 2];
for i=1:length(vpp)
h(i,1)=((Ro.*q1-
(Ro.*(Cv.*vpp(i).*sqrt(Pa+Ro.*g.*hde(1)-
(((molA.*R.*T)./(A.*(HT-hde(2))))
+Ro.*g.*hde(2)))./Gf))))./(Ro.*A);
h(i,2)=((Cv.*vpp(i).*sqrt(Pa+Ro.*g.*hde(1)-
(((molA.*R.*T)./(A.*(HT-hde(2))))
+Ro.*g.*hde(2)./Gf))-q3))./(Ro.*A);
h(i,3)=((Ro.*q3)-
(Ro.*Cv.*vpp(i).*sqrt((Ro.*g.*hde(3))./Gf))
)./(Ro.*A);
end
hde=[h(i,1); h(i,2); h(i,3)];
end

RESULTADOS
t h1 h2 h3

0 1.0000 1.1000 1.2000

0.0502 1.0515 1.1567 1.2618

0.1005 1.1057 1.2163 1.3268

0.1507 1.1627 1.2789 1.3952

0.2010 1.2226 1.3448 1.4671

0.3260 1.3854 1.5239 1.6624

0.4510 1.5698 1.7268 1.8838

0.5760 1.7788 1.9567 2.1346

0.7010 2.0157 2.2172 2.4188

0.8260 2.2841 2.5125 2.7409

0.9510 2.5882 2.8470 3.1058

1.0760 2.9328 3.2261 3.5194

1.2010 3.3233 3.6556 3.9879

1.3260 3.7658 4.1424 4.5190

1.4510 4.2672 4.6939 5.1207

1.5760 4.8354 5.3189 5.8024

1.7010 5.4792 6.0271 6.5750

1.8260 6.2088 6.8296 7.4505

1.9510 7.0355 7.7390 8.4425

2.0760 7.9722 8.7694 9.5666

2.2010 9.0337 9.9370 10.8404

2.3260 10.2365 11.2602 12.2839

2.4510 11.5995 12.7595 13.9194

2.5760 13.1439 14.4583 15.7727

2.7010 14.8940 16.3834 17.8728

2.8260 16.8772 18.5650 20.2527

2.9510 19.1244 21.0369 22.9493

3.0760 21.6707 23.8378 26.0048


3.2010 24.5561 27.0117 29.4673

3.3260 27.8259 30.6085 33.3911

3.4510 31.5309 34.6840 37.8371

3.5760 35.7290 39.3019 42.8748

3.7010 40.4862 44.5349 48.5835

3.8260 45.8772 50.4650 55.0527

3.9510 51.9857 57.1843 62.3829

4.0760 58.9073 64.7980 70.6887

4.2010 66.7506 73.4257 80.1008

4.3260 75.6389 83.2028 90.7667

4.4510 85.7101 94.2811 102.8522

4.5760 97.1218 106.8340 116.5462

4.7010 110.0534 121.0587 132.0641

4.7757 118.5967 130.4564 142.3160

4.8505 127.8031 140.5834 153.3637

4.9252 137.7241 151.4966 165.2690

5.0000 148.4154 163.2569 178.0984

You might also like