How to solve a system of equations?

조회 수: 1 (최근 30일)
Karen Cao
Karen Cao 2016년 2월 7일
댓글: Star Strider 2016년 2월 7일
My assignment is to take the vapor compositions (yD=[0.3291 0.529 0.1418]) use these equations
x2*gamma2*P2sat=y2*1
x3*gamma3*P3sat=y3*1
x1*gamma1*P1sat+x2*gamma2*P2sat+x3*gamma3*P3sat=1
x1+x2+x3=1
and solve for x1, x2, x3 and T. I cannot figure out how to use fsolve to find these values.
Please help I have worked on this for 2 days and I do not understand what I am doing wrong.
Below are the function handles to determine the gamma and Psat values.
Thank you
%Ternary Distillation Day 2
clear
clc
R=1.987; %cal/K mol
P=1; %atm
%Used the composition from trial 2 since it was closest to equilibrium
%Distillate vapor composition
yD=[0.3291 0.529 0.1418];
%molar volume equation equation found from ploting the points from ref 5
%and then interpolating it
vL1=@(T)(0.1436.*T+65.991);
vL2=@(T)(0.2057*T+86.504);
vL3=@(T)(0.1389.*T+65.106);
%Defined the Lambda stuff for equation 6
L11=@(T)(1);
L12=@(T)((vL2(T)/vL1(T))*exp(-(866.47)/(R*T)));
L13=@(T)((vL3(T)/vL1(T))*exp(-(-416.33)/(R*T)));
L21=@(T)((vL1(T)/vL2(T))*exp(-(-629.14)/(R*T)));
L22=@(T)(1);
L23=@(T)((vL3(T)/vL2(T))*exp(-(-45.06)/(R*T)));
L31=@(T)((vL1(T)/vL3(T))*exp(-(911.48)/(R*T)));
L32=@(T)((vL2(T)/vL3(T))*exp(-(264.44)/(R*T)));
L33=@(T)(1);
%Define activity coefficient equation 5
%activity coefficients (g) equation 5
g1=@(x,T)(exp(1-log(((x(1)*L11(T))+(x(2)*L12(T))+(x(3)*L13(T))))-(((x(1)*L11(T))/((x(1)*L11(T))+(x(2)*L12(T))+(x(3)*L13(T))))+((x(2)*L21(T))/((x(1)*L21(T))+(x(2)*L22(T))+(x(3)*L23(T))))+((x(3)*L31(T))/((x(1)*L31(T))+(x(2)*L32(T))+(x(3)*L33(T)))))));
g2=@(x,T)(exp(1-log(((x(1)*L21(T))+(x(2)*L22(T))+(x(3)*L23(T))))-(((x(1)*L12(T))/((x(1)*L11(T))+(x(2)*L12(T))+(x(3)*L13(T))))+((x(2)*L22(T))/((x(1)*L21(T))+(x(2)*L22(T))+(x(3)*L23(T))))+((x(3)*L32(T))/((x(1)*L31(T))+(x(2)*L32(T))+(x(3)*L33(T)))))));
g3=@(x,T)(exp(1-log(((x(1)*L31(T))+(x(2)*L32(T))+(x(3)*L33(T))))-(((x(1)*L13(T))/((x(1)*L11(T))+(x(2)*L12(T))+(x(3)*L13(T))))+((x(2)*L23(T))/((x(1)*L21(T))+(x(2)*L22(T))+(x(3)*L23(T))))+((x(3)*L33(T))/((x(1)*L31(T))+(x(2)*L32(T))+(x(3)*L33(T)))))));
%Define Antoine equation
P1sat=@(T)((10^(6.84498-(1203.526/((T-273.15)+222.863))))*0.001315789);
P2sat=@(T)((10^(6.90240-(1268.115/((T-273.15)+216.9))))*0.001315789);
P3sat=@(T)((10^(6.95334-(1343.943/((T-273.15)+219.377))))*0.001315789);
  댓글 수: 1
Star Strider
Star Strider 2016년 2월 7일
How does:
yD=[0.3291 0.529 0.1418];
relate to:
x2*gamma2*P2sat=y2*1
x3*gamma3*P3sat=y3*1
x1*gamma1*P1sat+x2*gamma2*P2sat+x3*gamma3*P3sat=1
x1+x2+x3=1
I can’t make sense of your code (and I’m a few decades past my undergraduate PChem course).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by