Too many output arguments in fsolve
古いコメントを表示
Dear all,
I trying to solve a system of algebraic equations with the fsolve function. I get the following error message, both with my own script and the example script provided with the documentation (SolutionwithNondefaultOptionsExample.m)
Error using prepareOptionsForSolver
Too many output arguments.
Error in fsolve (line 157)
[options, optionFeedback] = prepareOptionsForSolver(options, 'fsolve');
Error in SolutionWithNondefaultOptionsExample (line 32)
x = fsolve(fun,x0,options)
The function prepareOptionsForSolver is not documented, but the input from fsolve seems to correspond to what is required. Since this also arises in an example from the documentation, there should not be any problems with the syntax.
Does anybody know how to fix this problem? Do you know alternatives? I have tried using the vpasolve function, but my equations include the incomplete gamma function that cannot handle symbolics.
Thanks, Jens
4 件のコメント
Ameer Hamza
2020 年 4 月 1 日
Which MATLAB release are you using?
Jens Turowski
2020 年 4 月 1 日
Ameer Hamza
2020 年 4 月 1 日
編集済み: Ameer Hamza
2020 年 4 月 1 日
I am using R2020a so I cannot directly check the issue. Can you run
edit prepareOptionsForSolver
In command window and paste the first line in your comment (function definition) here.
Jens Turowski
2020 年 4 月 1 日
採用された回答
その他の回答 (1 件)
Ameer Hamza
2020 年 4 月 1 日
It appears that you have somehow overwritten the fsolve function provided by MATLAB. This line show
function options = prepareOptionsForSolver(options, solverName)
That prepareOptionsForSolver only gives one output. But In your error message shows that in your fsolve function, there is a line as follow
[options, optionFeedback] = prepareOptionsForSolver(options, 'fsolve');
which does not match the definition of prepareOptionsForSolver. I checked the definition of fsolve in R2020a, and it contains
options = prepareOptionsForSolver(options, 'fsolve');
I recommend first to check if MATLAB is using correct fsolve function by typing
which fsolve
If it points to MATLAB toolbox directory then I recommend to reinstall MATLAB to recover the original definition of fsolve
2 件のコメント
Jens Turowski
2020 年 4 月 1 日
Ameer Hamza
2020 年 4 月 1 日
Can you show the output of
which fsolve
カテゴリ
ヘルプ センター および File Exchange で Phased Array System Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!