Failure in initial objective function evaluation. FSOLVE cannot continue.

2 次查看(过去 30 天)
Hi all,
I'm trying to solve a non linear, parametric system of equations.
Here my myfun_driver.m file containing the call to the function with fsolve:
fun = @root7d;
x0 = [0,0];
x = fsolve(fun,x0);
Here the root7d.m file where I defined the function and parameters (the main function has a call to othe functions, I don't know if I'm doing well):
%parameters
Vp=100;
Kp=0.5;
q=1;
phi=0.006;
MIN=1;
N1=10;
gb=0.8;
gp=0.45;
g1=0.6;
g2=0.5;
g3=0.6;
gf=0.75;
arb=1-ar;
ar=0.2;
r1=0.8;
eps2=0.02;
rho = @(x,vp,kp,gp,gb,MIN,N1)( (1-gp)* vp*x(1)/(kp+x(1))...
+ (1-gb)* (MIN*exp(x(1)/N1)*x(2)));
G1 = @(x,ar,eps2)((ar*x(2)+(1-ar)*x(2))/(eps2^2 + (ar*x(2)+(1-ar)*x(2))^2));
function F = root7d(x,vp,kp,q,phi,r1,MIN,N1,gb,ar,arb)
F(1) = -vp*x(1)/(kp+x(1))*q*x(2) +q*rho(x,gp,gb) + phi - r1*MIN*exp(x(1)/N1)*x(2);
F(2) = gb*r1*MIN*exp(x(1)/N1)*x(2) - r1*G1(x,ar)*arb*x(2)/(ar*x(2)+(1-ar)*x(2));
end
I don't know why I obtain the following message: Failure in initial objective function evaluation. FSOLVE cannot continue.

采纳的回答

Torsten
Torsten 2022-10-3
编辑:Torsten 2022-10-3
fun = @root7d;
x0 = [10,10];
x = fsolve(fun,x0)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x = 1×2
12.3661 0.5385
fun(x)
ans = 1×2
1.0e-12 * -0.2036 0.0266
function F = root7d(x)
%parameters
vp=100;
kp=0.5;
q=1;
phi=0.006;
MIN=1;
N1=10;
gb=0.8;
gp=0.45;
g1=0.6;
g2=0.5;
g3=0.6;
gf=0.75;
ar=0.2;
arb=1-ar;
r1=0.8;
eps2=0.02;
rho = ( (1-gp)* vp*x(1)/(kp+x(1)) + (1-gb)* (MIN*exp(x(1)/N1)*x(2)));
G1 = ((ar*x(2)+(1-ar)*x(2))/(eps2^2 + (ar*x(2)+(1-ar)*x(2))^2));
F(1) = -vp*x(1)/(kp+x(1))*q*x(2) +q*rho + phi - r1*MIN*exp(x(1)/N1)*x(2);
F(2) = gb*r1*MIN*exp(x(1)/N1)*x(2) - r1*G1*arb*x(2)/(ar*x(2)+(1-ar)*x(2));
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by