I do some revisions to my equation but I still got no answer. It says that there is no enough input argument. Can someone please help me?

1 回表示 (過去 30 日間)
function f=rle(x)
f(1)=x(2)+x(3)+x(5)+x(7)-2758.6474;
f(2)=2*x(1) + 2*x(4) + 4*x(5)-5684.5402;
f(3)=x(2) +2*x(3)+x(4)-4292.1525;
f(4)=2*x(6)-6422.3564;
f(5)=((x(1)^3)*(x(2))/(x(4)*x(5)))-(1893.12055);
f(6)=(x(1)*x(3))/(x(2)*x(4))-(0.7631343);
f(7)=((x(1)*x(2))/x(4))-(32.200985);
>> x0=[150;150;150;150;150;150;150];
x=fsolve(rle,x0);
Not enough input arguments.
Error in rle (line 2)
f(x)=x(2)+x(3)+x(5)+x(7)-2758.6474;

採用された回答

VBBV
VBBV 2022 年 5 月 11 日
編集済み: VBBV 2022 年 5 月 11 日
x0=[150;150;150;150;150;150;150];
% x = 1:7; % give input vector to fucntion
sol=fsolve(@rle,x0) % call the function using function handle
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
sol = 7×1
1.0e+03 * 0.1914 0.2365 1.3252 1.4052 0.6228 3.2112 0.5741
plot(sol)
function f=rle(x)
f(1)=x(2)+x(3)+x(5)+x(7)-2758.6474;
f(2)=2*x(1) + 2*x(4) + 4*x(5)-5684.5402;
f(3)=x(2) +2*x(3)+x(4)-4292.1525;
f(4)=2*x(6)-6422.3564;
f(5)=((x(1)^3)*(x(2))/(x(4)*x(5)))-(1893.12055);
f(6)=(x(1)*x(3))/(x(2)*x(4))-(0.7631343);
f(7)=((x(1)*x(2))/x(4))-(32.200985);
end
  1 件のコメント
Alex Sha
Alex Sha 2022 年 5 月 11 日
There are multi-solutions:
No. 1 2
x1 -206.504477863007 191.355831175864
x2 -249.192353855846 236.471139659005
x3 1471.63884269976 1325.22038022388
x4 1598.06716845633 1405.24059989323
x5 725.353704703337 622.836834465451
x6 3211.1782 3211.1782
x7 810.847206452752 574.119045651664

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by