How can I solve 4 simultaneous equations ?

syms Rcon;
syms Ccon;
syms Rbulk;
syms Cbulk;
w1=6280;
w2=62800;
seta(2,2)=-88.8000;
seta(2,3)=-88.9600;
z(2,2)=213000;
z(2,3)=21800;
solveRcon=1;
solveCcon=1;
solveRbulk=1;
solveCbulk=1;
epns = [ tand(seta(2,2)) + (Rcon + Rbulk)/(1/(w1*Ccon) + 1/(w1*Cbulk)) == 0 , tand(seta(2,3)) + (Rcon + Rbulk)/(1/(w2*Ccon) + 1/(w2*Cbulk)) == 0, abs(z(2,2)) - 1/(sqrt((1/Rcon)^2 +(w1*Ccon)^2)) - 1/(sqrt((1/Rbulk)^2 +(w1*Cbulk)^2)) == 0, abs(z(2,3)) - 1/(sqrt((1/Rcon)^2 +(w2*Ccon)^2)) - 1/(sqrt((1/Rbulk)^2 +(w2*Cbulk)^2)) == 0];
vars = [ Ccon Rcon Cbulk Rbulk ];
[solCcon, solRcon, solCbulk, solRbulk] = solve(epns,vars)
i want to solve 4 simltaneous equation and get 4 syms values( Ccon, Rcon, Cbulk, Rbulk)
but i just get 0x1 sym in Ccon, Rcon, Cbulk, Rbulk

 Réponse acceptée

Torsten
Torsten le 29 Sep 2022
Modifié(e) : Torsten le 29 Sep 2022
You might want to test fsolve and lsqnonlin with different initial guesses for the parameters,
but I doubt you will find a solution.
w1=6280;
w2=62800;
seta(2,2)=-88.8000;
seta(2,3)=-88.9600;
z(2,2)=213000;
z(2,3)=21800;
epns = @(Ccon ,Rcon, Cbulk, Rbulk)[ tand(seta(2,2)) + (Rcon + Rbulk)/(1/(w1*Ccon) + 1/(w1*Cbulk)) , tand(seta(2,3)) + (Rcon + Rbulk)/(1/(w2*Ccon) + 1/(w2*Cbulk)) , abs(z(2,2)) - 1/(sqrt((1/Rcon)^2 +(w1*Ccon)^2)) - 1/(sqrt((1/Rbulk)^2 +(w1*Cbulk)^2)) , abs(z(2,3)) - 1/(sqrt((1/Rcon)^2 +(w2*Ccon)^2)) - 1/(sqrt((1/Rbulk)^2 +(w2*Cbulk)^2)) ];
sol0 = [1 1 1 1];
options = optimset('MaxFunEvals',100000,'MaxIter',100000);
%sol = fsolve(@(x)epns(x(1),x(2),x(3),x(4)),sol0,options)
sol = lsqnonlin(@(x)epns(x(1),x(2),x(3),x(4)),sol0,[],[],options)
Local minimum possible. lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance.
sol = 1×4
-0.0019 -0.0560 0.9207 -0.0560
epns(sol(1),sol(2),sol(3),sol(4))
ans = 1×4
1.0e+05 * -0.0005 -0.0004 2.1300 0.2180

5 commentaires

준형 박
준형 박 le 29 Sep 2022
This result seems to be different from what I expected.
Can you explain why you said 'I doubt you will find a solution'?
Torsten
Torsten le 29 Sep 2022
With my initial guesses for the unknowns, the solver gave a "solution" for which the error in the equations was in the order of 1e5 (see above). You were more successful ?
준형 박
준형 박 le 29 Sep 2022
I haven't calculated the unknown. But there are expected values ​​for the unknown.
All unknowns are positive,
and I thought that the difference between (Ccon, Cbulk) and (Rcon, Rbulk) would be less than 100 times.
Torsten
Torsten le 29 Sep 2022
I haven't calculated the unknown.
?
So you didn't run the code and received a result ?
준형 박
준형 박 le 29 Sep 2022
Modifié(e) : 준형 박 le 29 Sep 2022
When I ran the code, the same result as what you entered.
'I haven't calculated the unknown.' means I haven't tried calculating this in any other way than matlab.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics 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!

Translated by