Too many input arguments Fsolve

8 views (last 30 days)
Ana Royce
Ana Royce on 18 Aug 2016
Commented: Ana Royce on 25 Aug 2016
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);

Answers (1)

Walter Roberson
Walter Roberson on 18 Aug 2016
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 Comments
Walter Roberson
Walter Roberson on 25 Aug 2016
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 on 25 Aug 2016
Noted, understood. will work. Thank you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!