# 数字滤波器

IIR滤波器的优点在于，其设计可以直接利用模拟滤波器设计的成果，因为模拟滤波器本身就是无限长冲激响应的。通常IIR滤波器设计的过程如下：首先根据滤波器参数要求设计对应的模拟滤波器（如巴特沃斯滤波器、切比雪夫滤波器等等），然后通过映射（如脉冲响应不变法、双线性映射等等）将模拟滤波器变换为数字滤波器，从而决定IIR滤波器的参数。IIR滤波器的重大缺点在于，由于存在反馈其稳定性不能得到保证。另外，反馈还使IIR滤波器的数字运算可能溢出。

FIR滤波器最重要的优点就是由于不存在系统极点，FIR滤波器是绝对稳定的系统。FIR滤波器还确保了线性相位，这在信号处理中也非常重要。此外，由于不需要反馈，FIR滤波器的实现也比IIR滤波器简单。FIR滤波器的缺点在于它的性能不如同样阶数的IIR滤波器，不过由于数字计算硬件的飞速发展，这一点已经不成为问题。再加上引入计算机辅助设计，FIR滤波器的设计也得到极大的简化。基于上述原因，FIR滤波器比IIR滤波器的应用更广。

1. 按照实际需求性能要求确定滤波器技术指标。
2. 用一个因果稳定的系统函数IIR去逼近这个要求。
3. 用一个有限精度的运算(软、硬件)去实现这个传递函数

• 较容易设计以及实现。

• 脉冲响应（impulse response）为无限长：造成当输入数字信号为有限长的时候，输出数字信号会变成无限长。
• 比有限脉冲响应滤波器（FIR filter）较不易最佳化（optimize）。
• 不一定是稳定的（stable）：因为Z转换（Z transform）后所有的极点（pole）不一定都在单位圆内。

IIR数字滤波器设计有以下几种基本方法:

• 零、极点累试法：由于频率响应在靠近集点频处会出现峰值，在靠近零点频率处会出现谷值，并且零、极点越靠近单位圆峰谷越明显。所以在设计时通过不断调整零、极点位置，达到设计标准，对要求不高的简单滤波器，可以用此方法设计。
• 用模拟滤波器理论设计数字滤波器：利用模拟滤波器理论先设计模拟滤波器，得到其系统函数Ha(s)。然后经过一定的变换，得到满足要求的数字滤波器系统函数H(z)。这样设计的优点是模拟滤波器设计理论成熟，有许多现成的公式、曲线、表格可以直接使用。并且在许多场合下就是用数字滤波器代替模拟滤波器。这种由模拟滤波器设计数字滤波器的方法，其实就是从s平面到z平面的映射变换，对这个变换基本要求是:
• 数字滤波器的频率响应要保持模拟滤波器的频率响应，所以s平面的虚轴jΩ应当映射到z平面的单位圆ejw上。
• 模拟滤波器的因果稳定性经映射数字滤波器仍应保持，所以s平面的左半平面应当映射到z平面的单位圆内。

• 脉冲响应（impulse response）为有限长：造成当输入数字信号为有限长的时候，输出数字信号也为有限长。
• 比无限脉冲响应滤波器（IIR filter）较容易最佳化（optimize）。
• 线性相位（linear phase）：造成$h(n)\,$是偶对称（even）或奇对称（odd）且有限长。
• 一定是稳定的（stable）：因为Z转换（Z transform）后所有的极点（pole）都在单位圆内。

• 设计方式较无限脉冲响应滤波器（IIR filter）不容易。

1.以设计方法而论

1. Least MSE：使用到内积以及反矩阵的运算。
2. Minimax：使用recursive的方式，所以相对而言较为复杂。
3. Frequency sampling：利用到inverse fourier transform，就想法而言是最简单的。

2.以方法的限制而论

1. Least MSE：使用上的限制较少。
2. Minimax：所设计滤波器必须要是偶对称或是奇对称才可以，且必须要有转换频带（transition band）
3. Frequency sampling：无法使用权重函数（weighting function），且转换频带的加入也很难做到最佳化。

