Signal Processing Toolbox Help Desk

fir2

Purpose

Window-based finite impulse response filter design--arbitrary response.

Syntax

Description

fir2 designs windowed digital FIR filters with arbitrarily shaped frequency response. (For standard lowpass, bandpass, highpass, and bandstop configurations, use fir1.)

b = fir2(n,f,m) returns row vector b containing the n+1 coefficients of an order n FIR filter. The frequency-magnitude characteristics of this filter match those given by vectors f and m:

Use plot(f,m) to view the filter shape.

The output filter coefficients, b, are ordered in descending powers of z:

b = fir2(n,f,m,window) uses the window specified in column vector window for the filter design. The vector window must be n+1 elements long. If no window is specified, fir2 employs a Hamming window.

b = fir2(n,f,m,npt) and

b = fir2(n,f,m,npt, window) specify the number of points npt for the grid onto which fir2 interpolates the frequency response, with or without a window specification.

b = fir2(n,f,m,npt,lap) and

b = fir2(n,f,m,npt,lap,window) specify the size of the region, lap, that fir2 inserts around duplicate frequency points, with or without a window specification.

See the "Algorithm" section for more on npt and lap.

Algorithm

The desired frequency response is interpolated onto a dense, evenly spaced grid of length npt. npt is 512 by default. If two successive values of f are the same, a region of lap points is set up around this frequency to provide a smooth but steep transition in the requested frequency response. By default, lap is 25. The filter coefficients are obtained by applying an inverse fast Fourier transform to the grid and multiplying by a window; by default, this is a Hamming window.

Example

Design a 30th-order lowpass filter and overplot the desired frequency response with the actual frequency response:

See Also

butter

Butterworth analog and digital filter design.

cheby1

Chebyshev type I filter design (passband ripple).

cheby2

Chebyshev type II filter design (stopband ripple).

ellip

Elliptic (Cauer) filter design.

fir1

Window-based finite impulse response filter design-- standard response.

maxflat

Generalized digital Butterworth filter design.

remez

Parks-McClellan optimal FIR filter design.

yulewalk

Recursive digital filter design.



[ Previous | Help Desk | Next ]