Solving a system of 5 dependent non-linear equations
이전 댓글 표시
I am trying to solve the system of 5 non-linear equations:
Io * exp(Voc/ (m*Vt)) + Voc/Rsh - Is = 0
(Isc - (Voc - Rs*Isc)/ Rsh) * exp(-Voc/ (m*Vt)) - Io = 0
Isc - (Vmp + Rs*Imp + Rs*Isc)/ Rsh - (Isc - (Voc - Rs*Isc)/ Rsh) * exp((Vmp + Rs*Imp - Voc)/ (m*Vt)) - Imp = 0
Imp + ((-(Rsh*Isc - Voc + Rs*Isc) * exp((Vmp + Rs*Imp - Voc)/ (m*Vt))/ (Rsh * m*Vt) - 1/Rsh)/ (1 + Rs * (Rsh*Isc - Voc + Rs*Isc) * exp((Vmp + Rs*Imp - Voc)/ (m*Vt))/ (Rsh * m*Vt) + Rs/Rsh)) * Vmp = 0
(-(Rsh*Isc - Voc + Rs*Isc) * exp((Rs*Isc - Voc)/ (m*Vt))/ (Rsh * m*Vt) - 1/Rsh)/ (1 + Rs * (Rsh*Isc - Voc + Rs*Isc) * exp((Rs*Isc - Voc)/ (m*Vt))/ (Rsh * m*Vt) + Rs/Rsh) + 1/Rsh = 0
in which m, Rsh, Rs, Io and Is are the unknown variables. The other variables have the values:
Vmp = 31.1;
Imp = 8.67;
Voc = 38.2;
Isc = 9.19;
K = 1.38 * 10^-23;
T = 298.15;
q = 1.6 * 10*-19;
Vt = K*T/q;
I know the solution must be around m=62.3, Rsh=786, Rs=0.2748, Io=407.33, Is=9.1932
I have tried using the function fsolve as shown below
syms m Rsh Rs Io Is
V = [m, Rsh, Rs, Io, Is];
F = @(V) [V(4) * exp(Voc/ (V(1)*Vt)) + Voc/V(2) - V(5);
(Isc - (Voc - V(3)*Isc)/ V(2)) * exp(-Voc/ (V(1)*Vt)) - V(4);
Isc - (Vmp + V(3)*Imp + V(3)*Isc)/ V(2) - (Isc - (Voc - V(3)*Isc)/ V(2)) * exp((Vmp + V(3)*Imp - Voc)/ (V(1)*Vt)) - Imp;
Imp + ((-(V(2)*Isc - Voc + V(3)*Isc) * exp((Vmp + V(3)*Imp - Voc)/ (V(1)*Vt))/ (V(2) * V(1)*Vt) - 1/V(2))/ (1 + V(3) * (V(2)*Isc - Voc + V(3)*Isc) * exp((Vmp + V(3)*Imp - Voc)/ (V(1)*Vt))/ (V(2) * V(1)*Vt) + V(3)/V(2))) * Vmp;
(-(V(2)*Isc - Voc + V(3)*Isc) * exp((V(3)*Isc - Voc)/ (V(1)*Vt))/ (V(2) * V(1)*Vt) - 1/V(2))/ (1 + V(3) * (V(2)*Isc - Voc + V(3)*Isc) * exp((V(3)*Isc - Voc)/ (V(1)*Vt))/ (V(2) * V(1)*Vt) + V(3)/V(2)) + 1/V(2)];
InitialGuess = [50; 100; 1; 100; 10];
XY = fsolve(F, InitialGuess);
but I get the Error using trustnleqn (line 28). Objective function is returning undefined values at initial point. FSOLVE cannot continue. error message. Can someone tell how they would solve this problem?
댓글 수: 2
John D'Errico
2018년 3월 2일
편집: John D'Errico
2018년 3월 2일
As I said in my answer, fsolve will NEVER be able to solve this. Even if you learn to use fsolve properly it will fail.
So, what are you doing wrong with fsolve?
DON'T USE SYMS!!!!!!!!!!
People think that in order to make a function that has an unknown in it, they need to use symbolic variables. NOT TRUE!
For example, the function F below has an unknown value in it, thus x. I never made x symbolic. There is no need to do so. You can use a root finder on F, for example, fzero.
F = @(x) x.^2 - 2;
fzero(F,1)
ans =
1.4142
Regardless, you might try reading the examples for fsolve. Read the docs.
doc fsolve
Anyway, fsolve is irrelevant. You CANNOT solve this using fsolve, so spending the time teaching you what you did wrong is a complete waste of time here. Sorry, but it is. If you want to learn how to use fsolve on your own time, again, try the examples provided for fsolve.
As I said in my answer, the problem is so poorly conditioned that you CANNOT solve it using double precision arithmetic. In fact, even trying to solve it using tools like vpasolve will fail, if you are correct about the value of m.
What you seem not to recognize is that a number like
exp(-1e22)
is unimaginably small. How many zeros does it have before you get to the first non-zero digit? Not just 22 zero. You cannot write all of those zeros in your life time. Your computer cannot even count them in your life time.
Frederico Lourenço
2018년 3월 2일
채택된 답변
추가 답변 (3개)
John D'Errico
2018년 3월 2일
Maybe you THINK you know where the solution lies. But if you are correct, you will essentially NEVER be able to solve this problem using tools like fsolve.
I'll use symbolic tools here.
syms m Rsh Rs Io Is
E(1) = Io * exp(Voc/ (m*Vt)) + Voc/Rsh - Is == 0;
E(2) = (Isc - (Voc - Rs*Isc)/ Rsh) * exp(-Voc/ (m*Vt)) - Io == 0;
Etc.
We can stop at equation 1 in fact.
pretty(vpa(E(1),5))
/ 24 \
| 2.8224 10 | 38.2
Io exp| - ----------- | - 1.0 Is + ---- == 0.0
\ m / Rsh
You claim that m is around 62.3.
So that would have you compute exp(-2.8224e24/62.3). The number is so small that it is effectively zero, even when using symbolic or my own HPF tools.
In fact, every place where you have m, you divide it into a number on the order of 1e23 or so, then you exponentiate. So m is irrelevant. It results in an exponential that is zero.
pretty(vpa(E(2),5))
/ 24 \
| 2.8224 10 | / 9.19 Rs - 38.2 \
exp| ----------- | | -------------- + 9.19 | - 1.0 Io == 0.0
\ m / \ Rsh /
>> pretty(vpa(E(3),5))
/ 22 \
(17.86 Rs + 31.1) 1.0 | (8.67 Rs - 7.1) 7.3886 10 | / 9.19 Rs - 38.2 \
0.52 - --------------------- - exp| - --------------------------- | | -------------- + 9.19 | 1.0 == 0.0
Rsh \ m / \ Rsh /
So, even if you are calling fsolve wrongly, you are wasting your time. In fact, you are wasting your time trying to solve this even with symbolic tools, IF m is on the order of 60. Unless m was on the order of 1e20 or more, you will have no chance of solving this. And even then, fsolve would be a complete waste of time.
댓글 수: 1
Frederico Lourenço
2018년 3월 2일
Hi, if vt = 0.0257, the solution should be:
m: 512.891368076595
rsh: -1.08505661410065
rs: 3.40678689852078
io: 0.856812866408915
is: -19.6641364483436
Fevl:
3.80140363631654E-13
1.59949831157746E-12
4.13891143580258E-13
-2.0961010704923E-13
3.41060513164848E-13
while, if Vt = K*T/q=-1.35344407894737E-23, the solution will be:
m: -9.73908591023589E23
rsh: -1.08505661410068
rs: 3.40678689852086
io: 0.856812866410473
is: -19.6641364483141
Fevl:
1.4210854715202E-14
1.11022302462516E-16
-8.34887714518118E-14
-1.24344978758018E-14
-1.55431223447522E-15
Alex Sha
2020년 2월 4일
0 개 추천
My pleasure, it is actually very challenging problem, hard to be solved by common software or algorithms.
카테고리
도움말 센터 및 File Exchange에서 Range and Doppler Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
