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

📄 ep8_2.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%%% Exploratory problem 8.2 %%%%%%%%%%%%%   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                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   ---- PD controller design ----%cleardisp('Exploratory Problem 8.2')Ts = 0.005;	             		    % sampling periodGp_s = tf(1200,conv(conv([1 0],[1 10]),conv([1 30],[1 40])));Gp_s = ss(Gp_s);                    % continuous processH_s = tf(1,[0.02 1]);G_s = [1; H_s]*Gp_s;                % form 1 input, 2 output systemG_z = c2d(G_s,Ts,'zoh');	        % discrete plantdtime  = 0:Ts:1;symbols = ['o' '+' '*' 'd' 'v'];    % different plot symbolsfor KD = 0.1:0.1:0.4,  figure  results = [];  Pgains = [];  hold on  for ii = 1:5,		% KP values are: 35, 40, 45, 50, 55    KP = 35+5*ii;    %-- write Gc(z) as sum of 3 LTI objects in TF form --    Gc = KP*(tf(1,1,Ts) ...			% porportional	+ tf(KD*[1 -1],[Ts 0],Ts)); 	% derivative    % reference input - CL transfer fcn    Tref_z = feedback(G_z*Gc,1,1,2);    y = step(Tref_z,dtime);         % CL response to step input    ref = dcgain(Tref_z(1,1));    y1 = y(:,1);    [Mo,tpeak,trise,tsettle,ess] = kstats(dtime,y1,ref);    ymax = y1(find(dtime == tpeak));    yss = y1(length(dtime));    results = [results; [KP KD trise tpeak tsettle  Mo]];    Pgains = [Pgains KP];    disp(['KP = ',num2str(KP)])    plot(dtime,y1,symbols(ii))    pause(1)  end  % for ii..  hold off                          % turn hold off after last plot  xlabel('Time (s)')  ylabel('Step Response')  title(['EP8.2 - Step Responses for Different ',...        'Values for KP, where and KD = ',num2str(KD)])   grid on  text('Units','norm','Pos',[0.2,0.10],'Str',['KD = ',num2str(KD)])  legend('KP = 35','KP = 40','KP = 45','KP = 50','KP = 55')   %----- print results table  disp(' ')  disp('      KP       KD     t_rise      t_peak      tsettle     M_o (pct)')  disp('    ---------------------------------------------------------------')  disp(results)  disp('    ---------------------------------------------------------------')  disp(' ')end  % for KD..disp('A good choice is KP = 50 and KD = 0.1')disp('Completed EP8.2')%%%%%%%%%%

⌨️ 快捷键说明

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