⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewclusters.m

📁 基于MATLAB的微粒群工具箱
💻 M
字号:
%DrawSwarm >> Internal function of psotoolbox.
% Purpose: To draw a visual display of the Swarm.
% 
% You shouldn't need to mess around with this fn. if u don't wanna change the visualization.
% 
% see also: pso.m
%
function ViewClusters(Generation, Dimensions, GBest, vizAxes)
N = Dimensions / 3;
X = reshape(GBest,3,N);
set(vizAxes,'XData',X(3,:).*cos(X(1,:)).*cos(X(2,:)),'YData', X(3,:).*sin(X(1,:)).*cos(X(2,:)), 'ZData', X(3,:).*sin(X(2,:)));

GenDiv = 100;
xAx = GBest(1);
yAx = GBest(2);
zAx = GBest(3);

zf = 100 * 50/Generation; %zoom factor

if rem(Generation, GenDiv) == 0
    axis([xAx-zf xAx+zf yAx-zf yAx+zf zAx-zf zAx+zf]);
end

title(Generation);
drawnow;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -