solution giving me imaginary answers.. Help me with this.

2 visualizaciones (últimos 30 días)
Ahmed Saleem
Ahmed Saleem el 2 de En. de 2021
Comentada: Ahmed Saleem el 6 de En. de 2021
syms x1 x2 A gamma1 gamma2 y1 y2 P P1sat P2sat T
eqn1= P1sat==exp(16.59158 -(3643.31/(T -33.424)));
eqn2= P2sat==exp(14.25326 -(2665.54/(T -53.424)));
eqn3= x1*gamma1*P1sat==y1*P;
eqn4= x2*gamma2*P2sat==y2*P;
eqn5= y1-0.6==0;
eqn6= y1+y2-1==0;
eqn7= x1+x2==1;
eqn8= T==318.15;
eqn9= A==2.771-(0.00523*T);
eqn10= log(gamma1)==A*(x2.^2);
eqn11= log(gamma2)==A*(x1.^2);
solution=solve(eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7,eqn8,eqn9,eqn10,eqn11);
p1sat=vpa(solution.P1sat)
p2sat=vpa(solution.P2sat)
p=vpa(solution.P)
Gamma1=vpa(solution.gamma1)
Gamma2=vpa(solution.gamma2)
Y1=vpa(solution.y1)
Y2=vpa(solution.y2)
X1=vpa(solution.x1)
X2=vpa(solution.x2)
  1 comentario
John D'Errico
John D'Errico el 2 de En. de 2021
Editada: John D'Errico el 2 de En. de 2021
You've asked this same question in subtly different forms how many times so far now? What leads you to conclude that only real solutions exist to any problem you might pose? Do you even know that the equations you wrote are consistent with real solutions?
I might add that at least 4 (actually 6) of the equations you wrote are trivial, equivalent to setting a variable to some constant.

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 2 de En. de 2021
To be more clear, equations 5,6,8,9 merely establish the value of y1,y2,T,A.
eqn5= y1-0.6==0;
eqn6= y1+y2-1==0;
eqn8= T==318.15;
eqn9= A==2.771-(0.00523*T);
I might as well have written:
y1 = 0.6;
y2 = 0.4;
T = 318.5;
A = 2.771-(0.00523*T);
And if you know T, then you also have P1sat and P2sat.
P1sat = exp(16.59158 -(3643.31/(T -33.424)));
P2sat = exp(14.25326 -(2665.54/(T -53.424)));
That leaves us with x1, x2, gamma1, gamma2 and P.
syms x1 x2 gamma1 gamma2 P
eqn3 = x1*gamma1*P1sat==y1*P;
eqn4 = x2*gamma2*P2sat==y2*P;
eqn7 = x1+x2 == 1;
eqn10 = log(gamma1)==A*(x2.^2);
eqn11 = log(gamma2)==A*(x1.^2);
sol = solve(eqn3,eqn4,eqn7,eqn10,eqn11,x1,x2,gamma1,gamma2,P)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
> In sym/solve (line 304)
sol =
struct with fields:
x1: [1×1 sym]
x2: [1×1 sym]
gamma1: [1×1 sym]
gamma2: [1×1 sym]
P: [1×1 sym]
>> sol.x1
ans =
0.8161257046806368534733958569207
>> sol.x2
ans =
0.1838742953193631465266041430793
>> sol.gamma1
ans =
1.0380750288907764948708262904108
>> sol.gamma2
ans =
2.0879041697203424520424357591268
>> sol.P
ans =
63.844534426775701154639919217143
I fail to see the problem?
  3 comentarios
Alex Sha
Alex Sha el 6 de En. de 2021
Editada: Alex Sha el 6 de En. de 2021
try to solve by 1stOpt:
code
Parameter x1 x2 A gamma1 gamma2 y1 y2 P P1sat P2sat T;
Function
P1sat=exp(16.59158 -(3643.31/(T -33.424)));
P2sat=exp(14.25326 -(2665.54/(T -53.424)));
x1*gamma1*P1sat=y1*P;
x2*gamma2*P2sat=y2*P;
y1-0.6=0;
y1+y2-1=0;
x1+x2=1;
T=318.15;
A=2.771-(0.00523*T);
ln(gamma1)=A*(x2^2);
ln(gamma2)=A*(x1^2);
result
x1: 0.816926526825341
x2: 0.183073473174603
a: 1.10707550000003
gamma1: 1.03780159822678
gamma2: 2.09348012814114
y1: 0.600000000000015
y2: 0.400000000000254
p: 62.8944737659463
p1sat: 44.5109029498676
p2sat: 65.6414574862544
t: 318.15
Ahmed Saleem
Ahmed Saleem el 6 de En. de 2021
Thnx mate
this helped

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematical Functions en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by