I am using fsolve and receiving errors
1 回表示 (過去 30 日間)
古いコメントを表示
I have the following function which i am defining some of the parameters as follows:
function F = solar5d(x)
q = 1.60217662*10^-19;
k = 1.38064852*10^-23;
T = 298.15; % Temperature in degrees 25. This one is in Kelvin.
Ns = 72;
Np = 1;
Voc = 44.6;
Vm = 35.43;
Isc = 5.43;
Im = 4.95;
n = 1.086;
These are my unknown parameters i am looking for:
Iph = x(1);
Io = x(2);
Rs = x(3);
Rp = x(4);
Vt = x(5);
The following are the six questions i have to solve the system:
F(1) = Vt - n*k*T/q;
F(2) = Np*Iph - Np*Io*(exp(Voc/Ns*Vt)-1) - (Np*Voc)/(Ns*Rp);
F(3) = Np*Iph - Np*Io*(exp((Isc*Rs)/(Np*Vt)) - 1) - (Isc*Rs)/Rp - Isc;
F(4) = Np*Iph - Np*Io*(exp(((Vm/Ns)+(Im*Rs)/Np)/Vt) - 1) - Np*((((Vm/Ns)+((Im*Rs)/Np))/Rp)) - Im;
F(5) = (((Np/Ns*Vt)*Io*(exp((Vm + ((Im*Ns*Rs)/Np))/Ns*Vt)) + (1/(Ns*Rp)/Np))/(1 + (Rs*Vt)*Io*(exp((Vm + ((Im*Ns*Rs)/Np))/Ns*Vt)) + (Rs/Rp))) - (Im/Vm);
F(6) = (((-Np/Ns*Vt)*Io*(exp(Voc/Ns*Vt)) - (1/Ns*Rp/Np)) / (1 + (Rs/Vt)*Io*(exp(Voc/Ns*Vt)) + (Rs/Rp))) + 1/Rs;
end
But i am receiving the following error:
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle
non-square systems; using Levenberg-Marquardt algorithm instead.
> In fsolve (line 298)
Error using levenbergMarquardt (line 16)
Objective function is returning undefined values at initial point.
fsolve cannot continue.
Error in fsolve (line 397)
levenbergMarquardt(funfcn,x,verbosity,options,defaultopt,f,JAC,caller,
...
Please could you help me to solve my problem??
Thanks in advance.
Regards,
Charalampos
2 件のコメント
Walter Roberson
2017 年 11 月 24 日
You did not happen to show you call to fsolve, with your initial conditions.
回答 (2 件)
Torsten
2017 年 11 月 24 日
Add
disp(F)
at the end of solar5d.
I suspect that the array F contains Inf, NaN or something similar.
Take care that your initial values for the variables don't produce division by zero or undefined expressions.
Best wishes
Torsten.
7 件のコメント
Are Mjaavatten
2017 年 11 月 24 日
It seems that you try to solve an overdetermined system. You have six equations in five unknowns. You should re-examine your problem to see if one of your equations is superfluous.
Also, it is good practice (although not strictly necessary) to pre-allocate memory to F: Insert the command
F = zeros(6,1) % Or zeros(5,1)?
before you define the components of F.
9 件のコメント
Are Mjaavatten
2017 年 11 月 24 日
Did you check that fsolve converged at all? If so, if you plug the resulting x into solar5d the result should be a set of very small numbers. Solving a set of nonlinear equations is not always easy. In the general case, a solution may not even exist.
If you have some knowledge of what the solution should be, try with a starting vector close to this estimate. It may also be a good idea to double-check that your equations and parameters are all correct
参考
カテゴリ
Help Center および File Exchange で Systems of Nonlinear Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!