why the solution obtained from fsolve changes when i change the initial guess?
3 ビュー (過去 30 日間)
古いコメントを表示
I am trying to solve a system of two nonlinear equations. the solution Did not converge to the values i have expected and it changes when i change the initial guess. the m-file i have used is the following:
global Q C T_u D_T lewis E a Da_v teta_v Y_fu R
Q=55700;
C=1.423512;
D_T=9.0697e7;
ro_u=1.135e-18;
B=3.5e6;
E=96.2964;
R=8.314e-3;
a=10;
lewis=1;
T_u=300;
Da_v=1;
teta_v=0.2;
phi_u=1;
Y_fu=(phi_u/(phi_u+17.18));
p_m_c=Y_fu*ro_u*10^21;
x0=[1400; 8e4];
options=optimset('Display','iter','TolX',1e-12);
x=fsolve(@two_eq_ghadimi,x0,options);
Y_FC=(C*(x(1)-T_u)/Q)
x_star=(1/(a*(D_T/x(2)^2)))
T_f=x(1)
S_L=x(2)
---------------------------------------------------------------------------
function f=two_eq_ghadimi(x)
global Q C T_u D_T B lewis E R a Da_v teta_v Y_fu
epsil=(R*(x(1))^2)/(E*(x(1)-T_u));
x_v=(sqrt(2*x(2)^2/(a*D_T)))*erfinv(1-(1-erf(real(x(2)/sqrt(2*a*D_T))))*teta_v);
kasr1=((x(2)^2+a*D_T*Da_v)/(2*a*D_T*Da_v));
kasr2=((x(2)^2-a*D_T*Da_v)/(2*a*D_T*Da_v));
kasr3=(x(2)^2/(a*D_T*Da_v));
kasr4=(a*D_T*(x_v)^2)/(2*x(2)^2);
kasr5=((x(2))^2)/(2*a*D_T);
gam1=(gammainc(real(-lewis*kasr5),real(kasr1),'upper'))*gamma(real(kasr1));
gam2=(gammainc(real(-lewis*kasr4),real(kasr1),'upper'))*gamma(real(kasr1));
omega=((sqrt(2*a*D_T/pi))*exp(-kasr5))/(x(2)*(1-erf(real(x(2)/sqrt(2*a*D_T)))));
f=[(x(2))^2-(2*D_T/(omega^2))*(epsil^2)*B*lewis*exp(-E/(R*x(1)));
-omega+(1/lewis)*(((2/lewis)^kasr2*Y_fu)/((-a*D_T/(x(2)^2))^kasr1*Da_v*(C*(x(1)-T_u)/Q)*x_v^kasr3))*(gam1-gam2)*exp(-lewis*kasr5)];
end
how can i fix that? thank you
0 件のコメント
採用された回答
Matt J
2013 年 7 月 10 日
編集済み: Matt J
2013 年 7 月 10 日
Apparently, your equations have multiple solutions and FSOLVE likely finds the one closest to your initial guess.
1 件のコメント
Matt J
2013 年 7 月 10 日
If you call fsolve with two outputs
[x,fval] = fsolve(fun,x0)
you can see if fval is close to zero. If so, it tells you you are getting legitimate solutions.
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Nonlinear Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!