📄 ex7_6.m
字号:
%%%%%%%%%%%%%%%%%% Example 7.6 %%%%%%%%%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Frequency-response performance ----
%
clear
disp('Example 7.6')
Ts = 0.1; % sampling time
Gp = tf(1,[1 1 0]) % plant in continuous tf form
Gz = c2d(Gp,Ts,'zoh') % discretize using zero-order hold
Gc = tf(5*[1 -0.9],[1 -0.7],Ts) % controller in discrete tf form
disp('******>'), pause
figure
margin(Gz*Gc) % Figure 7.10(a)
disp('Click on the frequency response curves to find')
disp('frequency response values')
disp('******>'), pause
T = feedback(Gz*Gc,1) % build CL transfer function T(z)
[mag_CLdB,ph_CL,w] = bodedb(T); % CL magnitude in dB & phase
lfg_CL = dcgain(T) % dc gain as ratio
lfg_CLdB = 20*log10(lfg_CL); % dc gain in decibels
disp('******>'), pause
bw = bwcalc(mag_CLdB,w,lfg_CLdB) % closed-loop bandwidth in rad/s
[M_pw,ii] = max(mag_CLdB) % maximum CL frequency response
wp = w(ii) % .....at this frequency (rad/s)
disp('******>'), pause
S = feedback(1,Gz*Gc) % sensitivity function S(z)
[magS_dB,phS] = bodedb(S,w); % sensitivity frequency response
[maxS,jj] = max(magS_dB) % maximum sensitivity magnitude
w(jj) % ...at this frequency (rad/s)
disp('******>'), pause
figure
semilogx(w,mag_CLdB(:),w,magS_dB(:),'--'),grid % Figure 7.10(b)
axis([w(1) w(end) -50 10])
xlabel('Frequency (rad/s)')
ylabel('Gain dB')
text(1.05,2.4,'T(\omega)')
text(1.05,-6.0,'S(\omega)')
title('Magnitudes of T(\omega) and S(\omega) versus frequency for Example 7.6')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -