How to show value after every fsolve iteration?

5 ビュー (過去 30 日間)
DavidS
DavidS 2015 年 2 月 13 日
コメント済み: Alan Weiss 2015 年 2 月 17 日
I am using fsolve to solve 9 equations with 9 unknowns. I am using the option optimset('Display','iter-detailed') to get some information after every iteration. My question is how do I get the value of my unknowns after every iteration? I would like to see how my unknowns are converging toward a solution. Is there any way to extract this?
Thank you.

回答 (1 件)

Alan Weiss
Alan Weiss 2015 年 2 月 17 日
You can set the PlotFcns option to @optimplotx to see the unknowns at each iteration. You can also write an output function to store the values of the variables as the iterations proceed.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 件のコメント
DavidS
DavidS 2015 年 2 月 17 日
Thank you for your answer. I do want to store the iterated values, or at least just see a graph of the evolution of each of my unknowns. I tried to follow the explanation on how to use output functions but I couldn't follow. The first step that is given is simply "Write the output function as a function file or local function." I looked for information on how to do this but couldn't do it. I find it surprising that there is no clear help on how to do this seemingly simple task. Would you mind giving me a few pointers on how to begin writing the output function? This ought to be simpler than it's looking...
Alan Weiss
Alan Weiss 2015 年 2 月 17 日
Here is an example that uses an output function for fminsearch.
Here is an example using an output function for fmincon.
Alan Weiss
MATLAB mathematical toolbox documentation

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by