主要内容

Lowpass FIR Filter Design

This example shows how to design a lowpass FIR filter usingfdesign. An ideal lowpass filter requires an infinite impulse response. Truncating or windowing the impulse response results in the so-called window method of FIR filter design.

A Lowpass FIR Filter Design Using Various Windows

FIR filters are widely used due to the powerful design algorithms that exist for them, their inherent stability when implemented in non-recursive form, the ease with which one can attain linear phase, their simple extensibility to multirate cases, and the ample hardware support that exists for them among other reasons. This example showcases functionality in the DSP System Toolbox™ for the design of low pass FIR filters with a variety of characteristics. Many of the concepts presented here can be extended to other responses such as highpass, bandpass, etc.

Consider a simple design of a lowpass filter with a cutoff frequency of 0.4*pi radians per sample:

FC = 0.4;n = 100;hf = fdesign.lowpass('N,Fc',n,fc);

We can design this lowpass filter using the window method. For example, we can use a Hamming window or a Dolph-Chebyshev window:

HD1 =设计(HF,'窗户','窗户',@hamming,“系统对象”,真的);Hd2 = design(Hf,'窗户','窗户',{@chebwin,50},...“系统对象”,真的);hfvt = fvtool(Hd1,Hd2,'颜色','白色的');传奇(hfvt,“锤窗设计”,...'Dolph-Chebyshev window design')

图量响应(DB)包含一个轴对象。The axes object with title Magnitude Response (dB) contains 3 objects of type line. These objects represent Hamming window design, Dolph-Chebyshev window design.

The choice of filter was arbitrary. Since ideally the order should be infinite, in general, a larger order results in a better approximation to ideal at the expense of a more costly implementation. For instance, with a Dolph-Chebyshev window, we can decrease the transition region by increasing the filter order:

Hf.FilterOrder = 200; Hd3 = design(Hf,'窗户','窗户',{@chebwin,50},...“系统对象”,真的);hfvt2 = fvtool(hd2,hd3,'颜色','白色的');legend(hfvt2,'Dolph-Chebyshev窗口设计。订单= 100',...'Dolph-Chebyshev窗口设计。Order = 200')

图量响应(DB)包含一个轴对象。带有标题幅度响应(DB)的轴对象包含2个类型线的对象。这些对象代表Dolph-Chebyshev窗口设计。订单= 100,Dolph-Chebyshev窗口设计。订单= 200。

Minimum Order Lowpass Filter Design

为了确定合适的过滤器订单,有必要指定将容忍的通带纹波和停止带衰减的量。还必须指定围绕理想截止频率的过渡区域的宽度。后者是通过设置PassBand Edge频率和停止带边缘频率来完成的。两者之间的差异决定了过渡宽度。

Fp = 0.38; Fst = 0.42; Ap = 0.06; Ast = 60; setspecs(Hf,'fp,fst,ap,ast',Fp,Fst,Ap,Ast);

We can still use the window method, along with a Kaiser window, to design the low pass filter.

Hd4 = design(Hf,'kaiserwin',“系统对象”,真的);measure(Hd4)
ans = Sample Rate : N/A (normalized frequency) Passband Edge : 0.38 3-dB Point : 0.39539 6-dB Point : 0.4 Stopband Edge : 0.42 Passband Ripple : 0.016058 dB Stopband Atten. : 60.092 dB Transition Width : 0.04
ans =
采样频率:N/A(归一化频率)通带边缘:0.38 3-DB点:0.39539 6-DB点:0.4停止边缘边缘:0.42 Passband Ripple:0.016058 db stopband atten。:60.092 DB过渡宽度:0.04

One thing to note is that the transition width as specified is centered around the cutoff frequency of 0.4 pi. This will become the point at which the gain of the lowpass filter is half the passband gain (or the point at which the filter reaches 6 dB of attenuation).

最佳最低订单设计

The Kaiser window design is not an optimal design and as a result the filter order required to meet the specifications using this method is larger than it needs to be. Equiripple designs result in the lowpass filter with the smallest possible order to meet a set of specifications.

Hd5 = design(Hf,'equiripple',“系统对象”,真的);hfvt3 = fvtool(Hd4,Hd5,'颜色','白色的');legend(hfvt3,'Kaiser窗户设计','Equiripple design')

图量响应(DB)包含一个轴对象。The axes object with title Magnitude Response (dB) contains 3 objects of type line. These objects represent Kaiser window design, Equiripple design.

在这种情况下,Equiripple设计需要146个系数,而Kaiser窗口设计需要183个系数。

See Also

|||

相关话题