Why are empty square brackets used in this fsolve function?
古いコメントを表示
Here is the fsolve code.
x0 = [0.001 0.001 0.001 0.993 1 0.0001 5.992 1 0.001 10 10 10]'
T = 1000
[x,fval] = fsolve(@Gibbs, x0, [ ], T)
I don't understand why the empty squre brackets are used..
If it's not used, it shows error message like 'Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue'.
The function of Gibbs is on the x, T (12x1 matrix)
function [ f ] = Gibbs( x,T )
R = 1.9872
ns = sum(x(1:9));
G01= 4.61e3; G02=28.249e3; G03=40.604e3; G04=-94.61e3; G05=-47.942e3; G08=-46.03e3; G09=26.13e3;
f(1,1) = 2*x(4)+x(5)+2*x(6)+x(8)-4
f(2,1) = 4*x(1)+4*x(2)+2*x(3)+2*x(7)+2*x(8)+6*x(9)-14
f(3,1) = x(1)+2*x(2)+2*x(3)+x(4)+x(5)+2*x(9)-2
f(4,1) = x(1)-ns*exp(-G01/(R*T)-1+x(1)/ns-(4*x(11)+x(12)))
f(5,1) = x(2)-ns*exp(-G02/(R*T)-1+x(2)/ns-(4*x(11)+2*x(12)))
f(6,1) = x(3)-ns*exp(-G03/(R*T)-1+x(3)/ns-(2*x(11)+2*x(12)))
f(7,1) = x(4)-ns*exp(-G04/(R*T)-1+x(4)/ns-(2*x(10)+x(12)))
f(8,1) = x(5)-ns*exp(-G05/(R*T)-1+x(5)/ns-(x(10)+x(12)))
f(9,1) = x(6)-ns*exp(-1+x(6)/ns-(2*x(10)))
f(10,1) = x(7)-ns*exp(-1+x(7)/ns-(2*x(11)))
f(11,1) = x(8)-ns*exp(-G08/(R*T)-1+x(8)/ns-(x(10)+2*x(11)))
f(12,1) = x(9)-ns*exp(-G09/(R*T)-1+x(9)/ns-(6*x(11)+2*x(12)))
end
1 件のコメント
Alex Sha
2020 年 3 月 14 日
Hi, I get the solution as below:
x1: 0.081717612832349
x2: 1.7165724341752E-7
x3: 3.00019124411767E-10
x4: 0.664820893821221
x5: 1.25346024909972
x6: 1.12289287107677E-11
x7: 5.4196651169683
x8: 1.41689796323103
x9: 4.50177027478041E-7
x10: 24.0518309842135
x11: 0.0510933495572929
x12: 1.1684109105753
Fevl:
-4.35029789969121E-12
1.92326155001865E-11
2.1870061317486E-11
-3.58435503500232E-13
1.75226624980123E-12
-7.92100894796531E-11
-1.33415500869205E-11
1.15079057394496E-11
1.1228928706591E-11
6.44639897018351E-12
2.51931808747941E-12
6.11379418893715E-12
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!