过滤器性能分析 [英] Filters performance analysis

查看:62
本文介绍了过滤器性能分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一些实验数据,在某些时候,这些数据需要进行时间积分,然后进行高通滤波(以消除积分和不必要的直流分量引起的低频干扰).

I am working on some experimental data which, at some point, need to be time-integrated and then high-pass filtered (to remove low frequency disturbancies introduced by integration and unwanted DC component).

我的工作目标与过滤无关,但我仍想更详细地分析我用来说明理由的过滤器(例如,说明为什么我选择使用4阶过滤器而不是过滤器).较高/较低的一个.

The aim of my work is not related to filtering, but still I would like to analyze more in detail the filters I am using to give some justification (for example to motivate why I chosed to use a 4th order filter instead of a higher/lower one).

这是我正在使用的过滤器:

This is the filter I am using:

delta_t = 1.53846e-04;
Fs = 1/delta_t;
cut_F = 8; 
Wn = cut_F/(Fs/2);
ftype = 'high';
[b,a] = butter(4,Wn,ftype);
filtered_signal = filtfilt(b,a,signal);

我已经在这里查看过:在MATLAB中进行高通滤波以进行学习关于过滤器的一些知识(我从未学习过信号处理课程),并且使用了

I already had a look here: High-pass filtering in MATLAB to learn something about filters (I never had a course on signal processing) and I used

fvtool(b,a)

查看脉冲响应,阶跃响应等.我曾经使用过的过滤器.

to see the impulse response, step response ecc. of the filter I have used.

问题是我不知道如何阅读"这些情节.

The problem is that I do not know how to "read" these plots.

我要寻找什么?

我如何理解过滤器是否合格?(我没有关于滤波器性能的任何规范,我只知道我可以接受的最低频率是5 Hz)

How can I understand if a filter is good or not? (I do not have any specification about filter performances, I just know that the lowest frequency I can admit is 5 Hz)

可以比较不同过滤器的哪些功能来激励选择?

What features of different filters are useful to be compared to motivate the choice?

推荐答案

我看到您正在通过过滤器启动Uni DSP类:)您需要记住的第一件事是Matlab只能使用有限值进行模拟,因此您看到的结果在技术上都是离散的.有四件事会影响您的过滤结果(或告诉您过滤器的好坏),在设计有限响应过滤器时您将了解/必须考虑以下几点:

I see you are starting your Uni DSP class on filters :) First thing you need to remember is that Matlab can only simulate using finite values, so the results you see are technically all discrete. There are 4 things that will influence your filtering results(or tell you if your filter is good or bad) which you will learn about/have to consider while designing a Finite response filter:

1,过滤器的类型(即Hamming,Butterworth(您正在使用的过滤器),Blackman,Hanning等)2,滤波器系数的数量(这决定了您的滤波器分辨率)3,原始信号的采样频率(理想情况下,如果采样频率无限,则可以有完美的滤波器;由于上述原因,在Matlab中是不可能的,但是可以通过将其设置为很高来模拟其效果)4,截止频率

1, the Type of the filter (i.e. Hamming, Butterworth (the one you are using), Blackman, Hanning .etc) 2, the number of filter Coefficients (which determines your filter resolution) 3, the sampling frequency of the original signal (ideally, if you have infinite sampling frequency, you can have perfect filters; not possible in Matlab due to reason above, but you can simulate its effect by setting it really high) 4, the cut-off frequency

您可以使用4个参数,以便过滤器执行您想要的操作.

You can play around with the 4 parameters so that your filter does what you want it to.

因此,理论来了:在主瓣的宽度与滤波器的频谱泄漏之间需要权衡.这个想法是,您有一些具有某些频率的信号,想要过滤掉不想要的(即您的DC噪声)并保持所需的信号,但是如果您想要的信号频率太低以至于它非常接近DC,该怎么办?噪音.如果滤波器设计不良,则将无法滤除直流分量.为了设计一个好的滤波器,您将需要找到适合您的滤波器系数,滤波器类型,甚至截止频率的最佳数值,以确保您的滤波器能够按需工作.

So here comes the theory: There is a trade-off in terms of the width of your main lobe vs the spectrum leakage of your filter. The idea is that you have some signal with some frequencies, you want to filter out the unwanted (i.e. your DC noise) and keep the ones you want, but what if your desired signal frequency is so low that it is very close to the DC noise. If you have a badly designed filter, you will not be able to filter out the DC component. In order to design a good filter, you will need to find the optimal number for your filter coefficients, type of filter, even cut-off frequency to make sure your filter works as you wanted.

这是我过去写的一个低通滤波器,通过过滤各种信号并绘制响应,您可以使用很多滤波器.

Here is a low-pass filter that I wrote back in the days, you can play around with filters a lot by filtering different kinds of signals and plotting the response.

N = 21; %number of filter coefficients
fc = 4000;  %cut-off frequency
f_sampling = fs; %sampling freq
Fc = fc/f_sampling;
n = -(N-1)/2:(N-1)/2;
delta = [zeros(1,(N-1)/2) 1 zeros(1,(N-1)/2)];
h = delta - 2*Fc*sinc(2*n*Fc);
output = filter(h,1,yoursignal);

要绘制响应,您要使用DFT或FFT(在Matlab中)在频域中绘制输出,并查看信号是如何因泄漏等而失真的.

to plot the response, you want to plot your output in the frequency domain using DFT or FFT(in Matlab) and see how the signal has been distorted due to the leakage and etc.

NFFT=256;           % FFT length
output=1/N*abs(fft(output,NFFT)).^2;      % PSD estimate using FFT

这为您提供了所谓的周线图",当您进行绘图时,您可能希望对其进行10 * log10的处理,因此它看起来更漂亮

this gives you what is known as a periodigram, when you plot, you might want to do the 10*log10 to it, so it looks nicer

希望您在课堂上表现出色.

Hope you do well in class.

这篇关于过滤器性能分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