gpt4 book ai didi

MATLAB - 为什么不 HP+LP=NOTCH?

转载 作者:行者123 更新时间:2023-12-04 05:11:43 25 4
gpt4 key购买 nike

我有陷波滤波器的概念问题。据我了解,陷波滤波器输出等于高通和低通滤波器输出的总和。但是,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产生两个相同的信号。有没有办法(使用“滤波器”)用高通和低通滤波器重新创建陷波滤波器的效果?感谢阅读。

最佳答案

罗加雷,

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

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

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

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')

关于MATLAB - 为什么不 HP+LP=NOTCH?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14841133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com