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

📄 ex8_2c.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%%%%%%%% Example 8.2(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                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   ----  Step responses with PI control  ----%cleardisp('Example 8.2(c)')%--- find best KP for fixed KI value%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 + sensorKP = 0.563; KI = 0.50;  	                    % Mo = 10.002 (10 pct step OS for ref input)Gc  = KP*tf([1+KI*Ts  -1],[1 -1],Ts); % PI controllerdtime = 0:Ts:8;%------- reference input - CL transfer fcnTref_z = Gp_z*Gc/(1+HGp_z*Gc)Tref_z = minreal(Tref_z);           % remove pole-zero cancellationsy_ref = step(Tref_z,dtime);%------- disturbance input - CL transfer fcnTdist_z = Gp_z/(1+HGp_z*Gc)Tdist_z = minreal(Tdist_z);         % remove pole-zero cancellationsy_dist = step(Tdist_z,dtime);%------- plot responses ----------figure hold onplot(dtime,y_ref,'bo');gridplot(dtime,y_dist,'r+')hold offxlabel('Time (s)')ylabel('Amplitude')title(['Example 8.2(c) - Responses to step reference (o) and ',...       'disturbance(+) inputs'])text('Units','norm','Pos',[0.5,0.76],'Str','reference')text('Units','norm','Pos',[0.37,0.15],'Str','disturbance')text('Units','norm','Pos',[0.8,0.50],'Str',['KP = ',num2str(KP)])text('Units','norm','Pos',[0.8,0.40],'Str',['KI = ',num2str(KI)])hold off%------ steady state valuesy_ref_ss = y_ref(end)y_dist_ss = y_dist(end)%----- compute prcent OSpct_OS = 100 * (max(y_ref)/y_ref_ss - 1)%%%%%%%%%%

⌨️ 快捷键说明

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