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

📄 ex8_3c.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%%%%%%%% Example 8.3(c) %%%%%%%%%%%%%%%%%   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 for final KD & KI gains for PID Control  ----%cleardisp('Example 8.3(c)') Ts = 0.1;			                % sampling periodGp_s = tf(4,conv([2 1],[0.5 1]));   % continuous processH_s = tf(1,[0.05 1]);		        % continuous sensorHGp_s = H_s*Gp_s                    % continous plantHGp_z = c2d(HGp_s,Ts,'zoh')         % discrete plant, using ZOH option KI = 0.5; KD = 0.45;%----- PID controller with KP = 1 -------Gc = (tf(1,1,Ts) ...                         % porportional = 1        + tf([KI*Ts  0],[1 -1],Ts) ...       % integral        + tf(KD*[1 -1],[Ts 0],Ts));          % derivative %----- open-loop system, with KP = 1 Gol = HGp_z*Gc%---- first, show large area ------figure, ucircle, hold onrlocus(Gol), hold offaxis([-6 2 -4 4])text('Units','norm','Pos',[0.1,0.10],'Str',['KI = ',num2str(KI)])text('Units','norm','Pos',[0.1,0.05],'Str',['KD = ',num2str(KD)])disp('******>'), pause%---- then show smaller area ------figure, ucircle, hold onrlocus(Gol)zgrid(0.8,[]), hold offaxis([-1.2 1.2 -1.2 1.2])text('Units','norm','Pos',[0.1,0.10],'Str',['KI = ',num2str(KI)])text('Units','norm','Pos',[0.1,0.05],'Str',['KD = ',num2str(KD)]) disp('******>'), pause%---- then show smaller area for use with rlocfind cmd ------figureucircle, hold onrlocus(Gol)dzline(0.6), hold offaxis([0.0 1.2 -0.1 1.1])text('Units','norm','Pos',[0.1,0.1],'Str',['KI = ',num2str(KI)])text('Units','norm','Pos',[0.1,0.05],'Str',['KD = ',num2str(KD)])disp('select point for marginal stablity')[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);[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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -