How can I solve 4 simultaneous equations ?
2 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Torsten
on 29 Sep 2022
Edited: Torsten
on 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)
epns(sol(1),sol(2),sol(3),sol(4))
5 Comments
Torsten
on 29 Sep 2022
I haven't calculated the unknown.
?
So you didn't run the code and received a result ?
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!