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

📄 ex6_5.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%%%%%%%%% Example 6.5 %%%%%%%%%%%%%%%%%%
%   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 bandpass filter ----
%
clear
disp('Example 6.5')

Ts = 0.1;                         % sampling time
Ga = tf(1,[1 sqrt(2) 1]);         % analog (continuous-time) filter
w = logspace(-2.5,0,50)*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);
disp('The warning is due to magitude ratio = 0 at ww = pi/Ts')
disp(' ')
Gprew = c2d(Ga,Ts,'prewarp',1);   % frequency prewarping
[magp,php] = bodedb(Gprew,w);
disp('The warning is due to magnitude ratio = 0 at ww = pi/Ts')
disp(' ')
Gmat = c2d(Ga,Ts,'matched');      % matched z-transform
[magm,phm] = bodedb(Gmat,w);
%----- plot magnitudes for all cases ---------
figure	                         
semilogx(w,maga,w,magi,'o',w,magt,'*',w,magp,'+',w,magm,'x');grid

axis([w(1) w(end) -80 5])
ylabel('Magnitude (dB)')
xlabel('Frequency (Hz)')
title('Example 6.5: Magnitudes of analog & discrete equivalents')
text(0.2,-40,'solid ==> analog')
text(0.2,-45,'o ==> impulse invariant')
text(0.2,-50,'* ==> Tustin')
text(0.2,-55,'+ ==> frequency prewarping')
text(0.2,-60,'x ==> matched')
disp('If desired, use zoom in feature to see details of the small difference')
disp('******>'), pause

%----- plot phases for all cases ---------
figure
semilogx(w,pha,w,phi,'o',w,pht,'*',w,php,'+',w,phm,'x');grid
axis([w(1) w(end) -270 0])
ylabel('Phase (deg)')
xlabel('Frequency (Hz)')
title('Example 6.5: Phase angles of analog & discrete equivalents')
text(0.2,-180,'solid ==> analog')
text(0.2,-195,'o ==> impulse invariant')
text(0.2,-210,'* ==> Tustin')
text(0.2,-225,'+ ==> frequency prewarping')
text(0.2,-240,'x ==> matched')
%%%%%%%%%%

⌨️ 快捷键说明

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