# vpasolve gives wrong solution

7 Ansichten (letzte 30 Tage)
Alessio Falcone am 21 Okt. 2021
Beantwortet: Neelanshu am 9 Mai 2024
Hi, I'm Alessio and I'm a chemical engineer. I have basic knowlwdge of matlab and I have some problems with a system of equations that I can't manage to solve. Could you please help me ?
Tc=200;
Pc=45;
R=0.0821;
Z=0.30;
syms Vc a b c;
EoS = (R*Tc)/(Vc-b)-(a-c*sqrt(Tc))/(Vc*(Vc+b)+b*(Vc-b)) - Pc;
eq1 = (R*Tc)/(Vc-b)-(a-c*sqrt(Tc))/(Vc*(Vc+b)+b*(Vc-b)) - Pc == 0;
eq2 = diff (EoS, Vc) == 0;
eq3 = diff (EoS,Vc, 2) == 0;
eq4=(Pc*Vc)/(R*Tc)-Z==0;
sol = vpasolve([eq1,eq2,eq3,eq4],[a,b,c,Vc]);
Vc = sol.Vc
Vc =
0.10946666666666666666666666666667
b = sol.b
b =
0.26427591129444147134215819234349
a = sol.a
a =
0
c = sol.c
c =
0
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Srijith Kasaragod am 2 Dez. 2021
Bearbeitet: Srijith Kasaragod am 2 Dez. 2021
Could you please share what issues you are facing? In case you are facing any errors, please share the error message.

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Neelanshu am 9 Mai 2024
Hi Alessio,
As Srijith mentioned kindly share the error message and the issue faced by you. Since the code runs without any error, I assume that you are referring to the solutions of a,b,c,Vc not having the desired values as the problem.
This is likely to be the case because the system of equations has more than one solution. If no initial guess is mentioned using the "init_param" argument, the "vpasolve" function returns the first solution it finds.
Hope this helps.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Partial Differential Equation Toolbox finden Sie in Help Center und File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by