Error using trustnleqn (line 28) Objective function is returning undefined values at initial point. FSOLVE cannot continue.
이전 댓글 표시
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!
댓글 수: 1
João Paulo da Costa
2018년 6월 8일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Lengths and Angles에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!