0% found this document useful (0 votes)
33 views4 pages

Punto 2 (Matlab)

This document contains code to calculate the activity coefficients (γi) and mole fractions (xi) of multiple compounds in a mixture using a non-ideal solution model. The code iterates between calculating γi and xi values until the values converge within a set tolerance. Key parameters like interaction coefficients (Aij, Bij, Cij), pressure, temperature and vapor pressure data of the pure compounds are provided as inputs to the model.

Uploaded by

Sergio Luna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views4 pages

Punto 2 (Matlab)

This document contains code to calculate the activity coefficients (γi) and mole fractions (xi) of multiple compounds in a mixture using a non-ideal solution model. The code iterates between calculating γi and xi values until the values converge within a set tolerance. Key parameters like interaction coefficients (Aij, Bij, Cij), pressure, temperature and vapor pressure data of the pure compounds are provided as inputs to the model.

Uploaded by

Sergio Luna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PUNTO 2

clear all
clear all
NC=4 % numero de compuestos

%interaccion

Aij=[0 0 -1.1512 -0.8009;0 0 0 -1.9763; -0.2431 0 0 -3.7198; 3.4578


3.3293 9.4632 0]

Bij=[0 225.476 524.424 246.18; -252.482 0 -235.279 609.889; 282.956


515.821 0 1286.14;-586.081 -723.888 -1705.68 0]

Cij=[0 0.3 0.3 0.3; 0.3 0 0.3 0.3 ; 0.3 0.3 0 0.2; 0.3 0.3 0.2 0]
%antoine

Ai=[5.33675 4.54456 4.13361 5.11564]

Bi=[1648.22 1555.12 1195.13 1687.537]

Ci=[230.98 224.65 212.47 230.17]

%presion de rocio
Yi=[0.1 0.3 0.2 0.4]

T=90+273.15 %°c
R=8.32 % cal/mol K
bij=[1.4 2.5 1.3 1.55;2.5 4.5 2 2.5;1.3 2 0.53 1.3;1.55 2.5 1.3 1.7]

for i=1:NC

Psati(i)= exp(Ai(i)-Bi(i)/((T-273.15)+Ci(i)))

end

for i=1 :NC


for j=1 :NC
dji(i,j)=2*bij(j,i)-bij(j,i)-bij(i,i)
for k=1 :NC
djk(j,k)=2*bij(j,k)- bij(j,j)-bij(k,k)
end
end
end

fi=ones(1,NC)
errorf=10
while errorf>0.00001
%suponer gamma

gi=ones(1,NC)

errorg=10

while errorg>0.00000001
%calculo de presión
for i=1:NC

YifigiPsati(i)=(Yi(i)*fi(i))/(gi(i)*Psati(i))

end

P=1/sum(YifigiPsati)

for i=1:NC

xi(i)=(Yi(i)*fi(i)*P)/(gi(i)*Psati(i))

end

for i=1:NC

Xi(i)=xi(i)/(sum(xi))

end

for i= 1: NC

for j=1: NC

Tij(i,j)=Aij(i,j)+Bij(i,j)/(T)

Gij(i,j)=exp(-Cij(i,j)*Tij(i,j))

end

end

for i =1 :NC

for j =1 :NC

Tij(i,j)=Aij(i,j)+ Bij(i,j)/(T)

Gij(i,j)=exp(-Cij(i,j)*Tij(i,j))

end

end
for i=1:NC

for j =1:NC

TjiGjiXj(j)=Tij(j,i)*Gij(j,i)*Xi(j)

for k=1:NC

GkjXk(k)=Gij(k,j)*Xi(k)

TkjGkjXk(k)=Tij(k,j)*Gij(k,j)*Xi(k)

GkiXk(k)=Gij(k,i)*Xi(k)

end

sumatoria(j)=(Xi(j)*Gij(i,j)/sum(GkjXk))*(Tij(i,j)-
(sum(TkjGkjXk)/sum(GkjXk)))

gic(i)=exp((sum(TjiGjiXj)/sum(GkiXk))+sum(sumatoria))

end

end

for i =1 :NC

errorgi(i)=abs((gi(i)-gic(i))/gic(i))

end

errorg=sum(errorgi)

gi=gic

end

for i=1 :NC


for j=1 :NC
for k=1 :NC
yjykdjidjk(k)=Yi(j)*Yi(k)*(2*dji(j,i)-djk(j,k))
end
sumadoble(j)=sum(yjykdjidjk)
end
sumadobleterm=sum(sumadoble)
end
for i=1 :NC
fic(i)=exp((bij(i,i)*(P-Psati(i))+0.5*P*sumadobleterm)/(R*T))
end

for i=1:NC
errorfi(i)=abs((fi(i)-fic(i))/fic(i))

end

errorf=sum(errorfi)

fi=fic

end

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy