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

📄 collect_errors.m

📁 其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載
💻 M
字号:
% collect_errors.m

% Round #1
if MAIN_loop==1
    Emin=1e6;
end;    
K=17661.1;a1=29.73;a2=21.033;
[T X Y]=sim(MDL,[0 FT]); 
err=Y(:,3); N=length(err);err=err(N);
stp=Y(:,4); stp=stp(N);
ERR1=err+1000*stp;
if MAIN_loop==1
    in=Y(:,1);y=Y(:,2);
    figure(2);subplot(231);plot(T,[in y]);grid;
    title('I/O step reponses,Normal plant');
end;    
% Round #2
K=17661.1;a1=29.73;a2=21.033;
K=2.5*K; a1=0.4*a1; a2=0.4*a2;
[T X Y]=sim(MDL,[0 FT]); 
err=Y(:,3); N=length(err);err=err(N);
stp=Y(:,4); stp=stp(N);
ERR2=100*(err)+1000*stp;
if MAIN_loop==1
    in=Y(:,1);y=Y(:,2);
    figure(2);subplot(232);plot(T,[in y]);grid;
    title('Plant:2.5K,0.4a1,0.4a2');
end;    
% Round #3
K=17661.1;a1=29.73;a2=21.033;
K=0.4*K; a1=0.4*a1; a2=0.4*a2;
[T X Y]=sim(MDL,[0 FT]); 
err=Y(:,3); N=length(err);err=err(N);
stp=Y(:,4); stp=stp(N);
ERR3=err+1000*stp;
if MAIN_loop==1
    in=Y(:,1);y=Y(:,2);
    figure(2);subplot(233);plot(T,[in y]);grid;
    title('Plant:0.4K,0.4a1,0.4a2');
end;    
% Round #4
K=17661.1;a1=29.73;a2=21.033;
K=0.4*K; a1=2.5*a1; a2=2.5*a2;
[T X Y]=sim(MDL,[0 FT]); 
err=Y(:,3); N=length(err);err=err(N);
stp=Y(:,4); stp=stp(N);
ERR4=err+1000*stp;
if MAIN_loop==1
    in=Y(:,1);y=Y(:,2);
    figure(2);subplot(234);plot(T,[in y]);grid;
    title('Plant:0.4K,2.5a1,2.5a2');
end;    
% Round #5
K=17661.1;a1=29.73;a2=21.033;
K=2.5*K; a1=2.5*a1; a2=2.5*a2;
[T X Y]=sim(MDL,[0 FT]); 
err=Y(:,3); N=length(err);err=err(N);
stp=Y(:,4); stp=stp(N);
ERR5=err+1000*stp;
if MAIN_loop==1
    in=Y(:,1);y=Y(:,2);
    figure(2);subplot(235);plot(T,[in y]);grid;
    title('Plant:2.5K,2.5a1,2.5a2');
end;    

xlabel(['Time(s),Kp=' num2str(Kp) ';Ki=' num2str(Ki) ';Kd=' num2str(Kd)]);
K=17661.1;a1=29.73;a2=21.033;

⌨️ 快捷键说明

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