发布网友 发布时间:2022-04-20 16:29
共1个回答
热心网友 时间:2023-05-24 13:59
陷波滤波器是一种特殊的带阻滤波器,其阻带在理想情况下只有一个频率点,因此也被称为点阻滤波器.这种滤波器主要用于消除某个特定频率的干扰,例如,在各种测量仪器和数据采集系统中用于消除电源干扰的工频陷波器.
以下为matlab的实现代码:
% Matlab code for plotting the frequency response of digital notch filter
% Implemented as all pass filter section
clear; close all
fs = 1e6;
fn = 200e3;
fb = 50e3;
omega0T = fn/(fs/2)*pi;
deltaT = fb/(fs/2)*pi;
a2 = (1-tan(deltaT/2))./(1+tan(deltaT/2));
a1 = (1+a2).*cos(omega0T);
B = [1 -a1 a2];
A = [a2 -a1 1];
[H1 W1] = freqz(B,A,1024,'whole');
[H2 W2] = freqz(1,1,1024,'whole');
H3 = (H1+H2)/2;
h = figure(1);
subplot(2,1,1);
plot([-512:511]/1024*fs/1e6,20*log10(fftshift(abs(H3))),'b-','LineWidth',4);
grid on; ylabel('amplitude, dB');
title('notch filter, fs=1MHz, fn=200kHz, fb=50kHz');
axis([-0.5 0.5 -50 10]);
subplot(2,1,2);
plot([-512:511]/1024*fs/1e6,(fftshift(angle(H3)*180/pi)),'m-','LineWidth',4);
grid on; xlabel('freq, MHz'); ylabel('angle, deg');
title('phase response');
axis([-0.5 0.5 -180 180]);