In the code below, what does ind do?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ifeatu Ezenwe
am 9 Dez. 2018
Beantwortet: Star Strider
am 9 Dez. 2018
cost=feval(ff,pop); %evaluate function
[cost,ind]=sort(cost,'descend'); %sorts in descending order
pop=pop(ind,:);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 9 Dez. 2018
It evaluates a function called ‘ff’ with the argument ‘pop’, and assigns it to the variable ‘cost’. It then sorts ‘cost’, gets the associated indices (‘ind’)into the original vector, and uses those indices to re-define ‘pop’, sorting it according to ’cost’.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!