Unconstrained Optimization using fminunc and plotting convergence history
Show older comments
I have solved an unconstrained optimization problem using fminunc. I now want to plot the convergence history, ie , plotting the function value at each iteration of a graph. How do I extract the iteration and function value arrays so that I can do so?
clear all
close all
clc
fun=@(x)((x(1)-10*x(2)).^2)+(5*(x(3)-x(4))^2)+((x(2)-2*x(3))^4)+(10*(x(1)-x(4))^2);
x0=[1,2,3,4];
[x,fval]=fminunc(fun,x0)
options = optimoptions(@fminunc,'Display','iter','Algorithm','quasi-newton');
1 Comment
Walter Roberson
on 31 Oct 2018
Why not use PlotFcn option?
Answers (0)
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!