Filter löschen
Filter löschen

Failure in solving nonlinear system of equations by using TRESNEI.

1 Ansicht (letzte 30 Tage)
Van Darkholme
Van Darkholme am 13 Mai 2021
Hello, I'm trying to solve a nonlinear system of equations and I saw in a paper that the function I should be looking for was "TRESNEI" (I am a beginner MATLAB user).
I created a function as following:
function F = myfun_unsaturation(x)
global W;
global n;
global m;
global lambda;
global Ptr;
global Ps;
global T;
global slot;
global Ts;
global Tc;
t = x(1);
p = x(2);
q = x(3);
Ptr = 1-(1-t)^n;
Ps = n*t*(1-t)^(n-1)/Ptr;
T = (1-Ptr)*slot + Ptr*Ps*Ts + Ptr*(1-Ps)*Tc
F(1) = 1/((1-q) + q^2*W*(W+1)/(2*(1-(1-q)^W)) + q*(W+1)/(2*(1-q))*(q^2*W/(1-(1-q)^W)+p*(1-q)-q*(1-p)^2) + ...
p*q^2/(2*(1-q)*(1-p))*(W/(1-(1-q)^W)-(1-p)^2)*(2*W*(1-p-p*(2*p)^(m-1))/(1-2*p)+1))*q^2/(1-q)*(W/((1-p)*(1-(1-q)^W))-(1-p))-t;
F(2) = (1-t)^(n-1)+p-1;
F(3) = 1-exp((-1)*lambda*T)-q;
F = F';
return
When I call solve:
[x,ierr,output] = TRESNEI([0.3,0.2,0.3],[3,0],'myfun_unsaturation',-l,u,options);
The program ends with:
Misuse /
Matrix dimensions must be consistent.
Error tresnei (line 431)
rhof = (Fnrmxpp^2-Fnrm2)*0.5/(grad'*p+0.5*norm(jac*p)^2);
Error test_ TRESNEI (line 55)
[x,ierr,output] = TRESNEI([0.3,0.2,0.3],[3,0],'myfun_ unsaturation',-l,u,options);

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by