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

📄 ex8_3d.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%%%%%%%% Example 8.3(d) %%%%%%%%%%%%%%%%%   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(d)') 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_s = H_s*Gp_s                    % continous plantHGp_z = c2d(HGp_s,Ts,'zoh')         % discrete plant, using ZOH option KI = 0.5; KD = 0.45;KP = 1.95;%----- PID controller -------Gc = KP*(tf(1,1,Ts) ...                      % prorportional         + tf([KI*Ts  0],[1 -1],Ts) ...       % integral        + tf(KD*[1 -1],[Ts 0],Ts));          % derivative dtime = 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);         % CL response to step inputref = dcgain(Tref_z);%------- 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 offaxis([0 8 0 1.20001])xlabel('Time (sec)')ylabel('Amplitude')title(['Example 8.3(d) - Responses to step reference (o) and ',...       'disturbance(+) inputs'])text('Units','norm','Pos',[0.5,0.77],'Str','reference')text('Units','norm','Pos',[0.5,0.10],'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)])text('Units','norm','Pos',[0.8,0.30],'Str',['KD = ',num2str(KD)])%---- steady state values...Note that 'end' denotes last elementy_ref_ss = y_ref(end)y_dis_ss = y_dist(end)%%%%%%%%%%

⌨️ 快捷键说明

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