Too many input arguments Fsolve
Afficher commentaires plus anciens
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);
Réponses (1)
Walter Roberson
le 18 Août 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 commentaires
Ana Royce
le 18 Août 2016
Walter Roberson
le 18 Août 2016
Parameterize your function the way shown in the link.
Walter Roberson
le 19 Août 2016
zeroofder2p = fsolve(@(x) derofexpexp2(x, eqdif, eqdf3, indexpl1, indexexp1), finnoearth(finpeakh,1), options2a);
Ana Royce
le 24 Août 2016
Walter Roberson
le 24 Août 2016
I see you passing in options2a in the options argument, but you have not shown what you assign to options2a.
Note: I was assuming from the name that it was indeed the options parameter and not one of your additional parameters like eqdf3
Ana Royce
le 25 Août 2016
Modifié(e) : Walter Roberson
le 25 Août 2016
Walter Roberson
le 25 Août 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
le 25 Août 2016
Catégories
En savoir plus sur Common Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!