How do I plot the progress of fmincon to see the convergence of the approximation?

I want to see the output at each iteration of the optimization. I am solving for MPC and want to plot the entire future solution at each iteration of the algorithm to see how the system behaves throughout the optimization process. I tried the PlotFcns option but this doesn't give me the vector of outputs, I think just the first element. Is there a way to do this?

8 Comments

You should do it with OutputFcns, there's a link here to help.
Edit: Sorry for the yesterday's minimal reply, I have a question, what is the value of your objective function? IIRC, fmincon accepts only scalar value for objective function. Are you taking only one element from your column vector and setting it as an objective function value?
The result of the objective function is scalar, but it is computed using all the preview points as well as the commands to acheive them.
MPC stands for Model Predictive Control?
How do you calculate 'entire future solution at each iteration'?
We just calculate a sufficiently long range or window into the future using a model of the system in order to react to the given path appropriately. At any given point we don't need the entire path if it's very long.
Sorry, can't really connect the dots.
But yeah, OutputFcn link from above should be the way to solve it.
I'd be glad to discuss it more with you directly instead of through this medium if you want to start a discussion through email.
Yes, thanks for the link. It was what I was looking for.
Unfortunately, my background is not in EE, so control-stuff is not my cup of tea.

Sign in to comment.

Answers (0)

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Products

Release

R2020b

Tags

Asked:

on 12 Oct 2020

Commented:

on 14 Oct 2020

Community Treasure Hunt

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

Start Hunting!