高通低通滤波器信号,去除边缘伪像Matlab

谷氨酸

我需要过滤一些信号,以消除低于0.7 HZ和高于4 HZ的频率(如参考文献中所建议的那样)。

我正在信号之一(第二个子图)上尝试此操作: 我的信号

我加入了在这里使用的示例信号链路exampleSignal

我的信号是“ ydata”。为了高通我尝试的信号:

vidInfo.frameRate = 29.9293;
highPassedSig = highpass(ydata,4,vidInfo.frameRate) % vidInfo.frameRate

高通信号

在我看来,存在一些严重的边缘伪像。如果我删除前50个样本和后50个样本,则这是信号的中心部分:修整后的滤波信号

To get rid of the edge artifact, I tried to make the signal longer at the beginning and the end. I tried two approaches: 1) zero padding, 2) doubling the first and last 50 samples of the signal. The zero padding didn't work. I found some code on mathworks for the second approach:

R=0.1; % 10% of signal
Nr=50;
N=size(ydata,1);
NR=min(round(N*R),Nr); % At most 50 points
for i=1:size(ydata,2)
    ydata1(:,i)=2*ydata(1,i)-flipud(ydata(2:NR+1,i));  % maintain continuity in level and slope
    ydata2(:,i)=2*ydata(end,i)-flipud(ydata(end-NR:end-1,i));
end
sigToHighPass=[ydata1;ydata;ydata2];
% Do filtering
highPassedSig = highpass(sigToHighPass,4,vidInfo.frameRate);
highPassedSig = highPassedSig(NR+1:end-NR,:)

This is the result: The second subplot is the filtered signal

It looks like the edge artifact is removed. At this point, I tried to apply the low-pass filter to the highpass filtered data.

   N=size(highPassedSig,1);
NR=min(round(N*R),Nr); % At most 50 points
for i=1:size(highPassedSig,2)
    highPassedSig1(:,i)=2*highPassedSig(1,i)-flipud(highPassedSig(2:NR+1,i));  % maintain continuity in level and slope
    highPassedSig2(:,i)=2*highPassedSig(end,i)-flipud(highPassedSig(end-NR:end-1,i));
end
sigToLowPass=[highPassedSig1;highPassedSig;highPassedSig2];
% Do filtering
lowPassedSig = lowpass(sigToLowPass,0.7,vidInfo.frameRate);
lowPassedSig=lowPassedSig(NR+1:end-NR,:)

This is the result Low passed signal Once again, it looks like there is some serious edge artifact.

I also tried other approaches. For instance:

d = designfilt('lowpassfir', 'FilterOrder', 5, 'CutoffFrequency', 0.7, 'SampleRate', vidInfo.frameRate);
lowPassedSig = filter(d, ydata);

This is the result (subplot3):

LowPassed signal with designfilt
Does anyone have any idea how can I deal with this?
Thank you, Gianluca

ju95ju

我在您的方法中看到的根本问题是您误解了截止频率。如果要删除低于0.7 Hz且高于4 Hz的频率,则需要:

  • 一个截止频率为4 Hz的低通滤波器。
  • 截止频率为0.7 Hz的高通滤波器。

并非相反!按照您的建议使用highpasslowpass函数可以轻松完成此操作他们正在自动处理填充。如果您愿意,您可以设计具有上述截止频率的数字滤波器BUT :)

一个Matlab代码可以满足您的要求:

ydata = load("signaldata.mat","-mat");
ydata = ydata.ydata;

f = 29.9293;

lp = 0.7;
hp = 4;

[y_hp,d_hp] = highpass(ydata,lp,f);
[y_lphp,d_lp] = lowpass(y_hp,hp,f);

%% plot result
x = (1:length(ydata))/f;
figure;
subplot(3,1,1);
plot(x,ydata);
legend("Original");
subplot(3,1,2);
plot(x,y_hp);
legend("Highpass");
subplot(3,1,3);
plot(x,y_lphp);
xlabel('Time [s]');
legend("Lowpass");

%% plot filters
figure;
[h,w] = freqz(d_hp);
subplot(2,2,1);
title('Highpass');
loglog(w/pi*f/2,abs(h));
subplot(2,2,3);
semilogx(w/pi*f/2,angle(h)/pi*180);
[h,w] = freqz(d_lp);
subplot(2,2,2);
title('Lowpass');
loglog(w/pi*f/2,abs(h));
subplot(2,2,4);
semilogx(w/pi*f/2,angle(h)/pi*180);

这给出了以下图表:输入和输出数据Input and Output data滤波器的频率响应(幅度和相位)。Highpass and lowpass filters designed by Matlab

希望这种解释对您有所帮助!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用fft的Matlab低通滤波器

来自分类Dev

使用双线性方法将低通滤波器应用于信号-MATLAB

来自分类Dev

应用低通滤波器

来自分类Dev

FFT低通滤波器

来自分类Dev

FPGA的低通滤波器

来自分类Dev

FFT低通滤波器

来自分类Dev

应用低通滤波器

来自分类Dev

MATLAB中的低通滤波器返回NaN值

来自分类Dev

Matlab-在系统上使用低通滤波器

来自分类Dev

在Matlab中设计一个低通滤波器

来自分类Dev

在音频上使用低通滤波器

来自分类Dev

OpenCL中的低通滤波器

来自分类Dev

Python中的低通滤波器

来自分类Dev

低通滤波器和采样频率

来自分类Dev

C中的低通滤波器

来自分类Dev

低通滤波器不起作用

来自分类Dev

固定点的简单低通滤波器

来自分类Dev

在MATLAB中对图像进行高通巴特沃斯滤波器

来自分类Dev

Python:通过窗口进行高通FIR滤波器

来自分类Dev

关于在Matlab中使用'butter'功能的低通滤波器的问题

来自分类Dev

在MATLAB中使用imgaussfilt进行的二维高斯低通滤波器

来自分类Dev

识别过滤器的方法。(低通滤波器/高通滤波器?)

来自分类Dev

识别过滤器的方法。(低通滤波器/高通滤波器?)

来自分类Dev

优化低通滤波器平滑代码以进行活动识别

来自分类Dev

IIR低通滤波器在C ++中的实现

来自分类Dev

在Python中表示低通滤波器时的直线

来自分类Dev

将SOX低通滤波器与插孔配合使用

来自分类Dev

使用Pulseaudio在LFE上进行低通滤波器

来自分类Dev

Matlab FIR滤波器