?? collect_errors.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 + -