Click here for help
on the firpm
function for ParksMcClellan filter design.
Download the data file nspeech2.mat for the following section.
Kaiser windows are versatile since they allow the design of arbitrary
filters which meet specific design constraints.
However, filters designed with Kaiser windows still
have a number of disadvantages. For example,
 Kaiser filters are not guaranteed to be the minimum
length filter which meets the design constraints.
 Kaiser filters do not allow passband and stopband ripple
to be varied independently.
Minimizing filter length is important because
in many applications the length of the filter determines
the amount of computation.
For example, an FIR filter of length NN
may be directly implemented in the time domain
by evaluating the expression
y
(
n
)
=
∑
k
=
0
N

1
x
(
n

k
)
h
(
k
)
.
y
(
n
)
=
∑
k
=
0
N

1
x
(
n

k
)
h
(
k
)
.
(16)For each output value y(n)y(n) this expression requires NN multiplies
and N1N1 additions.
Oftentimes h(n)h(n) is a symmetric filter so that h(n)=h(N1n)h(n)=h(N1n).
If the filter h(n)h(n) is symmetric and NN is even,
then Equation 16 may be more efficiently computed as
y
(
n
)
=
∑
k
=
0
N
/
2

1
x
(
n

k
)
+
x
(
n

N
+
1
+
k
)
h
(
k
)
.
y
(
n
)
=
∑
k
=
0
N
/
2

1
x
(
n

k
)
+
x
(
n

N
+
1
+
k
)
h
(
k
)
.
(17)This strategy reduces the computation to N/2N/2 multiplies
and N1N1 adds for any value of NN.
Note that the computational effort is linearly proportional to the length
of the filter.
The Kaiser filters do not guarantee the minimum possible filter length.
Since the filter has equal passband
and stopband ripple, it will usually exceed design requirements
in one of the two bands; this results in an unnecessarily long filter.
A better design would allow the stopband and passband
constraints to be specified separately.
In 1972, Parks and McClellan devised a methodology
for designing symmetric filters that minimize filter length
for a particular set of design constraints
{ωpωp, ωsωs, δpδp, δsδs}.
The resulting filters minimize
the maximum error between the desired frequency response
and the actual frequency response
by spreading the approximation error uniformly
over each band.
The Parks and McClellan algorithm makes use
of the Remez exchange algorithm and Chebyshev approximation theory.
Such filters that exhibit equiripple behavior
in both the passband and the stopband, and are sometimes called
equiripple filters.
As with Kaiser filters, designing a filter with the Parks and McClellan
algorithm is a two step process.
First the length (i.e. order) of the filter must be computed
based on the design constraints.
Then the optimal filter for a specified length can be determined.
As with Kaiser windows, the filter length computation is approximate
so the resulting filter may exceed or violate the design constraints.
This is generally not a problem since the filter can
be redesigned for different lengths until the constraints
are just met.
The Matlab command for computing the approximate filter length
is
[n,fo,mo,w] = firpmord(f,m,ripple,2*pi)
where the inputs are:
f
 vector containing an even number
of band edge frequencies. For a simple low pass filter,
f=[wp,ws]
, where wp
and ws
are the passband and stopband frequencies, respectively.
m
 vector containing the ideal filter magnitudes
of the filter in each band. For a simple low pass filter
m=[1,0]
.
ripple
 vector containing the allowed ripple in
each band. For a simple low pass filter
ripple=[delta_p,delta_s]
, where
delta_p
and delta_s
are the passband and stopband
ripples, respectively.
2*pi
 value, in radians, that corresponds to the
sampling frequency.
The outputs of the command are n = filter length  1
,
and the vectors fo
, mo
, and w
which are
intermediate filter parameters.
Once the filter length, n
, is obtained,
the Matlab command for designing a ParksMcClellan filter
is b = firpm(n,fo,mo,w)
.
The inputs n
, fo
, mo
, and w
are the
corresponding outputs of firpmord
,
and the output b
is a vector of FIR filter coefficients
such that
H
(
z
)
=
b
(
1
)
+
b
(
2
)
z

1
+
⋯
+
b
(
n
+
1
)
z

n
H
(
z
)
=
b
(
1
)
+
b
(
2
)
z

1
+
⋯
+
b
(
n
+
1
)
z

n
(18)(What is the impulse response of this filter?)
For further information, read the help document on using Matlab to implement the ParksMcClellan algorithm.
Now design a symmetric FIR filter using firpmord
and firpm
in Matlab to meet the design specifications
given in the "Filter Design Using the Kaiser Window"
section.
Compute the DTFT of the filter's response for at least 512 points,
and use this result to
compute the passband and stopband ripple of the filter that was designed.
Adjust the filter length until the minimum order which
meets the design constraints is found.
Plot the magnitude of the DTFT in dB of the final filter design.
Do the following:

Submit the final measured values of filter length, passband ripple,
and stopband ripple.
How accurate was the filter order computation using Matlab's
firpmord
?
How does the length of this filter compare to the filter
designed using a Kaiser window?
 Submit the plot of the filter's DTFT.
How does the frequency response of the ParksMcClellan filter
compare to the filter designed using the Kaiser window?
Comment on the shape of both the passband and stopband.
Use the filter you have designed to remove the noise
from the signal
nspeech2.mat
.
Play the noisy and filtered speech signals back using
sound
and listen to them carefully.
Compute the
DTFT of 400 samples of the filtered signal starting
at time n=20,001n=20,001 (i.e. 20001:20400
).
Plot the magnitude of the DTFT in decibels versus frequency
in radians for ω<πω<π.
Compare this with the spectrum of the noisy speech signal shown
in Figure 4, and also with
the magnitude of the DTFT of the Kaiser filtered signal.
Submit the plot of the DTFT magnitude for the filtered signal.
Comment on how the audio quality
of the signal changes after filtering. Also comment on any
differences in audio quality between the ParksMcClellan filtered
speech and the Kaiser filtered speech.