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’.
In the code below, what does ind do?
16 次查看(过去 30 天)
显示 更早的评论
cost=feval(ff,pop); %evaluate function
[cost,ind]=sort(cost,'descend'); %sorts in descending order
pop=pop(ind,:);
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!