数字滤波器设计的基本原理(IIR / FIR)


15

尽管我在设计音频引擎等方面具有扎实的经验,但我对数字滤波器设计领域(尤其是IIR和FIR滤波器)还是陌生的。换句话说,我正在尝试学习尽可能多的关于如何设计滤波器和导出它们的差分方程的知识。我从基础开始,所以请忍受我所说的,我正在尝试学习。

这是我的问题:

假设我要设计一个具有特定截止频率的低通滤波器-例如300 Hz。数学上推导传递函数然后推导特定差分方程以直接形式I和直接形式II(或现在仅是DF-1 ...)实现滤波器的最佳方法是什么?

我对传递函数以及它们与网络上某些优秀材料的差分方程之间的关系有一定的了解,但不幸的是,其中一些函数具有一些先验知识,因此,对我的追求而言,它比帮助更大。因此,我想我需要一个更逐步的示例,该示例将帮助我联系各个方面。

因此,我基本上是在寻求过程细分的帮助,从选择截止频率直至推导差分方程式。

任何帮助都感激不尽。我熟悉许多概念-脉冲响应,DFT,其背后的数学原理,我想我需要更多帮助的是z变换的概念以及使用极点/零点来设计滤波器的传递函数,然后截止频率如何。发挥所有作用,最终得出差分方程。

由于我倾向于从示例中学到最好的东西,所以我想在这里问。非常感谢任何有时间帮助我的人。


2
过滤器设计方法很多。这里有一些术语可以帮助您入门:窗口设计方法,最小二乘滤波器设计和等波纹滤波器设计(通常使用Parks-McClellan算法)。这些主要限于FIR滤波器设计。设计IIR滤波器的一种常用方法是将模拟原型(如Butterworth滤波器)映射到相应的数字滤波器近似值。例如,这可以使用双线性变换或脉冲不变性方法来完成。
Jason R

Answers:


20

数字滤波器设计是一个非常大且成熟的主题,并且-正如您在问题中提到的那样-有很多可用的材料。我想在这里尝试的是让您入门,并使现有材料更易于访问。实际上,我应该讨论离散时间滤波器,而不是数字滤波器,因为在这里我不会考虑系数和信号量化。您已经了解FIR和IIR滤波器,并且还了解了一些滤波器结构,例如DF I和II。不过,让我从一些基础知识开始:

非递归线性时不变(LTI)滤波器可以通过以下差分方程来描述

(1)y(n)=h0x(n)+h1x(n1)++hN1x(nN+1)=k=0N1hkx(nk)

y(n)x(n)nhkNhkx(n)=δ(n)y(n)=hnhk。FIR滤波器的一个重要优点是它们始终稳定,即对于有界输入序列,输出序列总是有界的。另一个优点是FIR滤波器始终可以实现完全线性的相位,即,除了纯延迟外,它们不会增加任何相位失真。此外,设计问题通常更容易解决,我们将在后面看到。

递归LTI滤波器由以下差分方程式描述:

(2)y(n)=b0x(n)+b1x(n1)++bMx(nM)a1y(n1)aNy(nN)

Equation (2) shows that the output is not only composed of weighted and delayed input samples, but also of weighted past output samples. In general, the impulse response of such a system is infinitely long, i.e. the corresponding system is an IIR system. However, there are special cases of recursive filters with a finite impulse response. Note that the impulse response is not anymore given by either the coefficients bk or ak as in the case of FIR filters. One advantage of IIR filters is that steep filters with high stopband attenuation can be realized with much fewer coefficients (and delays) than in the FIR case, i.e. they are computationally more efficient. However, one needs to be careful with the choice of the coefficients ak because IIR filter can be unstable, i.e. their output sequence can be unbounded, even with a bounded input sequence.

Filters can be designed according to specifications either in the time (sample) domain or in the frequency domain, or both. Since you've mentioned a cut-off frequency in your question, I assume you're more interested in specifications in the frequency domain. In this case you need to have a look at the frequency responses of FIR and IIR systems. The frequency response of a system is the Fourier transform of its impulse response, assuming that it exists (which is the case for stable systems). The frequency response of an FIR filter is

(3)H(ejθ)=k=0N1hkejkθ

where θ is the discrete-time frequency variable:

θ=2πffs

with the actual frequency f and the sampling frequency fs. From (3) you can see that approximating a desired frequency response by an FIR system is basically a problem of polynomial approximation. For recursive systems we have

(4)H(ejθ)=k=0Mbkejθ1+k=1Nakejθ

and you get a rational approximation problem, which is usually much more difficult than the polynomial approximation problem in the case of FIR filters. From (3) and (4) you can see that the frequency response of an FIR filter is of course only a special case of the response of a recursive filter with coefficients ak=0, k=1,,N.

Let's now take a quick look at filter design methods. For FIR filters you could take an inverse Fourier transform of the desired frequency response to get the impulse response of the filter, which directly corresponds to the filter coefficients. Since you approximate the desired response by a finite length impulse response you should apply a smooth window to the obtained impulse response to minimize oscillations in the actual frequency response due to Gibbs' phenomenon. This method is called frequency-sampling method.

For simple standard filters like ideal lowpass, highpass, bandpass or bandstop filters (and a few others), you could even analytically calculate the exact impulse response by taking the inverse Fourier transform of the ideal desired response:

hk=12πππH(ejθ)ejkθdθ

This integral is easy to evaluate for piecewise constant desired responses, as is the case for ideal frequency-selective filters. This will give you an infinitely long, non-causal impulse response, which needs to be windowed and shifted to make it finite and causal. This method is know as window-design.

There are of course many other FIR filter design methods. One important numerical method is the famous Parks-McClellan exchange algorithm which designs optimal filters with constant passband and stopband ripples. It is a numerical approximation method and there are many software implementations available, e.g. in Matlab and Octave.

The most common IIR design method for frequency selective filters is the bilinear transformation method. This method simply uses analytical formulas for the design of optimal analog filters (such as Butterworth, Chebyshev, Cauer/elliptic, and Bessel filters), and transforms them to the discrete-time domain by applying a bilinear transformation to the complex variable s (analog domain) which maps the (imaginary) frequency axis of the complex s-plane to the unit circle in the complex z-plane (discrete-time domain). Don't worry if you do not yet know much about complex transfer functions in the analog or discrete-time domain because there are good implementations available of the bilinear transform method, e.g. in Matlab or Octave.

There are of course many more interesting and useful methods, depending on the type of specifications you have, but I hope that this will get you started and will make any material you come across more understandable. A very good (and free) book covering some basic filter design methods (and a lot more) is Intoduction to Signal Processing by Orfanidis. You can find several design examples there. Another great classic book is Digital Filter Design by Parks and Burrus.


Wow, Matt, thanks so much for the detailed and thoughtful answer. I will surely delve into it and truly appreciate your time. Thanks!
bitwise

Is there any good textbook for wavelet filter design ? I am curious about such a topic: dsp.stackexchange.com/questions/29090/…. Thanks!
LCFactorization

A very good intro and motivates to do something in the field of Signal Processing
jomegaA
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.