Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

NAME :

REGISTRATION NUMBER:
function yy=Margules(DD)
x1=[0.0174 0.0239 0.0432 0.0546 0.0786 0.0897 0.1577
0.2283 0.2930 0.3728 0.4439 0.5775 0.7096 0.7663 0.8366
0.8795 0.9435];
y1=[0.1778 0.1379 0.2420 0.3050 0.3545 0.4045 0.5381
0.6204 0.6163 0.7274 0.7543 0.8517 0.8866 0.9103 0.9317
0.9446 0.9473];
x2=1-x1;
y2=1-y1;
P=760;
T=[370.18 369.59 366.99 365.14 362.23 361.70 356.36
353.07 351.34 348.53 347.08 344.43 342.38 341.34 340.21
339.58 338.93];
A1=11.9673;B1=3626.55;C1=-34.29;
A2=11.6834;B2=3816.44;C2=-46.13;
P1sat=(exp(A1-B1./(T+C1))).*760;
P2sat=(exp(A2-B2./(T+C2))).*760;
A12=DD(1);
A21=DD(2);
G1=exp(x2.^2.*(A12+2*(A21-A12).*x1));
G2=exp(x1.^2.*(A21+2*(A12-A21).*x2));
Pcal=(x1.*P1sat.*G1)+(x2.*P2sat.*G2);
yy=sum((P-Pcal).^2);

