How can i calculate five unknown parameters??

Hello everyone,
I want to calculate the five unknown parameters for the following equations. Please could you give me a hint on how to do it?
Some of the parameters i already know them so i define them n = 1; k = 1.38064852 * 10^-23; T = 8; q = 1.60217662 * 10^-19; Vt = n*k*T/q; Np = 5; Ns = 12; Voc = 36.48; Isc = 8.12; Im = 7.62; Vm = 29.47;
These are the unknown parameters i am looking for: (Iph I_o Vt Rs Rp)
These are the equations i have and i want to solve them 1) Vt = (n*k*T)/q; 2) Np*Iph - Np*I_o*exp((Voc/Ns*Vt) - 1) - (Np/Ns) * (Voc/Rp) = 0; 3) Isc == Np*Iph - Np*I_o*exp((Isc*Rs)/(Np*Vt) -1) - ((Isc*Rs)/Rp); 4) Im == Np*Iph - Np*I_o*exp((((Vm/Ns)+((Im/Np)*Rs))/Vt) - 1) - Np* (((Vm/Ns) + ((Im/Np)*Rs))/Rp); 5) (Im/Vm) == ((Np/Ns*Vt)*I_o*exp(((Vm + Im*((Ns/Np)*Rs))/(Ns*Vt)) + (1/(Ns*Np)*Rp))) / (1 + (Rs/Vt)*I_o*exp((Vm + (Im*(Ns*Np)*Rs))/(Ns*Vt)) + (Rs/Rp)); 6) (-(1/Rp)) == ((-(Np/Ns*Vt))*I_o*exp((Isc*(Ns/Np)*Rs)/(Ns*Vt)) - (1/(Ns*Np)*Rp)) / (1 + (Rs/Vt)*I_o*exp((Isc*(Ns/Np)*Rs)/(Ns*Vt)) + (Rs/Rp)), Iph);
Thanks in advance
Regards,
Charalampos

 Réponse acceptée

Star Strider
Star Strider le 16 Nov 2017
Modifié(e) : Star Strider le 16 Nov 2017

0 votes

Use the Optimization Toolbox fsolve (link) function.

8 commentaires

