Unconstrained Optimization using fminunc and plotting convergence history

5 次查看(过去 30 天)
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');

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by