Error using trustnleqn (line 28) Objective function is returning undefined values at initial point. FSOLVE cannot continue.
Ältere Kommentare anzeigen
I'm having trouble with my code, which is note that complicated. It looks like it's not converging. For a initial condition of [1,1] the result is: z =
-1.0322 - 0.1404i
0.0678 + 0.0000i
But for other initial conditions i get this error: Error using trustnleqn (line 28) Objective function is returning undefined values at initial point. FSOLVE cannot continue.
Error in fsolve (line 388) trustnleqn(funfcn,x,verbosity,gradflag,options,defaultopt,f,JAC,...
Here's the code:
function F=myFunction(z)
hf_f = 40000000;
Cp = 1200;
phi = 1;
Yf_e = 1/(1+(16/phi));
YOx = (16/phi)/(1+(16/phi));
r = 0.04;
V = (4/3)*3.1415*r^3;
Tref = 298;
P = 1;
A = 1.1*10^12;
K = 15.098;
M = 29;
R = 8314;
m = 0.1;
n = 1.65;
m2=0.0011;
Ts = z(1);
Yf_s = z(2);
F(1)=(hf_f/Cp)*(Yf_e - Yf_s) + Tref - Ts;
F(2)=Yf_e - A*exp(K*Ts)*((Yf_s/M)^m)*((YOx*0.21/M)^n)*(((P*M)/(R*Ts))^(m+n))*(M*V/m2) - Yf_s;
end
Then I use
>> zg = [1;1];
>> z=fsolve(@myFunction,zg);
To call initial conditions and solve.
Any help is apreciated. Thank you!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Lengths and Angles finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!