📄 ex6_4.m
字号:
%%%%%%%%%%%%%%%%%% Example 6.4 %%%%%%%%%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Bandpass filtering ----
%
clear
disp('Example 6.4')
Ts = 0.01; % sampling period
w0 = 50*pi; % center frequency
a = 0.5, b = 0.95, K = 0.13
%-- build bandpass filter, where j is sqrt(-1)
num = K*conv([1 -a*exp(j*w0*Ts)],[1 -a*exp(-j*w0*Ts)]);
den = conv([1 -b*exp(j*w0*Ts)],[1 -b*exp(-j*w0*Ts)]);
G = tf(num,den,Ts) % bandpass filter as TF object
figure
ucircle,axis equal,hold on
pzmap(G),hold off % plot poles and zeros
title(' ')
%--- plot frequency response magnitude and phase ---
w = logspace(-2,0,200)*pi/Ts; % specify frequency range
figure
bode(G,w) % frequency response plot
%--- plot output of the filter ---
t = [0:Ts:10.0-Ts]; % time array from 0 to 9.99 s
e = cos(14*pi*t)+cos(50*pi*t)+cos(86*pi*t); % DT signal
y = lsim(G,e); % filter output
t95 = [951:1000]';
figure
stem(t(t95),y(t95),':o'), grid
title('Output signal of bandpass filter of Example 6.4 shown for 9.5 < t < 10.0')
xlabel('Time (s)')
ylabel('Amplitude')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -