fir2

Syntax

Description

b = fir2(n,f,m) returns
an nth-order FIR filter with frequency-magnitude
characteristics specified in the vectors f and m.
The function linearly interpolates the desired frequency response
onto a dense grid and then uses the inverse Fourier transform and
a Hamming window to obtain the filter coefficients.

b = fir2(n,f,m,npt,lap) specifies npt,
the number of points in the interpolation grid, and lap,
the length of the region that fir2 inserts around
duplicate frequency points which specify steps in the frequency response.

Input Arguments

n — Filter orderinteger scalar

For configurations with a passband at the Nyquist frequency, fir2 always
uses an even order. If you specify an odd-valued n for
one of those configurations, then fir2 increments n by 1.

Data Types: double

f,m — Frequency-magnitude characteristicsvectors

Frequency-magnitude characteristics, specified as vectors of
the same length.

f is a vector of frequency points
in the range from 0 to 1, where 1 corresponds to the Nyquist frequency.
The first point of f must be 0
and the last point must be 1. f must
be sorted in increasing order. Duplicate frequency points are allowed
and are treated as steps in the frequency response.

m is a vector containing the desired
magnitude response at each of the points specified in f.

Data Types: double

npt — Number of grid points512 (default) | positive integer scalar

Number of grid points, specified as a positive integer scalar. npt must
be larger than one-half the filter order: npt > n/2.