How to show value after every fsolve iteration?

12 Ansichten (letzte 30 Tage)
DavidS
DavidS am 13 Feb. 2015
Kommentiert: Alan Weiss am 17 Feb. 2015
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.

Antworten (1)

Alan Weiss
Alan Weiss am 17 Feb. 2015
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 Kommentare
DavidS
DavidS am 17 Feb. 2015
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 am 17 Feb. 2015
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

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by