12.01.2013 Views

MATLAB Code

MATLAB Code

MATLAB Code

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

228 <strong>MATLAB</strong> CODE<br />

underlimit=par>=0;<br />

par=par.*overlimit+not(overlimit);<br />

par=par.*underlimit;<br />

% Evaluate the new swarm<br />

cost = feval(ff,par); % evaluates cost of swarm<br />

% Updating the best local position for each particle<br />

bettercost = cost < localcost;<br />

localcost = localcost.*not(bettercost) +<br />

cost.*bettercost;<br />

localpar(find(bettercost),:) =<br />

par(find(bettercost),:);<br />

% Updating index g<br />

[temp, t] = min(localcost);<br />

if temp

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!