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.

扫描二维码关注公众号,回复: 4526532 查看本文章

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()函数,即可绘制出系统在 或 范围内的频响曲线。

绘制如下系统的频响曲线

猜你喜欢

转载自blog.csdn.net/sheng_bw/article/details/84255562