fsolve return same values for various inputs

6 次查看(过去 30 天)
I have a system of 8 equation and 8 unknown
with function
function G=Gt(a,P,Po,H2CO,GCH4,GH2O,GCO,GCO2,GH2,GC,T)
% number of element C H and O : 3
% aik i denoted species and k is elemnt
R=8.314467e-3; %kj-kg-k
a_CH4_C=1; a_CH4_H=4;a_CH4_O=0;
a_H2O_C=0; a_H2O_H=2;a_H2O_O=1;
a_CO_C=1; a_CO_H=0; a_CO_O=1;
a_CO2_C=1; a_CO2_H=0; a_CO2_O=2;
a_H2_C=0; a_H2_H=2;a_H2_O=0;
a_C_C=1; a_C_H=0; a_C_O=0;
% A_k k is elemnt in the mixture for example C
% A_C=a_CH4_C*noCH4+a_CO_C*noCO+a_CO2_C*noCO2+a_C_C*noC;
% A_H=a_CH4_H*noCH4+a_H2O_H*noH2O+a_H2_H*noH2;
% A_O=a_H2O_O*noH2O+a_CO_O*noCO+a_CO2_O*noCO2;
% a(1)=ych4 a(2)=yh2o a(3)=yco a(4)=yco2 a(5)=yh2 a(6)=yc
% ther are three lagrange multuolier: Gama_c (a(7), Gama_h a(8) and Gama_o
% a(9)
NCH4=a(1)^2;
NH2O=a(2)^2;
NCO=a(3)^2;
NCO2=a(4)^2;
NH2=a(5)^2;
NC=a(6)^2;
Gc=a(7)^2;
GH=a(8)^2;
GO=a(9)^2;
nt=NCH4+NH2O+NCO+NCO2+NH2+NC;
G(1)=NCH4+nt*exp(-(GCH4/(R*T)+a_CH4_C*Gc/(R*T)+a_CH4_H*GH/(R*T))); %CH4
G(2)=NH2O+nt*exp(-(GH2O/(R*T)+a_H2O_H*GH/(R*T)+a_H2O_O*GO/(R*T))); %H2O
G(3)=NCO+nt*exp(-(GCO/(R*T)+a_CO_C*Gc/(R*T)+a_CO_O*GO/(R*T))); %CO
G(4)=NCO2+nt*exp(-(GCO2/(R*T)+a_CO2_C*Gc/(R*T)+a_CO2_O*GO/(R*T))); %CO2
G(5)=NH2+nt*exp(-(GH2/(R*T)+a_H2_H*GH/(R*T))); %H2
G(6)=NC+nt*exp(-(GC/(R*T)+a_C_C*Gc/(R*T))); %H2
G(7)= a_CH4_C*NCH4+a_CO2_C*NCO2+a_CO_C*NCO+a_C_C*NC-1;
G(8)= a_CH4_H*NCH4+a_H2O_H*NH2O+a_H2_H*NH2-H2CO*2;
G(9)= a_H2O_O*NH2O+a_CO_O*NCO+a_CO2_O*NCO2-1;
% G(9)= NCH4+NH2O+NCO+NCO2+NH2+NC-1;
end
a0=[0.626 0.228 0.408 0.0375 0.268 0.91 1000 2400 100];
i recieved this answers:
Iteration Func-count f(x) step optimality
0 10 3.03569 4.96
1 20 3.03569 0.982623 4.96
2 30 1.42864 0.245656 1.67
3 40 0.539709 0.491311 0.351
4 50 0.461848 0.199711 0.095
5 60 0.459377 0.0498161 0.00399
6 70 0.459364 0.00484322 7.79e-05
7 80 0.459364 4.80893e-05 2.34e-06
8 90 0.459364 2.62314e-06 1.12e-07
9 100 0.459364 9.64716e-08 4.51e-09
10 110 0.459364 4.58492e-09 3.8e-09
No solution found.
fsolve stopped because the last step was ineffective. However, the vector of function
values is not near zero, as measured by the selected value of the function tolerance.
<stopping criteria details>
  1 个评论
Walter Roberson
Walter Roberson 2020-4-14
To test, we will need to know the values you are passing in for H2CO, GCH4, GH2O, GCO, GCO2, GH2 ,GC, T .
(You do not use P or Po so we can ignore those.)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by