📄 reinf6_8.m
字号:
%%%%%%%%%%% Reinforcement Problem 6.8 %%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Bandstop filtering ----
%
clear
disp('Reinforcement Problem 6.8')
Ts = 0.01; % sampling period
w0 = 50*pi;
a = 0.95, b = 0.5, K = 7.692
%-- 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 sec
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 bandstop filter of Reinf. Prob. 6.8 shown for 9.5 < t < 10.0')
xlabel('Time (s)')
ylabel('Amplitude')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -