ex8_2b.m

来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 64 行

M
64
字号
%%%%%%%%%%%%%%%%% Example 8.2(b) %%%%%%%%%%%%%%%%%   Discrete-Time Control Problems using        %%       MATLAB and the Control System Toolbox   %%   by J.H. Chow, D.K. Frederick, & N.W. Chbat  %%         Brooks/Cole Publishing Company        %%                September 2002                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   ----  Root-locus plot for PI control  ----%cleardisp('Example 8.2(b)')Ts = 0.1;			                % sampling periodGp_s = tf(4,conv([2 1],[0.5 1]));   % continuous processH_s = tf(1,[0.05 1]);		        % continuous sensorGp_z = c2d(Gp_s,Ts,'zoh');	        % discrete plant (no sensor)HGp_z = c2d(H_s*Gp_s,Ts,'zoh');     % discrete plant + sensorKI = 0.5KP = 1;		                        % fix KP at unity for root-locus plotGc  = KP*tf([1+KI*Ts  -1],[1 -1],Ts);     % PI control lawGol = HGp_z*Gc;%---- first, show large area ------figure, ucircle, hold onrlocus(Gol)zgrid(0.8,[]),hold offaxis([-8 2 -5 5])title('Example 8.2(b) - Large-area Root locus for PI control')disp('******>'), pause%---- then show smaller area ------figure, ucircle, hold onrlocus(Gol)zgrid(0.8,[]), hold offaxis([-1.5 1.5 -1.5 1.5])title('Example 8.2(b) - Root Locus for PI control with KP varying, KI fixed')text('Units','norm','Pos',[0.1,0.1],'Str',['KI = ',num2str(KI)])disp('******>'), pause%---- then show smaller area for use with rlocfind cmd ------figure, ucircle, hold on           % add unit circle plotrlocus(Gol), hold offaxis([0.6 1.2 -0.1 0.55])          % adjust region plottedtitle('Example 8.2(b) - Root Locus for PI control with KP varying, KI fixed')text('Units','norm','Pos',[0.1,0.1],'Str',['KI = ',num2str(KI)])disp('select point for marginal stablity')[kk,pCL] = rlocfind(Gol)           % calibrate locus with gains[mag_pCL,theta_pCL] = xy2p(pCL);[kk,pCL] = rlocfind(Gol)[mag_pCL,theta_pCL] = xy2p(pCL);[kk,pCL] = rlocfind(Gol)[mag_pCL,theta_pCL] = xy2p(pCL);[kk,pCL] = rlocfind(Gol)[mag_pCL,theta_pCL] = xy2p(pCL);[kk,pCL] = rlocfind(Gol)[mag_pCL,theta_pCL] = xy2p(pCL);[kk,pCL] = rlocfind(Gol)[mag_pCL,theta_pCL] = xy2p(pCL);disp('Click on root locus curve to find gain, pole, ')disp('damping ratio, overshoot, and frequency.')%%%%%%%%%%

⌨️ 快捷键说明

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