MATLAB 函數之 fir1,freqz

fir1

Window-based finite impulse response filter design

基於窗口的有限脈衝響應濾波器設計

b = fir1(n,Wn)
b = fir1(n,Wn,'ftype')
b = fir1(n,Wn,window)
b = fir1(n,Wn,'ftype',window)
b = fir1(...,'normalization')

fir1 implements the classical method of windowed linear-phase FIR digital filter design [1]. It designs filters in standard lowpass, highpass, bandpass, and bandstop configurations. By default the filter is normalized so that the magnitude response of the filter at the center frequency of the passband is 0 dB.

fir1實現了帶窗線性相位FIR數字濾波器設計的經典方法[1]。它設計了標準低通、高通、帶通和帶阻濾波器。默認情況下,將濾波器歸一化,使通帶中心頻率處濾波器的幅值響應爲0 dB。對於具有任意頻率響應的窗口過濾器使用fir2。

b = fir1(n,Wn) returns row vector b containing the n+1 coefficients of an order n lowpass FIR filter. This is a Hamming-window based, linear-phase filter with normalized cutoff frequency Wn. The output filter coefficients, b, are ordered in descending powers of z.

返回值:

b = fir1(n,Wn)返回含有n+1階低通FIR濾波器係數的行向量b。這是一個基於漢明窗的線性相位濾波器,帶有歸一化截止頻率Wn。輸出濾波器係數b,按z的降序排列。

Wn is a number between 0 and 1, where 1 corresponds to the Nyquist frequency.

Wn是0到1之間的一個數,其中1對應於Nyquist頻率。

If Wn is a two-element vector, Wn = [w1 w2], fir1 returns a bandpass filter with passband w1 < ω< w2. 
If Wn is a multi-element vector, Wn = [w1 w2 w3 w4 w5 ... wn], fir1 returns an order n multiband filter with bands 0 < ω< w1, w1 < ω< w2, ..., wn < ω< 1.
 

雙元素向量,如果Wn Wn = (w1 w2) fir1返回一個帶通濾波器通頻帶w1 <ω< w2。

如果Wn是一個多元素向量,則Wn = [w1 w2 w3 w4 w5…wn), fir1返回一個階數爲n,帶寬爲0 <ω< w1, w1 <ω< w2,……wn <ω< 1多頻帶濾波器。

 

freqz函數:

Frequency response of filter 濾波器頻率響應

[h,w] = freqz(hfilt)
[h,w] = freqz(hfilt,n)
freqz(hfilt)
[h,w] = freqz(hs)
[h,w] = freqz(hs,n)
[h,w] = freqz(hs,Name,Value)
freqz(hs)

freqz returns the frequency response based on the current filter coefficients. This section describes common freqz operation with adaptive filters, discrete-time filters, multirate filters, and filter System objects. For more input options, refer to freqz in Signal Processing Toolbox™ documentation.

freqz返回頻率響應是基於當前的濾波器係數。本節描述自適應濾波器、離散時間濾波器、多速率濾波器和濾波器系統對象的常見freqz操作。

[h,w] = freqz(hfilt)

returns the frequency response h and the corresponding frequencies w at which the filter response of hfilt is computed. The frequency response is evaluated at 8192 points equally spaced around the upper half of the unit circle.

返回計算濾波器hfilt 頻率響應h和相對應的頻率w;頻率響應在單位圓的上半部分等距的8192點處進行評估。

freqz的用法:

MATLAB提供了專門用於求離散系統頻響特性的函數freqz(),調用freqz()的格式有以下兩種:

   [H,w]=freqz(B,A,N)

 

    B和A分別爲離散系統的系統函數分子、分母多項式的係數向量,N爲正整數,返回量H則包含了離散系統頻響 在 0——pi範圍內N個頻率等分點的值,向量w則包含 範圍內N個頻率等分點。調用中若N默認,默認值爲512。

    [H,w]=freqz(B,A,N,’whole’)

 

該調用格式將計算離散系統在0—pi範內的N個頻率等分店的頻率響應的值。

因此,可以先調用freqz()函數計算系統的頻率響應,然後利用abs()和angle()函數及plot()函數,即可繪製出系統在 或 範圍內的頻響曲線。

繪製如下系統的頻響曲線

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章