I want to solve this equation for Xp while I know all others parameters.

1 visualizzazione (ultimi 30 giorni)
''log((Xp*(1-Xo))/(Xo*(1-Xp))) + (Xp-Xo)/(1-Xo)*(1-Xp) == -(K*P*(M/T)^0.5)/(1-Xo)*A/F''
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
clear all
close all
clc
%Defining variable
syms Xp % outlet conc.
Xo = 0.10; % inlet conc
K = 5.83e-2; % numerical constant
P = 3; % pure component vapore pressure
M = 114; % molecular weight of volatile component
T = 700; % absolute temp
A = 3; % area available for evaporation
F = 23; % feed flow rate
%Balance equation
log((Xp*(1-Xo))/(Xo*(1-Xp))) + (Xp-Xo)/(1-Xo)*(1-Xp) == -(K*P*(M/T)^0.5)/(1-Xo)*A/F
%here is my code by i could not find the value of Xp
  1 Commento
John D'Errico
John D'Errico il 15 Nov 2022
Is there a typo in that balance equation as you wrote it? It seems you may have missed an important pair of parens.

Accedi per commentare.

Risposta accettata

Torsten
Torsten il 15 Nov 2022
Modificato: Torsten il 15 Nov 2022
%Defining variable
syms Xp % outlet conc.
Xo = 0.10; % inlet conc
K = 5.83e-2; % numerical constant
P = 3; % pure component vapore pressure
M = 114; % molecular weight of volatile component
T = 700; % absolute temp
A = 3; % area available for evaporation
F = 23; % feed flow rate
%Balance equation
solve(log((Xp*(1-Xo))/(Xo*(1-Xp))) + (Xp-Xo)/(1-Xo)*(1-Xp) == -(K*P*(M/T)^0.5)/(1-Xo)*A/F,Xp)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
ans = 
0.099158352269141311981161535286947
fplot(log((Xp*(1-Xo))/(Xo*(1-Xp))) + (Xp-Xo)/(1-Xo)*(1-Xp) + (K*P*(M/T)^0.5)/(1-Xo)*A/F,[0.01 1])

Più risposte (1)

John D'Errico
John D'Errico il 15 Nov 2022
Modificato: John D'Errico il 15 Nov 2022
In almost all cases when you have a variable that lies both inside, and outside of a nonlinear function, like sin or cos, log and exp sometimes also, there will be no analytical solution.
However, exp and log are exceptions, that SOMETIMES allow for a solution. That solution often comes in the form of the LambertW function, pretty much explicitly derived as a solution for problems of this form.
syms Xp % outlet conc.
Xo = 0.10; % inlet conc
K = 5.83e-2; % numerical constant
P = 3; % pure component vapore pressure
M = 114; % molecular weight of volatile component
T = 700; % absolute temp
A = 3; % area available for evaporation
F = 23; % feed flow rate
Now you write:
%Balance equation
log((Xp*(1-Xo))/(Xo*(1-Xp))) + (Xp-Xo)/(1-Xo)*(1-Xp) == -(K*P*(M/T)^0.5)/(1-Xo)*A/F
ans = 
And personally, I think you have a typo in that line. I see that you wrote this INSIDE the log:
(Xp*(1-Xo))/(Xo*(1-Xp))
ans = 
And outside of the log, you have something similar:
(Xp-Xo)/(1-Xo)*(1-Xp)
ans = 
when I think you intended to write
(Xp-Xo)/((1-Xo)*(1-Xp))
ans = 
This form is closer yet. Not close enough that a LambertW solution will be found. That extra pair of parens is important. In the latter case, you are dividing by (1-Xp). It seems far more likely you forgot the extra parens.
BalEq = log((Xp*(1-Xo))/(Xo*(1-Xp))) + (Xp-Xo)/((1-Xo)*(1-Xp)) == -(K*P*(M/T)^0.5)/(1-Xo)*A/F
BalEq = 
solve(BalEq,Xp)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
ans = 
0.099174098178032423518729466078783
MATLAB is able to find a solution, but there is no analytical solution to be found.

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by