フィルターのクリア

Fsolve iter display not printing

7 ビュー (過去 30 日間)
Pradyoth Harish Shandilya
Pradyoth Harish Shandilya 2021 年 6 月 23 日
回答済み: Zuber Khan 2024 年 5 月 10 日
I am trying to use Fsolve with the display option, but I don't see anything being displayed while the function is running. What could be wrong? Here's an excerpt of my code.
options = optimoptions('fsolve','Display','iter-detailed');
disp("Starting fsolve")
cf = @calF;
u = fsolve(cf,ucp,options);

回答 (1 件)

Zuber Khan
Zuber Khan 2024 年 5 月 10 日
Hi,
Your code seems correct syntax-wise. However, there can be issues with the way your objective function 'calF' is defined.
Kindly try to run a test code on your machine, invoking the 'fsolve' solver to see if there is an issue with the objective function handle or with 'fsolve' itself. I am attaching a reference script for your help:
options = optimoptions('fsolve','Display','iter-detailed');
disp("Starting fsolve")
testFunc = @(x) sin(x) + x; % test function
initialGuess = -1;
out = fsolve(testFunc, initialGuess, options);
If you see detailed iterations for this test case, the issue might be specific to your objective function 'calF'. Please note that as mentioned in the limitations section of the documentation, the function to be solved using 'fsolve' solver must be continuous. For better clarity, you can refer to the doc here:
However, if you do not see the output for the above test case as well, then you need to check your MATLAB Environment. Kindly ensure that you have Optimization Toolbox installed along with MATLAB.
I hope this will resolve your query.
Regards,
Zuber

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by