Code covered by the BSD License  

Highlights from
Another Particle Swarm Toolbox

image thumbnail
from Another Particle Swarm Toolbox by Sam
Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox.

psoplotscores(options,state,flag)
function [state,options] = psoplotscores(options,state,flag)
% Plots the best and mean scores of particle swarm.

if strcmp(flag,'init')
    set(gca,'NextPlot','replacechildren',...
        'XLabel',xlabel('Scores'),...
        'YLabel',ylabel('Number of inidividuals'))
end

[n,bins] = hist(state.Score) ;
bar(bins,n,'Tag','scorehistogram','FaceColor',[0.1 0.1 0.5])

Contact us at files@mathworks.com