滤波方法及python实现

Python019

滤波方法及python实现,第1张

对滤波的 总结 : 对特定频率进行有效提取,并对提取部分进行特定的处理(增益,衰减,滤除)的动作被叫做滤波。

最常用的滤波器类型有三种: 通过式(Pass),搁架式(Shelving)和参量式(Parametric)。 滤波器都有一个叫 参考频率(Reference Frequency)的东西 ,在不同类型的滤波器中,具体的叫法会有所不同。

通过式滤波器可以让参考频率一侧的频率成分完全通过该滤波器,同时对另一侧的频率成分做线性的衰减,就是,一边让通过,一边逐渐被滤除。在信号学中,通过的区域被称为通带,滤除的区域被叫做阻带,在通过式滤波器中,参考频率通常被称为截止频率。

高通滤波器(high-pass filters):让截止频率后的高频区域通过,另一侧滤除,低通滤波器(low-pass filters):让截止频率前的低频区域通过,另一侧滤除,通

以下是高通滤波器与低通滤波器的核心参数:

截止频率(Cut-off frequency) :决定了通带(通过的频率部分)与阻带(阻止的频率部分)的分界曲线,截止频率的位置并非是在曲线开始弯曲的那个点,而是在-3dB的位置。以图2左侧的高通滤波器为例,截止频率点之上的部分频率并没有全部被通过,而是有个曲线,在曲线回归平直后其频率才被完全通过。至于为什么要将-3dB的位置设为截止频率,是因为-3dB对于滤波器的设计而言是个非常重要的位置,如果设为其他位置,则会让通过式滤波器的设计变得尤为复杂。

斜率(Slope) :表示的是通带与阻带的分界曲线的倾斜程度,也就是说斜率决定了分界曲线是偏向平缓的,还是偏向垂直的,斜率越大(更陡峭),人工处理的痕迹就越明显。斜率的单位为dB/oct,中文称为分贝每倍频程。虽然绕口,但其实很简单,如6dB/oct,意思为一个倍频程的距离会产生6dB的衰减,数字滤波器常见的斜率选择有6dB/oct,12dB/oct,18dB/oct,24dB/oct,30dB/oct等等(图3)。

scipy.signal.filtfilt(b, a, x, axis=-1, padtype='odd', padlen=None, method='pad', irlen=None)

scipy.signal.butter(N, Wn, btype='low', analog=False, output='ba')

这里假设采样频率为1000hz,信号本身最大的频率为500hz,要滤除10hz以下和400hz以上频率成分,即截至频率为10hz和400hz,则wn1=2*10/1000=0.02,wn2=2*400/1000=0.8。Wn=[0.02,0.8]

利用Python scipy.signal.filtfilt() 实现信号滤波

https://blog.csdn.net/weixin_37996604/article/details/82864680

https://www.cnblogs.com/xiaosongshine/p/10831931.html

https://stackoverflow.com/questions/35565540/designing-an-fir-notch-filter-with-python

Required input defintions are as follows

time: Time between samples

band: The bandwidth around the centerline freqency that you wish to filter

freq: The centerline frequency to be filtered

ripple: The maximum passband ripple that is allowed in db

order: The filter order. For FIR notch filters this is best set to 2 or 3, IIR filters are best suited for high values of order. This algorithm is hard coded to FIR filters

filter_type: 'butter', 'bessel', 'cheby1', 'cheby2', 'ellip'

data: the data to be filtered

用python设计FIR陷波滤波器

https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.iirnotch.html

https://www.cnpython.com/qa/85882

https://vimsky.com/examples/usage/python-scipy.signal.iirnotch.html

https://github.com/scipy/scipy/blob/master/scipy/signal/filter_design.py

https://blog.csdn.net/qq_41978536/article/details/90736793