📄 notch2.m
字号:
%
% notch2.m - Magnitude response of a notch filter with
% both zeros and poles for different radius values r
%
% Define constants
w0=0.2*pi; th0=w0;
r1=0.75; r2=0.85; r3=0.95;
% Define the transfer functions H(z)
b(1)=1; b(2)=-2*cos(w0); b(3)=1;
a1(1)=1; a1(2)=-2*r1*cos(th0); a1(3)=r1*r1;
a2(1)=1; a2(2)=-2*r2*cos(th0); a2(3)=r2*r2;
a3(1)=1; a3(2)=-2*r3*cos(th0); a3(3)=r3*r3;
% Calculate the magnitude responses of H(z)
[h1,w1]=freqz(b,a1,128); mag1=20*log10(abs(h1));
[h2,w2]=freqz(b,a2,128); mag2=20*log10(abs(h2));
[h3,w3]=freqz(b,a3,128); mag3=20*log10(abs(h3));
% Plot the magnitude responses of H(z)
plot(w1/pi/2,mag1,'b.',w2/pi/2,mag2,'b--',w3/pi/2,mag3,'b-');
xlabel('Normalized frequency');
ylabel('Magnitude (dB)');
title('Magnitude responses of transfer function H(z)');
grid;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -