[T,1];denc=[beta*T,1];?%定义校正装置传函Р[num1,den1]=series(num,den,numc,denc);%求校正后传函Р[Gm,Pm,Wcg,Wcp]=margin(num1,den1);%求系统校正后的幅值域度和相角域度Рif(Pm>=r0);break;end;РendРprintsys(numc,denc)Р[mag2,phase2]=bode(numc,denc,w);Р[mag,phase]=bode(num1,den1,w);Рsubplot(2,1,1);Рsemilogx(w,20*log10(mag),w,20*log10(mag1),'--',w,20*log10(mag2),'-.');Рgrid;Рylabel('幅值(db)');Рtitle('绿-校正前红-校正蓝-校正后');Рsubplot(2,1,2);Рsemilogx(w,phase,w,phase1,'--',w,phase2,'-.',w,(w-180-w),':');Рgrid;Рylabel('相角(度)') ;xlabel('频率(rad/sec)');Рdisp(['校正后:幅值穿越频率=',num2str(Wcp),'rad/sec,','相角穿越频率=',num2str(Wcg),'rad/sec']);Рdisp(['校正后;幅值裕度=',num2str(20*log10(Gm)),'dB,','相角裕量?=',num2str(Pm),'du']);;Рnum/den = Р Р 50 s + 1Р -----------------Р 297360.0397 s + 1Р校正后:幅值穿越频率=0.10188rad/sec,相角穿越频率=1.0766rad/secР校正后;幅值裕度=26.2881dB,相角裕量?=68.3666du