3.以效果而论

1. Least MSE：平均误差最小，一般而言系统稳定性较好。
2. Minimax：最大误差最小，一般而言表现较好，且可以保证系统的运作在一定的误差内。
3. Frequency sampling：很难做到最佳化，且容易有aliasing effect、Gibb’s phenomenon等等缺点，所以是较不普及的设计方法。

• 低通滤波器用于阻止不需要的高频信号。
• 高通滤波器允许高频信号通过，阻止不需要的低频信号成分通过。
• 带通滤波器只允许有限频率范围的信号通过。
• 带阻滤波器允许低于和高于特定频率范围的信号通过，对于这个范围内的频率阻止通过。这种滤波器较少见。

IIR vs FIR Filters

IIR filters are difficult to control and have no particular phase, whereas FIR filters make a linear phase always possible.

IIR can be unstable, whereas FIR is always stable.

IIR, when compared to FIR, can have limited cycles, but FIR has no limited cycles.

IIR is derived from analog, whereas FIR has no analog history.

IIR filters make polyphase implementation possible, whereas FIR can always be made casual.

FIR filters are helpful to achieve fractional constant delays.

#MAD stands for a number of multiplications and additions, and is used as a criterion for an IIR and FIR filter comparison. IIR filters require more

#MAD when compared to FIR, because FIR is of a higher order in comparison to IIR, which is of lower order, and uses polyphase structures.

FIR filters are dependent upon linear-phase characteristics, whereas IIR filters are used for applications which are not linear.

FIR’s delay characteristics is much better, but they require more memory.

On the other hand, IIR filters are dependent on both i/p and o/p, but FIR is dependent upon i/p only.

IIR filters consist of zeros and poles, and require less memory than FIR filters, whereas FIR only consists of zeros.

IIR filters can become difficult to implement, and also delay and distort adjustments can alter the poles & zeroes, which make the filters unstable,

whereas FIR filters remain stable. FIR filters are used for tapping of a higher-order, a

nd IIR filters are better for tapping of lower-orders, since IIR filters may become unstable with tapping higher-orders.

FIR stands for Finite IR filters, whereas IIR stands for Infinite IR filters.

IIR and FIR filters are utilized for filtration in digital systems.

FIR filters are more widely in use, because they differ in response.

FIR filters have only numerators when compared to IIR filters, which have both numerators and denominators.

Where the system response is infinite, we use IIR filters, and where the system response is zero, we use FIR filters.

FIR filters are also preferred over IIR filters because they have a linear phase response and are non recursive,

whereas IIR filters are recursive, and feedback is also involved.

FIR cannot simulate analog filter responses, but IIR is designed to do that accurately.

IIR’s impulse response when compared to FIR is infinite.

The high computational efficiency of IIR filters, with short delays, often make the IIR popular as an alternative.

FIR filters have become too long in digital feedback systems, as well as in other applications, and cause problems.

Summary:

• 1. IIR is infinite and used for applications where linear characteristics are not of concern.
• 2. FIR filters are Finite IR filters which are required for linear-phase characteristics.
• 3. IIR is better for lower-order tapping, whereas the FIR filter is used for higher-order tapping.
• 4. FIR filters are preferred over IIR because they are more stable, and feedback is not involved.
• 5. IIR filters are recursive and used as an alternate, whereas FIR filters have become too long and cause problems in various applications.

1，对于IIR和FIR的比较，有些书上有论述。我引用陈怀琛的“数字信号处理教程－－MATLAB释义与实现”：

2，不论IIR和FIR，阶数越高，信号延迟越大；同时在IIR滤波器中，阶数越高，系数的精度要求越高，否则很容易造成有限字长的误差使极点移到单位园外。因此在阶数选择上是综合考虑的。

To answer that question you have to know what "Impulse" and "Response" mean...

An "Impulse" is a simple pulse.

Digitally it would be a sample with a maximum value, while all of the other samples before and after it would be zero.
If you listened to this, you would hear something like a pop or firecracker.

The "Response" is the output of a filter (or something else) is given the impulse.

