how to solve a system of non linear-equations

조회 수: 1 (최근 30일)
steven rijns
steven rijns 2020년 1월 13일
답변: Alex Sha 2020년 1월 31일
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
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
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
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);

Alex Sha
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

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by