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 CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by