📄 ex0408.m
字号:
clear;
vizAxes = plot(0,0, 'o');
axis([-10 10 -10 10 -10 10]); %Initially set to a cube of this size
axis square;
grid off;
set(vizAxes,'EraseMode','xor','MarkerSize',8); %Set it to show particles.
pause(1);
GBest = [1 2 3 4 5 6 7 8 9];
Dimensions = 9;
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,:)));
% Generation = 500;
%
% 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+100 yAx-zf yAx+zf zAx-zf zAx+zf]);
% end
%
% title(Generation);
% drawnow;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -