Too many input arguments Fsolve

8 ビュー (過去 30 日間)
Ana Royce
Ana Royce 2016 年 8 月 18 日
コメント済み: Ana Royce 2016 年 8 月 25 日
Error using ==> derofexpexp2
function[derofexpexp1b,derofexp1a,derofexpexp1a]=derofexpexp2(rvar,eqdif,eqpardif,indexp1,indexpexp1)
Too many input arguments.
Error in ==> fsolve at 254
fuser = feval(funfcn{3},x,varargin{:});
Error in ==> paragexpexp at 56
zeroofder2p=fsolve('derofexpexp2',finnoearth(finpeakh,1),options2a,[],eqdif,eqdf3,indexpl1,indexexp1);

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 8 月 18 日
The objective function for fsolve is currently not defined to take more than one input.
Historically, extra parameters in the fsolve call were added as arguments to the objective function. That syntax has been obsolete and undocumented since MATLAB 5.1 and might or might not work.
If it does work, then in your call
fsolve('derofexpexp2',finnoearth(finpeakh,1),options2a,[],eqdif,eqdf3,indexpl1,indexexp1);
the argument finnoearth(finpeakh,1) would correspond to x0, and the argument options2a would correspond to options, leaving [], eqdif, eqdf3, indexp11, and indexexp1 as extra arguments. That would be 5 extra arguments in addition to the x argument, which would lead to 6 arguments passed to the function. But your function is only defined to take 5 arguments.
Please read http://www.mathworks.com/help/matlab/math/parameterizing-functions.html . (Unless, of course, you are still using MATLAB 4.x, which would be pretty major information that you would have been expected to mention already.)
  9 件のコメント
Walter Roberson
Walter Roberson 2016 年 8 月 25 日
Your options2a is a numeric vector, not an options structure. Is it intended to act as the initial values of the vector being solved on? If it is, then what is the role of finnoearth(finpeakh,1) ?
Your function uses parameters named rvar, eqdif, eqpardif, indexp1, and indexpexp1. How do your calling parameters finnoearth(finpeakh,1), options2a, eqdif, eqdf3, indexpl1, and indexexp1 correspond to each of those? Some of the matches look pretty obvious, but you have 6 inputs and only 5 parameters.
Ana Royce
Ana Royce 2016 年 8 月 25 日
Noted, understood. will work. Thank you.

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

Community Treasure Hunt

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

Start Hunting!

Translated by