2

我遇到了陷波滤波器的概念问题。据我了解,陷波滤波器输出等于高通和低通滤波器输出的总和。但是,MATLAB 中的快速测试并没有显示这一点。下面是一些测试代码:

% Load a simple signal and specify constants
load handel; % this loads the signal, y, and its sampling rate, Fs
nData=y;
nFreq=[55 65];
nOrder=4;

% Create a lowpassed signal
[b a]=butter(nOrder,nFreq(1)/(Fs/2),'low');
nLP_Data=filter(b,a,nData);

% Create a highpassed signal
[b a]=butter(nOrder,nFreq(2)/(Fs/2),'high');
nHP_Data=filter(b,a,nData);

% Combine LP and HP signals
nCombinedHPLP=nLP_Data+nHP_Data;

% Create a notch filtered signal
[b a]=butter(nOrder/2,nFreq/(Fs/2),'stop'); % The notch filter uses twice the first input argument for its order, hence the "/2"
nN_Data=filter(b,a,nData);

% Plot each and output the total difference in the signals to the Command Window
plot(nN_Data,'r')
hold all
plot(nCombinedHPLP,'b')
legend({'Notched signal','Combined HP, LP signals'});
sum(abs(nCombinedHPLP-nN_Data))

我认为差异是由于滤波器的相位效应,因为改变filterfiltfilt产生两个相同的信号。有没有办法(使用“过滤器”)用高通和低通滤波器重新创建陷波滤波器的效果?谢谢阅读。

4

3 回答 3

2

罗加雷,

您已经创建了一个陷波滤波器;正如您所怀疑的,您刚刚创建了一个相位与单个黄油过滤器不同的相位。

您的两个 BUTTER 过滤器都有自己的相位响应,并且无法保证使用这两个过滤器处理您的数据与使用手工制作的带通过滤器处理一次数据具有相同的净相位。没有规则说黄油会花费时间和精力试图让低通和高通滤波器的相位表现得像带通滤波器的相位(事实上,如果这样做会很奇怪! )

然而,结果数据的 FFT 的 MAGNITUDE 非常吻合:

subplot(2,1,1); 
plot(abs(fftshift(fft(nCombinedHPLP)))); 
title('My Notch')
subplot(2,1,2); 
plot(abs(fftshift(fft(nN_Data)))); 
title('Real Notch')
于 2013-02-12T21:28:49.360 回答
1

你确实有一个概念问题:在你问题的开头段落中你说

据我了解,陷波滤波器输出等于高通和低通滤波器输出的总和

如果是这种情况,那么任何通过低通或高通的信号都将通过(在低频下,低通让它通过,因此低通+高通的输出之和让低频通过。高频同上,如果你交换“低”和“高”这两个词......)。

串联应用与求和输出之间存在差异。我认为这就是您的困惑的来源。是的 - 根据过滤器的构造方式,它的陡峭程度等,当您将它们串联应用时,您将获得各种效果......

于 2013-02-12T21:52:08.637 回答
0

由于陷波滤波器的阶数是 LP 或 HP 滤波器阶数的两倍,这应该表明 NF 也可以导出为 conv(LP,HP)。

The concept that you asking is that of superposition, which would presuppose equal length filters.

于 2013-02-14T08:00:16.823 回答