matlab遗传算法程序解读?%GA(Generic Algorithm) Program to optimize PID Parametersclear all;close all;global rin yout timefSize=30;CodeL=3;MinX(1)=zeros(1);MaxX(1)=20*ones(1);MinX(2)=zeros(1);MaxX(2)=1.0*ones(1);MinX(3)=zeros(1);MaxX(3)=1.0*one

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 01:45:30
matlab遗传算法程序解读?%GA(Generic Algorithm) Program to optimize PID Parametersclear all;close all;global rin yout timefSize=30;CodeL=3;MinX(1)=zeros(1);MaxX(1)=20*ones(1);MinX(2)=zeros(1);MaxX(2)=1.0*ones(1);MinX(3)=zeros(1);MaxX(3)=1.0*one
xTn@DnqQ(")R@Br;l]Q`Aţ-HH*X c_03'%@b&993f8ۉg._ξ>4;~~;^i PW' q# $L7\](AQ!;+\lD8d*D"ZjΓ>mfw&[("1 ̎] h 1I2Ff/mpnR“\q(G4f tno +bimGPB*]? 2 !TFeipq.n["߮o5M5SݫBjr%&aEphrv!;p` n|,!FxaaX.Cɠ$vII,%78b5y6*divMGA[i ]@^o!Hಛ" }ޥoQƢ0ŗo8hmؒsg;I {6 g tjAi.Ēlnq@[*|K铥>HE$%TTRLȌYgkt?{K!HNғɏ ~v0=Nxaͫf=` wT

matlab遗传算法程序解读?%GA(Generic Algorithm) Program to optimize PID Parametersclear all;close all;global rin yout timefSize=30;CodeL=3;MinX(1)=zeros(1);MaxX(1)=20*ones(1);MinX(2)=zeros(1);MaxX(2)=1.0*ones(1);MinX(3)=zeros(1);MaxX(3)=1.0*one
matlab遗传算法程序解读?
%GA(Generic Algorithm) Program to optimize PID Parameters
clear all;
close all;
global rin yout timef
Size=30;
CodeL=3;
MinX(1)=zeros(1);
MaxX(1)=20*ones(1);
MinX(2)=zeros(1);
MaxX(2)=1.0*ones(1);
MinX(3)=zeros(1);
MaxX(3)=1.0*ones(1);
Kpid(:,1)=MinX(1)+(MaxX(1)-MinX(1))*rand(Size,1);
Kpid(:,2)=MinX(2)+(MaxX(2)-MinX(2))*rand(Size,1);
Kpid(:,3)=MinX(3)+(MaxX(3)-MinX(3))*rand(Size,1);
G=100;
BsJ=0;
%
Pm=0.10-[1:1:Size]*(0.01)/Size; %Bigger fi,smaller Pm
Pm_rand=rand(Size,CodeL);
Mean=(MaxX + MinX)/2;
Dif=(MaxX-MinX);
for i=1:1:Size
for j=1:1:CodeL
if Pm(i)>Pm_rand(i,j) %Mutation Condition
TempE(i,j)=Mean(j)+Dif(j)*(rand-0.5);
end
end
end
%Guarantee TempE(Size,:) belong to the best individual
TempE(Size,:)=BestS;
Kpid=TempE;
end
Bestfi
BestS
Best_J=BestJ(G)
figure(1);
plot(time,BestJ);
xlabel('Times');ylabel('Best J');
figure(2);
plot(timef,rin,'r',timef,yout,'b');
xlabel('Time(s)');ylabel('rin,yout');

matlab遗传算法程序解读?%GA(Generic Algorithm) Program to optimize PID Parametersclear all;close all;global rin yout timefSize=30;CodeL=3;MinX(1)=zeros(1);MaxX(1)=20*ones(1);MinX(2)=zeros(1);MaxX(2)=1.0*ones(1);MinX(3)=zeros(1);MaxX(3)=1.0*one
遗传优化pid的吧 主要从复制交叉 变异三个方面考虑