Plotting x vector of fmincon

2 views (last 30 days)
Veeranki
Veeranki on 6 Sep 2014
Answered: Veeranki on 8 Sep 2014
Dear All,
I am trying to plot the x value of fmincon to show how the transition phase reaches its optimum value.
I will get x(1),x(2),(3),..... x(6)
Each x starts at initial point and reaches to its upper bound or to its lower bound. I would like to plot all the six variables on a single plot to present the transition of all the variables for every iteration.
I tried plotfn with options = optiset('Display', 'iter') it provides bars of the optimum values of variables.
It would also helpful if someone could help me how to save x variables for every iterations, so that i can plot.
Any suggestions are much appreciated.
Thank you,
Best Regards, Sai

Accepted Answer

Alan Weiss
Alan Weiss on 8 Sep 2014
Use an output function to save the values of x. There is more detail here. There is an example of saving the history here (careful, this example uses a different syntax than fmincon, but the idea is the same).
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (1)

Veeranki
Veeranki on 8 Sep 2014
Dear Alan,
I tried both of them, but i couldn't get the x values for every iterations. I am presenting the plot that plotfn is providing for my report.
Thank you for your reply.
if there exists any good solution for it, i would appreciate anyone posting it.
Best Regards,

Community Treasure Hunt

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

Start Hunting!