how to solve a system of non linear-equations
3 次查看(过去 30 天)
显示 更早的评论
Hello,
The problem I am trying to solve consists of four non-linear equations. First I try to repoduce a known problem to check if my outcomes are correct.
So for this example I know the outcomes:
R1 is around: 0.0068
R2 is around: 0.0140
C1 is around: 7.926*10^6
C2 is around 2.38*10^4
However I am not able to repoduce these numbers with the following script:
syms R1 R2 C1 C2
h = 60;
h=Ts;
b0 = 0.009229;
R0 = b0;
a1 = (Ts/(R1*C1)) + (Ts/(R2*C2)) -2 == -1.817;
a2 = 1 - (Ts/(R1*C1)) - (Ts/(R2*C2)) + ((Ts^2)/(R1*C1*R2*C2)) == 0.8168;
b1 = (Ts/C1) + (Ts/C2) + ((Ts*R0)/(R1*C1)) + ((Ts*R0)/(R2*C2)) - (2*R0) == -0.01419;
b2 = R0 + ((Ts^2)/(R1*C1*C2)) + ((Ts^2)/(R2*C1*C2)) + (((Ts^2)*R0)/(R1*R2*C1*C2)) - (Ts/C1) - (Ts/C2) - ((Ts*R0)/(R1*C1)) - ((Ts*R0)/(R2*C2)) == 0.004967;
sol = solve([a1, a2, b1, b2], [R1 R2 C1 C2], 'Real', true);
R1sol = sol.R1;
R2sol = sol.R2;
C1sol = sol.C1;
C2sol = sol.C2;
R1sol = vpa(R1sol);
R2sol = vpa(R2sol);
C1sol = vpa(C1sol);
C2sol = vpa(C2sol);
Does anyone know how to solve this problem to get the correct results?
4 个评论
Star Strider
2020-1-13
I cannot detect any errors. For this sort of problem, solving it symbolically is likely the most appropriate approach.
You have already determined the correct values for the R’s and C’s, so why not just go with those? Were they derived differently? Are they correct?
Beyond that, I have no further suggestions.
Devineni Aslesha
2020-1-16
Hi Steven,
Could you provide the source from which R1, R2, C1 and C2 values are derived? Or were they solved manually?
回答(2 个)
Cameron B
2020-1-17
I ran the code below and some different versions of vpasolve, but I still got the same answer: no solution. So I have to think that part of the problem could be the values of a1, a2, b0, b1, and b2. I don't know where these values of -1.817, 0.8168, 0.009229, -0.01419, and 004967 came from, but it seems as if they've been rounded off, and maybe this is the reason we are unable to converge on an answer. I get close to the answers (a1, a2, b1, b2) when using your expected values, but there is still a little bit off.
syms R1 R2 C1 C2 positive
h = 60;
Ts = 60;
b0 = 0.009229;
R0 = b0;
a1 = (Ts/(R1*C1)) + (Ts/(R2*C2)) -2 == -1.817;
a2 = 1 - (Ts/(R1*C1)) - (Ts/(R2*C2)) + ((Ts^2)/(R1*C1*R2*C2)) == 0.8168;
b1 = (Ts/C1) + (Ts/C2) + ((Ts*R0)/(R1*C1)) + ((Ts*R0)/(R2*C2)) - (2*R0) == -0.01419;
b2 = R0 + ((Ts^2)/(R1*C1*C2)) + ((Ts^2)/(R2*C1*C2)) + (((Ts^2)*R0)/(R1*R2*C1*C2)) - (Ts/C1) - (Ts/C2) - ((Ts*R0)/(R1*C1)) - ((Ts*R0)/(R2*C2)) == 0.004967;
sol = solve([a1, a2, b1, b2], [R1 R2 C1 C2], 'Real', true);
R1sol = sol.R1;
R2sol = sol.R2;
C1sol = sol.C1;
C2sol = sol.C2;
R1sol = vpa(R1sol);
R2sol = vpa(R2sol);
C1sol = vpa(C1sol);
C2sol = vpa(C2sol);
0 个评论
Alex Sha
2020-1-31
Hi, I get the solutions below:
1:
r1: 0.0136978624480164
r2: -0.0529268624480211
c1: 23794.5028958407
c2: 1043438.64860562
Fevl:
f1= 2.22044604925031E-16
f2= -3.33066907387547E-16
f3= 1.73472347597681E-18
f4= -8.67361737988404E-19
2:
r1: -0.052926862448011
r2: 0.0136978624480164
c1: 1043438.64860548
c2: 23794.5028958408
Fevl:
f1= -8.88178419700125E-16
f2= 7.7715611723761E-16
f3= -1.21430643318376E-17
f4= 1.12757025938492E-17
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!