Digital Signal Processing Reference
In-Depth Information
5.6 DESIGN OF EQUIRIPPLE FIR FILTERS USING MATLAB
The first step is to estimate the order of the FIR filter, using the function reme-
zord which was explained earlier. The next step is to find the coefficients of the
FIR filter using the function remez , which has several options:
b=remez(N, fpoints, magpoints)
b=remez(N, fpoints, magpoints, wt)
b=remez(N, fpoints, magpoints, 'ftype')
b=remez(N, fpoints, magpoints, wt, 'ftype')
The vector fpoints lists the edges of the passbands and stopbands, starting
from ω
1 (which is the normalized Nyquist frequency).
In contrast to the function remezord ,thisvector fpoints includes 0 and 1.0
as the first and last entries. The edges between the passbands and the adjacent
stopband must have a separation of at least 0.1; otherwise the program automat-
ically creates a transition band of 0.1 between them, and these transition bands
are considered as “don't care” regions. The vector magpoints lists the mag-
nitudes in the frequency response at each edge of the passband and stopband.
The weighting function can be prescribed for each frequency band as explained
above. The function remez chooses type I filters for even-order N and type II
filters for odd order as the default choice. The flags 'hilbert' and 'differ-
entiator' are used for the option ftype for designing the Hilbert transformer
and the differentiator, respectively. The other input variables are the same as
the outputs obtained from remezord , and hence we can use the two functions
remezord and remez together in one M-file to design an equiripple FIR filter
with linear phase as listed and described below.
=
0 and ending with ω
=
5.6.1 Use of MATLAB Program to Design Equiripple FIR Filters
Example 5.10
%Program to obtain the unit impulse response coefficients
% of an equiripple, FIR filter with a linear phase
edgepoints= input('Type in the edge frequencies of
each band =');
%Type in normalized edge frequencies between 0 and 1,
% excluding 0 and 1, when Fs=2
%or actual frequencies in Hz and choose FT also in Hz
Fs= input('Sampling frequency in Hz =')
%The bandmag is the magnitude in each band from 0 to 1
bandmag =input('Type in the magnitude values for each
passband and stopband =');
% There must be one value in dev and in wt for each band
dev=input('Desired ripple in each band =');
wt=input('Type in values for the relative weights in each
Search WWH ::




Custom Search