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

📄 updatepop1.m.txt

📁 求解对问题的matlab程序直接运行就可的到结果
💻 TXT
字号:
%粒子群速度与位置更新与修正
%更新粒子速度
for i=1:popsize
    w=0.9-iter*(0.9-0.4)/gen;
    c=c1+c2;
    t=2/abs(2-c-(c^2-4*c)^(1/2));
    %更新速度
    pop(i,5)=t*(w*pop(i,5)+c1*rand()*(pop(i,9)-pop(i,1))+c2*rand()*(gbest_x1-pop(i,1)));
    pop(i,6)=t*(w*pop(i,6)+c1*rand()*(pop(i,10)-pop(i,1))+c2*rand()*(gbest_x1-pop(i,1)));
    pop(i,7)=t*(w*pop(i,7)+c1*rand()*(pop(i,11)-pop(i,1))+c2*rand()*(gbest_x1-pop(i,1)));
    pop(i,8)=t*(w*pop(i,8)+c1*rand()*(pop(i,12)-pop(i,1))+c2*rand()*(gbest_x1-pop(i,1)));
    %修正粒子速度
    for j=5:8
        if abs(pop(i,j))>max_velocity;
            if pop(i,j)>0
                pop(i,j)=max_velocity;
            else
                pop(i,j)=-max_velocity;
            end
        end
    end
    %更新粒子位置
    for j=1:4
        pop(i,j)=pop(i,j)+pop(i,j+4);
    end
end

⌨️ 快捷键说明

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