Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Jarosław MAGIERA Gdańsk, 27.01.

2011
Digital Signal Processing – FIR and IIR filters project.

1. Aim of this project

The aim of this project was to design two filters, FIR and IIR, of similar characteristics. MATLAB tools:
fdatool and fvtool were used to perform this task.

2. Filter specification

First of all, filter specification was prepared. I decided to design an anti-aliasing filter, which could be
used for music recording with Sony CD audio standard.
This standard defines sampling frequency to be 44100 Hz with 16 bits per sample. To fulfill the
Nyquist theorem, the maximum frequency of sampled signal must be no more than 22050Hz.
I decided to set the stopband begin frequency to be 22kHz. I chose stopband attenuation value to be
50dB relative to passband attenuation. 50dB is 100000 in linear scale which, I think, is sufficient. If it
is not enough, one may use 2 or more such filters in cascade.
People usually hear sounds in frequency band between 20Hz and 20KHz. Since antialiasing filter is
a lowpass filter, I did not set a passband begin frequency, so signals are passed through filter from DC
to passband end frequency. I set the passband end frequency to be 20kHz.
In high-quality sound recording it is important that all hearable frequency components are equally
attenuated. Beacause of this fact, I applied a constraint, that fluctuation of attenuation in passband is
not greater than 0.1dB.
It is also important that all frequency components are equally time-delayed, so a filter of constant
group delay is preferred.

3. Designing of filters

Below I presented screenshots from fdatool, showing the design phase of both filters, basing on the
above specification.
First, a FIR filter was designed using window method. Kaiser window type was chosen. Order of the
filter, resulting from specification, is 65.
Next, IIR structure filter was designed. It is a one-section second order Direct-Form II filter.

4. Filters’ transfer functions

FIR transfer function can be written as:


, where
bk={ 8,10660498861914e-05, -8,08421849094837e-18, -0,000148015633864176
0,000376433884052441, -0,000696806735351348, 0,00111763737969683,
-0,00164320566716870, 0,00227242374082970, -0,00299778099829732
0,00380443582870708, -0,00466950562659367, 0,00556159609631506
-0,00644059561597685, 0,00725774019081808, -0,00795592886235715
0,00847023742836261, -0,00872853802955940, 0,00865207967367857
-0,00815581249481202, 0,00714813180813246, -0,00552954824312336
0,00318950049768868, -2,99887575935439e-17, -0,00419622254501140
0,00960749472219802, -0,0165339451017785, 0,0254472693504411
-0,0371586464438421, 0,0532111734975581, -0,0769448211383966
0,117115509508552, -0,205985235732544, 0,634471879211760
0,634471879211760, -0,205985235732544, 0,117115509508552
-0,0769448211383966, 0,0532111734975581, -0,0371586464438421
0,0254472693504411, -0,0165339451017785, 0,00960749472219802
-0,00419622254501140, -2,99887575935439e-17, 0,00318950049768868
-0,00552954824312336, 0,00714813180813246, -0,00815581249481202
0,00865207967367857, -0,00872853802955940, 0,00847023742836261
-0,00795592886235715, 0,00725774019081808, -0,00644059561597685
0,00556159609631506, -0,00466950562659367, 0,00380443582870708
-0,00299778099829732, 0,00227242374082970, -0,00164320566716870
0,00111763737969683, -0,000696806735351348, 0,000376433884052441
-0,000148015633864176, -8,08421849094837e-18, 8,10660498861914e-05}

IIR transfer function can be written as


,where
bk={0,8994, 1,17988, 0,8994}
ak={1,7871, 0,8106}

5. Filters’ characteristics

In this section, graphical representation of filters’ characteristics are shown. These include:
magnitude response, phase response, group delay response, pole-zero plot and impulse response.
For the first three characteristics from listed above, common graphs were drawn for both filters. Blue
chart represents IIR filter, while green chart represents FIR one.

Magnitude responses for both filters are very similar. Visible difference is only in transition band,
between passband and stopband. Attenuation in this band is slightly greater for FIR filter.

Difference between phase responses is clearly visible. Phase characteristic of IIR filter is nonlinear. It
is equal to 0 radians at DC and decreases monotonically. At 20 kHz frequency it is about -0,75π
radians.
For FIR filter, phase characteristic is linear and it decreases about -4,6π radians per 1 kHz, starting
from 0.
Group delay response is a first derivative of phase over frequency. For IIR filter, group delay is low,
but not linear. For low frequencies it is close to 0 and at 20kHz it is about 2.75 samples. So, generally,
delay is low but not equal for different frequencies. For FIR filter, delay is equal to 32.5 samples at all
frequencies.

Pole-zero plots and impuse responses were drawn on separate graphs.

FIR filter’s transmission function has 65 zeroes and one pole. Pole is located in the origin, so the filter
is stable. Structure of such filter is rather complicated since 66 multipliers and 65 adders must be
used.
IIR filter’s transmission function has only one zero and two poles. Both poles are located inside unit
circle, so the filter is also stable. Structure of such filter is much simpler than FIR one. It takes only 5
multipliers and 4 adders.

Impulse response of FIR filter is symmetrical relative to the point between 32nd and 33rd sample. It
is equal to group delay, which is 32.5 samples.
Impulse response for IIR filter is not symmetrical. Largest sample occurs at t=0, which suggests low
group delay for most frequencies.

6. Summary
Two filters were designed using MATLAB tools. Their performances were compared, taking into
consideration their application in CD audio systems.
Magnitude response is nearly the same for bot filters.
IIR filter is simpler and inserts small group delay. However, group delay in this filter depends on signal
frequency. This may cause distortion during audio signal processing.
FIR filter is free from this disadvantage. It has constant group delay. This delay, about 737μs, is much
greater than in IIR. However, such delay shouldn’t be a problem, since it’s not a real-time system.
Eventually, I think that - if high fidelity of sound is expected – FIR filter should be used.
On the other hand, human ear may even not notice the 2.75-sample (about 62 μs) difference in
delay. In such case, IIR filter can be used, since it has a simpler structure than FIR.

You might also like