fsolve - "Not enough input arguments"

I've read all the relevant questions for fsolve and input arguments, and I believe I'm doing exactlyw aht the solutions recommend, but it won't work.
In a file saved to my MatLab path I have the function:
function f = pb446(x)
x1 = x(1);
m1 = x(2);
x4 = x(3);
m4 = x(4);
f(1) = x4 - .15*6000;
f(2) = x1 * m1 - .66*6000;
f(3) = (1-x1) * m1 + (1-x4) * m4 - 20;
f(4) = m1 / m4 - 4.4;
end
Then, in the command window:
fsolve(pb446, [1 1 1 1])
It correctly references the pb446 function as far as I can tell, but returns:
Not enough input arguments.
Error in pb446 (line 2)
x1 = x(1);
Even though I'm passing a vector of 4 values, it says there's not enough input. How can I make it accept the input?

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 9 月 22 日

0 投票

fsolve(@pb446, [1 1 1 1])

2 件のコメント

Suman Dutta
Suman Dutta 2018 年 1 月 14 日
doesn't help!!
Walter Roberson
Walter Roberson 2018 年 1 月 14 日
Please post your complete error message, everything in red.

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

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

質問済み:

2016 年 9 月 22 日

コメント済み:

2018 年 1 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by