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

📄 updatepop.m

📁 粒子群优化(PSO)标准算法
💻 M
字号:
%粒子群速度与位置更新


%更新粒子速度
for i=1:popsize
    for k=1:n
        pop(i,n+k)=rand*pop(i,n+k)+c1*rand*(pop(i,2*n+k)-pop(i,k))+c2*rand*(gbest(k)-pop(i,k));    %更新速度
        if abs(pop(i,n+k))>max_velocity
           if pop(i,n+k)>0
              pop(i,n+k)=max_velocity;
           else
              pop(i,n+k)=-max_velocity;
           end
        end        
    end
end

%更新粒子位置
for i=1:popsize
    for k=1:n
        pop(i,k)=pop(i,k)+pop(i,n+k);
    end
end

⌨️ 快捷键说明

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