Failure in initial objective function evaluation. FSOLVE cannot continue.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponse acceptée
Torsten
le 3 Oct 2022
Modifié(e) : Torsten
le 3 Oct 2022
fun = @root7d;
x0 = [10,10];
x = fsolve(fun,x0)
fun(x)
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!