fmincon optimization in matlab using OutputFcn
Mostra commenti meno recenti
Hi all
i have this example and i want to save the x viarable in each iteration not only see the final value How can i do it . all i found is using OutputFcn but i dont know how can i do it in this example below . thank you very much for your helping
fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2;
A = [];
b = [];
Aeq = [];
beq = [];
lb = [];
ub = [];
x0 = [0,0];
options = optimoptions('fmincon','Display','iter');
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,[],options)
2 Commenti
Mario Malic
il 25 Set 2020
Modificato: Mario Malic
il 25 Set 2020
Check here https://ch.mathworks.com/help/optim/ug/output-function.html there are some examples if you use the search option.
mohammed hussein
il 25 Set 2020
Risposta accettata
Più risposte (1)
Walter Roberson
il 25 Set 2020
0 voti
shows an example complete with code. The runfmincon() function returns a structure in which you can ask to see all the x values.
2 Commenti
Michael Croucher
il 25 Set 2020
That will teach me to hit 'refresh' before writing an answer :)
mohammed hussein
il 25 Set 2020
Categorie
Scopri di più su Surrogate Optimization in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!