vpasolve gives different answers for the same equation
Afficher commentaires plus anciens
Hi,
I want to use vpasolve to solve a nonlinear equation numerically. when I insert the coefficients manually, the result seems fine but when I use variables with the same value as I put manually the result changes. It doesn't seem logical to me at all. I would appreciate any help in this regard.
Here is the code (I have put both manual and variable case so you can compare the results) :
NA = 6.022*10^23; %1/mol
R = 8.3145*10^-6; %m^3*MPa/(K*mol)
M_ps = 329; %kg/mol
T_cent = 70; %C
P = 14.8; %MPa
T = T_cent + 273.15; %K
cT_ps = 739.9; %K
cP_ps = 387; %Mpa
crho_ps = 1108; %kg/m^3
r_ps = M_ps * cP_ps / (R * cT_ps * crho_ps)
tT_ps = T / cT_ps
tP_ps = P / cP_ps
syms x
vpasolve(x^2+ tT_ps* (log(1-x) + (1-1/r_ps)*x) + tP_ps,x)
vpasolve(x^2+ 0.4638* (log(1-x) + (1-1/18679)*x)+ 0.0382,x)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!