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

📄 reinf6_11.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%% Reinforcement Problem 6.11 %%%%%%%%%%
%   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                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Discrete equivalent of a bandstop filter ----
%
clear
disp('Reinforcement Problem 6.11')

Ts = 0.001;
Ga = tf([22500 0],[1 212.132 42500 2121320 1e8])
w = logspace(-3,0,100)*pi/Ts;     % frequency points
[maga,pha] = bodedb(Ga,w);        % analog frequency response
Gii = imp_inv(Ga,Ts)              % impulse invariant transf
[magi,phi] = bodedb(Gii,w);  
Gtust = c2d(Ga,Ts,'tustin')       % Tustin (bilinear) rule
[magt,pht] = bodedb(Gtust,w);
Gprew = c2d(Ga,Ts,'prewarp',100)  % frequency prewarping
[magp,php] = bodedb(Gprew,w);
Gmz = c2d(Ga,Ts,'matched')        % matched z-transform
[magm,phm] = bodedb(Gmz,w);
%---- for matched-z, need to adjust gain at peak gain ----
[mag,ph] = bode(Ga);
mag_max = max(mag)
[num,den] = tfdata(Gmz)
%-- num should have 2 zeros at z = -1 and one zero at z = 1
num = conv(conv([1 1],[1 1]),[1 -1])
Gz_mzx = tf(num,den,Ts)
[magz,phz] = bode(Gz_mzx);
magz_max = max(magz)
K = mag_max/magz_max
Gz_mz = tf(K*num,den,Ts)

figure	                          % plot discrete frequency responses
semilogx(w,maga,w,magi,'o',w,magt,'*',w,magp,'+',w,magm,'x');grid
axis([w(1) w(end) -160 -30])
ylabel('Magnitude (dB)')
xlabel('Frequency (Hz)')
title('Reinforcement Problem 6.11: Magnitudes of analog & discrete equivalents')
text(12,-80,'solid ==> analog')
text(12,-90,'o ==> impulse invariant')
text(12,-100,'* ==> Tustin')
text(12,-110,'+ ==> frequency prewarping')
text(12,-120,'x ==> matched')

figure
semilogx(w,pha,w,phi,'o',w,pht,'*',w,php,'+',w,phm,'x');grid
axis([w(1) w(end) -350 100])
ylabel('Phase (deg)')
xlabel('Frequency (Hz)')
title('Reinforcement Problem 6.11: Phase angles of analog & discrete equivalents')
text(12,-180,'solid ==> analog')
text(12,-205,'o ==> impulse invariant')
text(12,-230,'* ==> Tustin')
text(12,-255,'+ ==> frequency prewarping')
text(12,-280,'x ==> matched')
%%%%%%%%%%

⌨️ 快捷键说明

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