reinf6_10.m

来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 49 行

M
49
字号
%%%%%%%%%%% Reinforcement Problem 6.10 %%%%%%%%%%
%   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('Reinforcement Problem 6.10')

Ts = 0.1;                         % sampling time
Ga = tf([1 3],[1 3 2])
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);
Gprew = c2d(Ga,Ts,'prewarp',1);   % frequency prewarping
[magp,php] = bodedb(Gprew,w);
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('Reinforcement Problem 6.10: 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')
%----- 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('Reinforcement Problem 6.10: 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 + =
减小字号Ctrl + -
显示快捷键?