How can I solve multivariable Newton`s Method with implicit functions?

I am trying to solve a system of non linear equations using Newton`s Method. The function F(X), the unknown variables X and the initial guess X0 are presented below:
F(X)=[V1+V2+Vblk-Vstring; I1(V1)-I2(V2); I1(V1)-Iblk(V3)];
X = [V1; V2; Vblk;];
X0 = [Voc; Voc; 0;];
Vstring is assigned from 91.1 to 0 so that Newtons`s Method must be applied for each value of Vstring to return the contribution of V1, V2 and Vblk across Vstring. However, in F(2) and F(3) the variables V1, V2 and Vblk are implicit functions of I1, I2 and Iblk. Before running Newton`s Method, the variables I1, I2 and Iblk are calculated by means of Lambert W function and then stored in arrays, so that variables I1, I2 and Iblk are known for any V1, V2 and Vblk values before Newton`s Method is applied. How could I solve the Newton`s Method considering these implicit functions for all Vstring values? I appreciate any help!

8 件のコメント

James Tursa
James Tursa 2022 年 9 月 14 日
What do the functions I1( ), I2( ), and Iblk( ) look like?
Functions I1(V1) and I2(V2) looks like:
I(i) = ( ( Rh * ( Iph + Isd ) - V(i) ) / ( Rh + Rs ) ) + Is_db * ( exp(-V(i)/Vtdb) - 1 ) - ( Vtd / Rs ) * W1;
where Rh, Rs, Iph, Isd, Vtdb, and Vtd are constants while W1 represents the Lambert W function of theta:
theta = (Rh*Rs/(Rs+Rh))*(Isd/(Ns*Vtd))*exp( ( (Rs+Rh)*(Iph+Isd) + Rh*V(i) ) /(Vtd*(Rs+Rh)));
The function Iblk looks like:
Iblk(Vblk) = Is,blk * (exp(Vblk/Vt,blk)-1)
where Is,blk and Vt,blk are constants.
Torsten
Torsten 2022 年 9 月 14 日
編集済み: Torsten 2022 年 9 月 15 日
Did you try "fsolve" for the solution ?
X0 = [Voc; Voc; 0];
Vstring = ...;
X = fsolve(@(X)fun(X,Vstring),X0)
V1 = X(1)
V2 = X(2)
Vblk = X(3)
function res = fun(X,Vstring)
V1 = X(1);
V2 = X(2);
Vblk = X(3);
Iblk = Isblk * (exp(Vblk/Vtblk)-1);
theta1 = (Rh*Rs/(Rs+Rh))*(Isd/(Ns*Vtd))*exp( ( (Rs+Rh)*(Iph+Isd) + Rh*V1 ) /(Vtd*(Rs+Rh)));
theta2 = (Rh*Rs/(Rs+Rh))*(Isd/(Ns*Vtd))*exp( ( (Rs+Rh)*(Iph+Isd) + Rh*V2 ) /(Vtd*(Rs+Rh)));
I1 = ( ( Rh * ( Iph + Isd ) - V1 ) / ( Rh + Rs ) ) + Is_db * ( exp(-V1/Vtdb) - 1 ) - ( Vtd / Rs ) * lambertw(theta1);
I2 = ( ( Rh * ( Iph + Isd ) - V2 ) / ( Rh + Rs ) ) + Is_db * ( exp(-V2/Vtdb) - 1 ) - ( Vtd / Rs ) * lambertw(theta2);
res(1) = V1 + V2 + Vblk - Vstring;
res(2) = I1 - I2;
res(3) = I1 - Iblk;
end
Eric Bernard Dilger
Eric Bernard Dilger 2022 年 9 月 15 日
I tried fsolve as you suggested but it did not work. Matlab is returning the following messages:
Error using fun
Too many input arguments.
Error in PSC_Emulator_Petrone>@(X)fun(X,Vstring) (line 111)
xSol = fsolve(@(X) fun(X,Vstring), X0)
Error in fsolve (line 260)
fuser = feval(funfcn{3},x,varargin{:});
Error in PSC_Emulator_Petrone (line 111)
xSol = fsolve(@(X) fun(X,Vstring), X0)
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot
continue.
It seems that fsolve doesn`t work when i set xSol defined:
xSol = fsolve(@(X) fun(X,Vstring), X0)
but the equation is solved for xSol defined as:
xSol = fsolve(@(X) fun(X), X0)
However, it doesn`t converge to the expected result.
Torsten
Torsten 2022 年 9 月 15 日
I modified the code above.
function res = fun(X)
had to be replaced by
function res = fun(X,Vstring)
Eric Bernard Dilger
Eric Bernard Dilger 2022 年 9 月 16 日
Hello @Torsten, thanks for support!
I replaced the code as you suggested and it worked. I also inclunded one more variable I3 raising the order of the system of equations and it`s working for most cases. However, when I set the input parameters which results in I1 = I2 = I3 equations are solved in a few iterations, but inaccurately. I tried setting TolFun and TolX equal to 1e-14 but it did not solve the problem. The purpose is to simulate a system of equations with order N = 33, but I don`t know if fsolve is suitable for this scale of application, it seems convergence problems may happen.
Torsten
Torsten 2022 年 9 月 16 日
As far as I know, it's the only MATLAB tool available for systems with as many equations as variables.
All depends on the initial guesses for the variables. If they are far away from the true values, every nonlinear solver will have problems.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSystems of Nonlinear Equations についてさらに検索

製品

リリース

R2021a

質問済み:

2022 年 9 月 14 日

コメント済み:

2022 年 9 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by