Hello Star,
I look for it but its only show for 2 unknown variables. Do you know any other method or if you could give me an example i will appreciate it.
Thanks
The fsolve function will solve for a vector of many variables. The documentation is a simplified illustration.
To use fsolve, code your equations as a matrix, so that all equations are implicit (so they are equal to zero and there are no equal signs).
Code the variables you want to solve for as elements of a single vector, for example:
Iph = p(1);
I_o = p(2);
Vt = p(3);
Rs = p(4);
Rp = p(6);
and use the ‘p’ vector as you parameter vector that fsolve will solve for.
Charalampos Ioannou
Charalampos Ioannou le 16 Nov 2017
Modifié(e) : Walter Roberson le 22 Déc 2019
Hello Star, I modify the equations as you advice. So the next step is to define my unknown parameters as you mentioned above and use the fsolve to solve for each one at time? n = 1;
k = 1.38064852 * 10^-23;
T = 8;
q = 1.60217662 * 10^-19;
Np = 5;
Ns = 12;
Voc = 36.48;
Isc = 8.12;
Im = 7.62;
Vm = 29.47;
Vt = n*k*T/q;
F(1) = Np*Iph - Np*Io*exp((Voc/Ns*Vt) - 1) - ((Np/Ns) * (Voc/Rp));
F(2) = Np*Iph - Np*Io*exp(((Isc*Rs)/(Np*Vt)) - 1) - ((Isc*Rs)/Rp) - Isc;
F(3) = Np*Iph - Np*Io*exp((((Vm/Ns)+(Im/Np)*Rs)/Vt) - 1) - Np*(((Vm/Ns)+(Im/Np)*Rs)/Rp) - Im;
F(4) = Vm*((Np/Ns*Vt)*Io*exp(((Vm+Im*(Ns/Np)*Rs)/(Ns*Vt)) + (Np/Ns*Rp))) - Im*(1+(Rs/Vt)*Io*exp(((Vm+Im*(Ns/Np)*Rs)/(Ns*Vt)) + (Rs/Rp)));
F(5) = Rp*(-(Np/Ns*Vt)*Io*exp((Isc*(Ns/Np)*Rs)/(Ns*Vt)) - (Np/Ns*Rp)) - 1 - (Rs/Vt)*Io*exp((Isc*(Ns/Np)*Rs)/(Ns*Vt)) - (Rs/Rp);
I coded your equations in a function:
function F = C_I_fcn(p)
Iph = p(1);
Io = p(2);
Vt = p(3);
Rs = p(4);
Rp = p(6);
n = p(7);
k = 1.38064852 * 10^-23;
T = 8;
q = 1.60217662 * 10^-19;
Np = 5;
Ns = 12;
Voc = 36.48;
Isc = 8.12;
Im = 7.62;
Vm = 29.47;
Vt = n*k*T/q;
F(1) = Np*Iph - Np*Io*exp((Voc/Ns*Vt) - 1) - ((Np/Ns) * (Voc/Rp));
F(2) = Np*Iph - Np*Io*exp(((Isc*Rs)/(Np*Vt)) - 1) - ((Isc*Rs)/Rp) - Isc;
F(3) = Np*Iph - Np*Io*exp((((Vm/Ns)+(Im/Np)*Rs)/Vt) - 1) - Np*(((Vm/Ns)+(Im/Np)*Rs)/Rp) - Im;
F(4) = Vm*((Np/Ns*Vt)*Io*exp(((Vm+Im*(Ns/Np)*Rs)/(Ns*Vt)) + (Np/Ns*Rp))) - Im*(1+(Rs/Vt)*Io*exp(((Vm+Im*(Ns/Np)*Rs)/(Ns*Vt)) + (Rs/Rp)));
F(5) = Rp*(-(Np/Ns*Vt)*Io*exp((Isc*(Ns/Np)*Rs)/(Ns*Vt)) - (Np/Ns*Rp)) - 1 - (Rs/Vt)*Io*exp((Isc*(Ns/Np)*Rs)/(Ns*Vt)) - (Rs/Rp);
end
and called it with:
P = fsolve(@C_I_fcn, rand(7,1))
However, I get this error:
Error using levenbergMarquardt (line 16)
Objective function is returning undefined values at initial point. fsolve cannot
continue.
Running this call to it:
TestOutput = C_I_fcn(rand(7,1))
returns:
TestOutput =
-68.2373 -Inf -Inf NaN -Inf
You must resolve that problem. I will help as I can.
Thank you so much for your help. I will try to understand what you did and i will come back to you.
Again thank you
Star Strider
Star Strider le 16 Nov 2017
As always, my pleasure.
Hello Star,
I want to ask you a question instead of using random values can i have something else which is gonna give me the standard values??
For example when i am using the algorithm above every time is giving me different values.
How can i fix this?
Star Strider
Star Strider le 21 Nov 2017
Nonlinear optimization algorithms can be sensitive to initial parameter estimates, if the function being optimized has a number of local minima, a flat response hypersurface, a hypersurface charaterised by ‘saddle points’ (in which a global minimum might not exist), or other problems. If you know approximately what the optimum parameter values should be, start with those.
Another option would be to use one of the Global Optimization Toolbox functions to see if you can find the global minimum with an algorithm that does not use a gradient-descent approach.

Connectez-vous pour commenter.

Plus de réponses (1)

Alex Sha
Alex Sha le 22 Déc 2019
There are multi-solutions for Charalampos's problem:
1:
iph: -12.4464463252524
io: -889977.402184639
n: -4891.45375599277
rp: -3.43888384438778
rs: 29.2716150287422
Vt: -3.37210182925269
2:
iph: -1.58509863749155
io: -25.8943258325875
n: -2509.22818093014
rp: -1.9797561075646
rs: 1.83150481082548
Vt: -1.72982785098611
3:
iph: -6.55480935306723
io: -431499.497847303
n: -4852.19727384217
rp: -6.49397053909992
rs: 22.7965518323771
Vt: -3.34503894327367

Community Treasure Hunt

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

Start Hunting!

Translated by