A12=0.5;A21=0.3;
constant=fminsearch('Margules',[A12 A21]);
fprintf('A12=%6.6f,A21=%6.6f\n',constant(1),constant(2)
)
x1=[0.0174 0.0239 0.0432 0.0546 0.0786 0.0897 0.1577
0.2283 0.2930 0.3728 0.4439 0.5775 0.7096 0.7663 0.8366
0.8795 0.9435];
x2=1-x1;
y1exp=[0.1778 0.1379 0.2420 0.3050 0.3545 0.4045 0.5381
0.6204 0.6163 0.7274 0.7543 0.8517 0.8866 0.9103 0.9317
0.9446 0.9473];
T=[370.18 369.59 366.99 365.14 362.23 361.70 356.36
353.07 351.34 348.53 347.08 344.43 342.38 341.34 340.21
339.58 338.93];
A1=11.9673;B1=3626.55;C1=-34.29;
A2=11.6834;B2=3816.44;C2=-46.13;
P1sat=(exp(A1-B1./(T+C1))).*760;
P2sat=(exp(A2-B2./(T+C2))).*760;
G1=exp(x2.^2.*(A12+2*(A21-A12).*x1));
G2=exp(x1.^2.*(A21+2*(A12-A21).*x2));
Pmodel=(x1.*P1sat.*G1)+(x2.*P2sat.*G2);
y1model=(x1.*P1sat.*G1)./Pmodel;
dy1=abs(y1model-y1exp);
disp(' ')
disp(' MARGULES MODEL OF THIRD ORDER ')
disp('------------------------------------------------
-----')
disp(' x1 y1exp T(K) y1model
dy1 ')
disp('-------------------------------------------------
----')
for i=1:length(x1)
fprintf('%3.4f %10.4f %10.4f %10.4f
%10.4f\n',x1(i),y1exp(i),T(i),y1model(i),dy1(i))
end
A12=0.763261,A21=0.492682

MARGULES MODEL OF THIRD ORDER


-----------------------------------------------------
x1 y1exp T(K) y1model dy1
-----------------------------------------------------
0.0174 0.1778 370.1800 0.0917 0.0861
0.0239 0.1379 369.5900 0.1218 0.0161
0.0432 0.2420 366.9900 0.2011 0.0409
0.0546 0.3050 365.1400 0.2423 0.0627
0.0786 0.3545 362.2300 0.3167 0.0378
0.0897 0.4045 361.7000 0.3460 0.0585
0.1577 0.5381 356.3600 0.4861 0.0520
0.2283 0.6204 353.0700 0.5830 0.0374
0.2930 0.6163 351.3400 0.6480 0.0317
0.3728 0.7274 348.5300 0.7120 0.0154
0.4439 0.7543 347.0800 0.7581 0.0038
0.5775 0.8517 344.4300 0.8304 0.0213
0.7096 0.8866 342.3800 0.8907 0.0041
0.7663 0.9103 341.3400 0.9143 0.0040
0.8366 0.9317 340.2100 0.9421 0.0104
0.8795 0.9446 339.5800 0.9581 0.0135
0.9435 0.9473 338.9300 0.9810 0.0337
function yy=Wilson(DD)
x1=[0.0174 0.0239 0.0432 0.0546 0.0786 0.0897 0.1577
0.2283 0.2930 0.3728 0.4439 0.5775 0.7096 0.7663 0.8366
0.8795 0.9435];
y1=[0.1778 0.1379 0.2420 0.3050 0.3545 0.4045 0.5381
0.6204 0.6163 0.7274 0.7543 0.8517 0.8866 0.9103 0.9317
0.9446 0.9473];
x2=1-x1;
y2=1-y1;
P=760;
T=[370.18 369.59 366.99 365.14 362.23 361.70 356.36
353.07 351.34 348.53 347.08 344.43 342.38 341.34 340.21
339.58 338.93];
A1=11.9673;B1=3626.55;C1=-34.29;
A2=11.6834;B2=3816.44;C2=-46.13;
P1sat=(exp(A1-B1./(T+C1))).*760;
P2sat=(exp(A2-B2./(T+C2))).*760;
A12=DD(1);
A21=DD(2);
G1=exp(-log(x1+A12.*x2)+x2.*((A12./(x1+A12.*x2))-
(A21./(A21.*x1+x2))));
G2=exp(-log(x2+A21.*x1)-x1.*((A12./(x1+A12.*x2))-
(A21./(A21.*x1+x2))));
Pcal=(x1.*P1sat.*G1)+(x2.*P2sat.*G2);
yy=sum((P-Pcal).^2);

A12=0.4;A21=0.5;
Constant=fminsearch('Wilson',[A12 A21]);
fprintf('A12=%6.6f,A21=%6.6f\n',Constant(1),Constant(2)
)
x1=[0.0174 0.0239 0.0432 0.0546 0.0786 0.0897 0.1577
0.2283 0.2930 0.3728 0.4439 0.5775 0.7096 0.7663 0.8366
0.8795 0.9435];
x2=1-x1;
y1exp=[0.1778 0.1379 0.2420 0.3050 0.3545 0.4045 0.5381
0.6204 0.6163 0.7274 0.7543 0.8517 0.8866 0.9103 0.9317
0.9446 0.9473];
T=[370.18 369.59 366.99 365.14 362.23 361.70 356.36
353.07 351.34 348.53 347.08 344.43 342.38 341.34 340.21
339.58 338.93];
A1=11.9673;B1=3626.55;C1=-34.29;
A2=11.6834;B2=3816.44;C2=-46.13;
P1sat=(exp(A1-B1./(T+C1))).*760;
P2sat=(exp(A2-B2./(T+C2))).*760;
G1=exp(-log(x1+A12.*x2)+x2.*((A12./(x1+A12.*x2))-
(A21./(A21.*x1+x2))));
G2=exp(-log(x2+A21.*x1)-x1.*((A12./(x1+A12.*x2))-
(A21./(A21.*x1+x2))));
Pmodel=(x1.*P1sat.*G1)+(x2.*P2sat.*G2);
y1model=(x1.*P1sat.*G1)./Pmodel;
dy1=abs(y1model-y1exp);
disp(' ')
disp(' WILSON MODEL ')
disp('------------------------------------------------
-----')
disp(' x1 y1exp T(K) y1model
dy1 ')
disp('-------------------------------------------------
----')
for i=1:length(x1)
fprintf('%3.4f %10.4f %10.4f %10.4f
%10.4f\n',x1(i),y1exp(i),T(i),y1model(i),dy1(i))
end
A12=0.471147,A21=0.984822

WILSON MODEL
-----------------------------------------------------
x1 y1exp T(K) y1model dy1
-----------------------------------------------------
0.0174 0.1778 370.1800 0.1951 0.0173
0.0239 0.1379 369.5900 0.2470 0.1091
0.0432 0.2420 366.9900 0.3635 0.1215
0.0546 0.3050 365.1400 0.4145 0.1095
0.0786 0.3545 362.2300 0.4940 0.1395
0.0897 0.4045 361.7000 0.5215 0.1170
0.1577 0.5381 356.3600 0.6314 0.0933
0.2283 0.6204 353.0700 0.6909 0.0705
0.2930 0.6163 351.3400 0.7254 0.1091
0.3728 0.7274 348.5300 0.7570 0.0296
0.4439 0.7543 347.0800 0.7787 0.0244
0.5775 0.8517 344.4300 0.8148 0.0369
0.7096 0.8866 342.3800 0.8521 0.0345
0.7663 0.9103 341.3400 0.8711 0.0392
0.8366 0.9317 340.2100 0.8989 0.0328
0.8795 0.9446 339.5800 0.9193 0.0253
0.9435 0.9473 338.9300 0.9566 0.0093

You might also like