ex8_3b2.m

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

M
45
字号
%%%%%%%%%%%%%%%% Example 8.3(b2) %%%%%%%%%%%%%%%%%   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                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   ----  Proportional-Integral-Derivative Control  ----%cleardisp('Example 8.3(b2)')Ts = 0.1;			                % sampling perioddtime  = 0:Ts:2;Gp_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.50; 	KD = 0.45;KP = 1.95;%-- write Gc(z) as sum of 3 LTI objects in TF form --Gc = KP*(tf(1,1,Ts) ...				% porportional	+ tf([KI*Ts  0],[1 -1],Ts) ...	% integral	+ tf(KD*[1 -1],[Ts 0],Ts)); 	% derivative%------- reference input - CL transfer fcnTref_z = Gp_z*Gc/(1+HGp_z*Gc);Tref_z = minreal(Tref_z);           % remove pole-zero cancellationsy = step(Tref_z,dtime);             % CL response to step inputref = dcgain(Tref_z);[Mo,tpeak,trise,tsettle,ess] = kstats(dtime,y,ref);ymax = y(find(dtime == tpeak));yss = y(length(dtime));figureplot(dtime,y,'o'); gridxlabel('Time (s)')ylabel('Step Response')title(['Example 8.3(b2) - Step Response for KP = ',num2str(KP),...	'; KI = ',num2str(KI),'; KD = ',num2str(KD)]) %%%%%%%%%%

⌨️ 快捷键说明

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