濾波器術語
衰減 – 輸出信號幅度相對於輸入信號幅度下降。
截止頻率 – 濾波器的響應降至額定通帶紋波如下時的頻率。
通帶 – 濾波器頻率範圍,信號經過該範圍的衰減量不超過額定值。
阻帶 – 濾波器頻率範圍,信號經過該範圍時會發生額定量的衰減。
阻帶衰減 – 阻帶中的最小衰減量。
通帶紋波 – 通帶中的實際輸出幅度與指望輸出幅度的最大誤差。
採樣速率 – 系統對輸入信號進行採樣的速率。
濾波器係數 – 表明濾波器傳遞函數的逆傅里葉變換的數值。係數定義濾波器的特性,構成數字濾波器實現的基礎。
抽頭 – 抽頭數等於濾波器針對每一個輸出點處理的輸入採樣值數量。抽頭數還等於濾波器係數的數量,而且能夠用來衡量濾波器延遲時間。git
數字濾波器與模擬濾波器的比較算法
數字濾波器愈來愈多地應用於調制解調器、雷達、頻譜分析儀、語音和圖像處理設備等,緣由以下:express
與模擬濾波器相比,數字設計可以提供更陡的滾降,無需校準,對時間、溫度和電源變化的適應能力更強,性能更穩定。簡單地改變軟件就能實時更改數字濾波器的響應,產生所謂「自適應濾波器」,而要改變模擬濾波器的響應,一般須要更改硬件。然而,數字濾波器並不能令全部應用滿意。在滾降要求不超過約24 dB/倍頻程的設計中,模擬濾波器一般更具性價比。可是,當滾降要求超過24 - 36 dB/倍頻程時,使用數字濾波器更合適。事實上,在要求極陡滾降的應用中,許多設計師發現數字濾波器的開發難度小得多。經過更改軟件,能夠輕鬆修改原型。此外,數字濾波器設計的軟件仿真能夠精確反映濾波器的性能,但模擬濾波器的計算機仿真只能近似反映濾波器的真實性能,由於模擬濾波器的參數對元件值敏感,而初始元件值是不許確的,可能發生至關大的變化。網絡
數字濾波器是對數字信號進行濾波處理以獲得指望的響應特性的離散時間系統。做爲一種電子濾波器,數字濾波器與徹底工做在模擬信號域的模擬濾波器不一樣。數字濾波器工做在數字信號域,它處理的對象是經由採樣器件將模擬信號轉換而獲得的數位信號。app
數字濾波器的工做方式與模擬濾波器也徹底不一樣:後者徹底依靠電阻器、電容器、晶體管等電子元件組成的物理網絡實現濾波功能;而前者是經過數字運算器件對輸入的數字信號進行運算和處理,從而實現設計要求的特性。less
數字濾波器理論上能夠實現任何能夠用數學算法表示的濾波效果。數字濾波器的兩個主要限制條件是它們的速度和成本。數字濾波器不可能比濾波器內部的數字電路的運算速度更快。可是隨着集成電路成本的不斷下降,數字濾波器變得愈來愈常見而且已經成爲了如收音機、蜂窩電話、立體聲接收機這樣的平常用品的重要組成部分。ide
數字濾波器通常由寄存器、延時器、加法器和乘法器等基本數字電路實現。隨着集成電路技術的發展,其性能不斷提升而成本卻不斷下降,數字濾波器的應用領域也所以愈來愈廣。按照數字濾波器的特性,它能夠被分爲線性與非線性、因果與非因果、無限脈衝響應(IIR)與有限脈衝響應(FIR)等等。其中,線性時不變的數字濾波器是最基本的類型;而因爲數字系統能夠對延時器加以利用,所以能夠引入必定程度的非因果性,得到比傳統的因果濾波器更靈活強大的特性;相對於IIR濾波器,FIR濾波器有着易於實現和系統絕對穩定的優點,所以獲得普遍的應用;對於時變系統濾波器的研究則致使了以卡爾曼濾波爲表明的自適應濾波理論函數
數字濾波器具備比模擬濾波器更高的精度,甚至可以實現後者在理論上也沒法達到的性能。例如,對於數字濾波器來講很容易就可以作到一個1000Hz的低通濾波器容許999Hz信號經過而且徹底阻止1001Hz的信號,模擬濾波器沒法區分如此接近的信號。oop
數字濾波器相比模擬濾波器有更高的信噪比。這主要是由於數字濾波器是以數字器件執行運算,從而避免了模擬電路中噪聲(如電阻熱噪聲)的影響。數字濾波器中主要的噪聲源是在數字系統以前的模擬電路引入的電路噪聲以及在數字系統輸入端的模數轉換過程當中產生的量化噪聲。這些噪聲在數字系統的運算中可能會被放大,所以在設計數字濾波器時須要採用合適的結構,以下降輸入噪聲對系統性能的影響。性能
數字濾波器還具備模擬濾波器不能比擬的可靠性。組成模擬濾波器的電子元件的電路特性會隨着時間、溫度、電壓的變化而漂移,而數字電路就沒有這種問題。只要在數字電路的工做環境下,數字濾波器就可以穩定可靠的工做。
因爲奈奎斯特採樣定理(Nyquist sampling theorem),數字濾波器的處理能力受到系統採樣頻率的限制。若是輸入信號的頻率份量包含超過濾波器1/2採樣頻率的份量時,數字濾波器由於數字系統的「混疊」而不能正常工做。若是超出1/2採樣頻率的頻率份量不佔主要地位,一般的解決辦法是在模數轉換電路以前放置一個低通濾波器(即抗混疊濾波器)將超過的高頻成分濾除。不然就必須用模擬濾波器實現要求的功能。
線性移不變的數字濾波器包括無限長脈衝響應濾波器(IIR濾波器)和有限長脈衝響應濾波器(FIR濾波器)兩種。
IIR濾波器的優勢在於,其設計能夠直接利用模擬濾波器設計的成果,由於模擬濾波器自己就是無限長衝激響應的。一般IIR濾波器設計的過程以下:首先根據濾波器參數要求設計對應的模擬濾波器(如巴特沃斯濾波器、切比雪夫濾波器等等),而後經過映射(如脈衝響應不變法、雙線性映射等等)將模擬濾波器變換爲數字濾波器,從而決定IIR濾波器的參數。IIR濾波器的重大缺點在於,因爲存在反饋其穩定性不能獲得保證。另外,反饋還使IIR濾波器的數字運算可能溢出。
FIR濾波器最重要的優勢就是因爲不存在系統極點,FIR濾波器是絕對穩定的系統。FIR濾波器還確保了線性相位,這在信號處理中也很是重要。此外,因爲不須要反饋,FIR濾波器的實現也比IIR濾波器簡單。FIR濾波器的缺點在於它的性能不如一樣階數的IIR濾波器,不過因爲數字計算硬件的飛速發展,這一點已經不成爲問題。再加上引入計算機輔助設計,FIR濾波器的設計也獲得極大的簡化。基於上述緣由,FIR濾波器比IIR濾波器的應用更廣。
無限脈衝響應濾波器,簡稱IIR數字濾波器(英語:infinite impulse response filter),
是數字濾波器的一種。因爲無限脈衝響應濾波器中存在反饋迴路,所以對於脈衝輸入信號的響應是無限延續的。濾波器的任務是經過必定運算關係,改變輸入信號的頻譜。數字濾波器是利用計算機程序、專用芯片等軟、硬件改變數字信號頻譜。若是要處理的是模擬信號能夠經過A/D在信號形式上進行轉換,在利用數字濾波器處理後通過D/A恢復爲模擬信號。
利用選頻濾波器的特性能夠提取有用的信號頻率份量,這類濾波器適用輸入信號中有用信號頻帶與干擾信號頻帶不一樣的狀況。 選頻數字濾波器設計過程通常概括爲如下三個步驟:
無限脈衝響應濾波器(IIR filter)的優勢:
無限脈衝響應濾波器(IIR filter)的缺點:
IIR數字濾波器設計有如下幾種基本方法:
有限脈衝響應(Finite impulse response,縮寫 FIR)濾波器是數字濾波器的一種,簡稱FIR數字濾波器。
這類濾波器對於脈衝輸入信號的響應最終趨向於0,所以是有限的,而得名。它是相對於無限脈衝響應濾波器(IIR)而言。因爲無限脈衝響應濾波器中存在反饋迴路,所以對於脈衝輸入信號的響應是無限延續的。
有限脈衝響應濾波器(FIR filter)的優勢:
有限脈衝響應濾波器(FIR filter)的缺點:
如下嘗試以濾波器設計方法、設計方法的限制、以及所設計濾波器的效果三方面,來比較最小化平均偏差(Least MSE)、最小化最大偏差(Minimax)與頻率取樣(Frequency sampling)三種設計方法的差別。
1.以設計方法而論
2.以方法的限制而論
3.以效果而論
頻域電子濾波器的設計必須首先考慮任務所需濾波器的類型。首先必須肯定濾波器的基本功能,如低通濾波器、高通濾波器、帶通濾波器、全通濾波器或者是更爲複雜的功能。
濾波器的一個重要參數是所要求的頻率響應。尤爲是頻率響應曲線的陡峭性和複雜性是濾波器階數和可行性的一個決定性因素。
一階濾波器只有一個依賴於頻率的成分,這就意味着頻率響應slope就侷限在每倍頻6 dB。對於許多應用來講,這是不夠的,爲了實現更陡的斜率,必須使用更高階的濾波器。
無限脈衝響應是與模擬濾波器對應數字實現。無限脈衝響應使用了反饋過程,因此一般要比一樣性能的有限脈衝響應濾波器所耗費的資源要少。一樣是因爲反饋的因素,高階的無限脈衝響應濾波器可能會有不穩定和運算溢出的問題,所以須要細心設計以免出現相似問題。另外,它們有內在的依賴於頻率的相移,在不少狀況下這可能成爲問題。二階無限脈衝響應濾波器常常叫做'biquads',更高階的濾波器就是biquads的層疊。一個有用的計算biquad係數的參考文獻是RBJ Audio EQ Cookbook。
有限脈衝響應濾波器不使用反饋,自己是穩定的。有限脈衝響應濾波器係數一般是對稱的,這樣很天然地相移就被抵消。而且也很容易避免運算溢出。它的主要缺點是要比靈巧設計的無限脈衝響應變量的計算要花費多得多的處理和內存資源。有限脈衝響應設計比較簡單:Remez exchange算法就是一個可以半自動設計至關高質量濾波器的方法。
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和FIR的比較,有些書上有論述。我引用陳懷琛的「數字信號處理教程--MATLAB釋義與實現」:
從性能上來講,IIR濾波器傳遞函數包括零點和極點兩組可調因素,對極點的唯一限制是在單位圓內。所以可用較低的階數得到高的選擇性,所用的存儲單元少,計算量小,效率高。可是這個高效率是以相位的非線性爲代價的。選擇性越好,則相位非線性越嚴重。FIR濾波器傳遞函數的極點固定在原點,是不能動的,它只能靠改變零點位置來改變它的性能。因此要達到高的選擇性,必須用較高的階數;對於一樣的濾波器設計指標,FIR濾波器所要求的階數可能比IIR濾波器高5-10倍,結果,成本較高,信號延時也較大;若是按線性相位要求來講,則IIR濾波器就必須加全通網絡進行相位校訂,一樣要大大增長濾波器的階數和複雜性。而FIR濾波器卻能夠獲得嚴格的線性相位。
從結構上看,IIR濾波器必須採用遞歸結構來配置極點,並保證極點位置在單位圓內。因爲有限字長效應,運算過程當中將對係數進行舍入處理,引發極點的偏移。這種狀況有時會形成穩定性問題,甚至產生寄生振盪。相反,FIR濾波器只要採用非遞歸結構,不論在理論上仍是在實際的有限精度運算中都不存在穩定性問題,所以形成的頻率特性偏差也較小。此外FIR濾波器能夠採用快速傅里葉變換算法,在相同階數的條件下,運算速度能夠快得多。
另外,也應看到,IIR濾波器雖然設計簡單,但主要是用於設計具備分段常數特性的濾波器,如低通、高通、帶通及帶阻等,每每脫離不了模擬濾波器的格局。而FIR濾波器則要靈活得多,尤爲是他易於適應某些特殊應用,如構成數字微分器或希爾波特變換器等,於是有更大的適應性和廣闊的應用領域。
從上面的簡單比較能夠看到IIR與FIR濾波器各有所長,因此在實際應用時應該從多方面考慮來加以選擇。從使用要求上來看,在對相位要求不敏感的場合,如語言通訊等,選用IIR較爲合適,這樣能夠充分發揮其經濟高效的特色;對於圖像信號處理,數據傳輸等以波形攜帶信息的系統,則對線性相位要求較高。若是有條件,採用FIR濾波器較好。固然,在實際應用中可能還要考慮更多方面的因素。
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 b0 (see bottom diagram). The other samples are zero, so the output y equals b0 (I'm presuming a maximum value for the pulse of 1). One sample later the pulse has moved one z−1 block and is multiplied by b1. Again, all other values are zero, so the output is b1. And so on. While the pulse shifts through the filter you get the successive values for bi at the output. After N samples the pulse is shifted out of the filter, and the output becomes zero again.
For an IIR filter it's not so obvious to derive the filter coefficients from the impulse response.
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 z−1 block represents a 1 sample delay. Biquads are often cascaded.
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.