For example, you can listen to the "impulse response of a room" by going into the room, doing a simple hand clap, and listening to the echo.
It would take some practice to get the hand clap to be as "sharp" as possible.
Getting the impulse response of a filter is the same way but instead of a hand clap you use a simple pulse and instead of a room you have a filter.

If you look at the impulse response of a filter, or a room, you will see the output wiggle for a time after the impulse (and sometimes it wiggles before, too).
In the room you heard this wiggle as the echo. In a filter this wiggling is directly related to the frequency and phase response of the filter.
In a room, the amount of time you hear the echo is called the "reverb time"-- there is no corresponding term for a filter, but it is part of the impulse response.

Now, a FIR filter (Finite Impulse Response) is finite because the impulse response time is limited by the math.
It's mathematically impossible for the impulse response time to extend beyond the number of taps in the filter-- therefore it is finite.

An IIR filter, on the other hand, does not have this mathematical limitation in the impulse response time.
If given an infinite mathematical precision, an IIR filter can wiggle the outputs forever.
Of course, in a practical sense it never goes on forever since at some point the wiggle gets smaller than the precision of the math used and so goes away.

The impulse response is the filter's signature. In the case of a FIR filter the impulse response gives you a direct image of the filter's coefficients. The impulse is a single sample with maximum amplitude, all samples before and after are zero. (This is the digital equivalent of a Dirac pulse.)
At the time of the pulse its value is multiply by

IIR
In an IIR filter (part of) the processed signal is fed back to the input.

That means that there will always be some residue of the signal looping around.
Most of the time however this part of the signal will be ever smaller and end up being zero, but in theory it never disappears completely.
The block diagram below shows a biquad filter, an often used implementation of an IIR filter.
The left branch takes (delayed) input values, the right branch works with (delayed) output values.
(A

FIR
FIR filters on the other hand have a linear path from input to output.

After N samples the input signal (like a Dirac pulse) will have been shifted out and that's the end of it.

FIR filters are inherently stable, while IIR filters aren't necessarily.

There are two broad classes of digital filters, infinite impluse response (IIR) and finite impulse response (FIR).
Again broadly, IIR filters are equation-based and FIR filters table-based.

IIR filters are more like real world analog filters.
For example, consider a simple exponential decay like you would get from a R-C analog low pass filter.
The output response to a step input is a exponential that gets ever closer to the input.
Note that this exponential never actually gets to the output, only close enough so that we don't care or can't measure the error.
In that sense, such a filter is inifinite. A IIR filter has the same characteristics.

The very common single pole low pass IIR filter can be expressed as:

FILT <-- FILT + FF(NEW - FILT)

This means that each iteration the output if moved a fixed fraction (FF, the "filter fraction") of the distance to the input.
This is easy to visualize when FF = 1/2. If everything is 0 and the input suddenly goes to 1 and stays there (a unit step), then the output will be 1/2, 3/4, 7/8, 15/16, etc.
This is a infinite series. Eventually the value will get so close to 1 that it is expressed as 1 since the digital values in the computer don't have infinite precision.

FIR filters work on a totally different principle.
A finite recent snippet of the input signal is saved, and each of the saved values is multiplied by a different coefficient,
then all the results added to make the filter output for that iteration.

The next iteration the oldest saved value is discard, the others are shifted one slot older, and the new input is put in the vacated slot.
The new saved snippet is then multiplied by the coeficients, etc.

This process is known as a "convolution", and the table of coefficients often referred to as the filter kernel.

Some fancy and useful things can be done with this kind of filter by getting creative with the coefficients.
That's a whole topic onto itself that I won't go into now.
However, since a finite snippet of the input is stored in memory, any part of the input signal can only effect the output for a finite time.
Once a input sample is shifted out the end of the stored snippet it's gone and no longer has any effect on the output.

There are whole books written on this stuff and you can spend several semesters of college courses devling into this deeper.
Hopefully my 30 second overview demystifies this enough to answer your question.

posted @ 2015-09-29 09:22 EverythingHere 阅读(...) 评论(...) 编辑 收藏