Generate matrix at each iteration
Mostra commenti meno recenti
Dear friend, please help me to generate a matrix 'yy' which stores matrix "xx" in each iteration.
%% direct search methods
clc;
clear variables;
delta=[2;2];
eps=10^(-3);
%% BOX EVOLUTINARY OPTIMIZATION METHOD
x0=[1;1];
% k=(delta(1)^2+delta(2)^2)^0.5;
for i=1:3
x1=x0+[1;-1];
x2=x0+[-1;-1];
x3=x0+[-1;1];
x4=x0+[1;1];
xx=[x0 x1 x2 x3 x4];
yy=xx();
f(1)=diremtd(x0);f(2)=diremtd(x1);
f(3)=diremtd(x2);f(4)=diremtd(x3);f(5)=diremtd(x4);
A=[f(1),f(2),f(3),f(4),f(5)];
k=min(A);
for j=1:5
if k==f(j)
tt=xx(:,j);
t=f(j);
end
end
x0=tt;
end
THANK YOU
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Blue 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!