FIR - and - IIR Filter - Design1
FIR - and - IIR Filter - Design1
• Introduction
• Types of filters
1. FIR filters
2. IIR filters
2
Introduction
• A digital filter is a mathematical algorithm implemented in
hardware and/or software that operates on a digital input signal
to produce a digital output signal for the purpose of achieving a
filtering objective.
• Digital filters operate on digitized analog signals or just
numbers, representing some variable, stored in a computer
memory.
Fig 1: A simplified block diagram of a real-time digital filter with analog input and
output signals1
3
• Digital filters are used in applications like data compression,
biomedical signal processing, speech and image processing, data
transmission, digital audio, telephone echo cancellation etc.
• Some advantages of digital filters over analog filters
1. Truly linear phase response.
2. Performance does not vary with environmental
changes, for example thermal variations.
3. The frequency response can be automatically
adjusted if the filter is implemented using a
programmable processor.
4. Digital filters can be used at very low frequencies.
4
• Main disadvantages of digital filters over analog filters
1. Speed limitation: The maximum bandwidth of
signals that digital filters can handle, in real time,
is much lower than for analog signals.
2. Finite wordlength effects: Digital filters are
subject to noises like ADC noise and roundoff
noise that could lead to instability.
3. Long design and development times: The design
and development times for digital filters,
especially hardware development, can be much
longer than for analog filters.
5
Types of filters
Digital filters
FIR IIR
6
• The input and output signals to the filter are related by the
convolution sum:
¥
y ( n) = å h( k ) x ( n - k )
k =0
IIR (1)
N -1
y ( n) = å h( k ) x ( n - k )
k =0
FIR (2)
åb kz
-k
H ( z) = k =0 IIR (5)
M
1+ åak =1
kz
-k
8
Choosing between FIR and IIR filters
FIR filters IIR filters
Can have exactly linear phase The phase responses are
1. response, i.e. do not distort the nonlinear, especially at the
phase of the signal. band edges.
FIR filters realized non- The stability of IIR filters
2. recursively are always stable. cannot be guaranteed.
The effects of using limited The effects like roundoff noise
3. number of bits to implement and coefficient quantization
filters are less severe. errors are more severe.
Require more coefficients for Less coefficients and thus less
4. sharp cutoff filters. processing time and storage.
No analog counterpart, but, Analog filters can be readily
5. easier to synthesize filters with transformed into equivalent
arbitrary frequency responses. IIR digital filters.
Algebraically more difficult to Less difficult to synthesize.
6. synthesize if CAD support is
9
not available.
• Thus, a broad guideline on when to use FIR or IIR would be
as follows:
10
Filter design steps
(i) Signal characteristics like data rates and width, the highest
frequency of interest etc.
(ii) Filter characteristics like the desired amplitude and/or
phase responses and their tolerances, speed of operation etc.
(iii) The manner of implementation, for example as a high-
level language on a computer or as a DSP processor-based
system.
(iv) Other design constraints like cost of the filter etc.
15
• The characteristics of digital filters are often specified in the
frequency domain.
dp passband deviation
ds stopband deviation
fp passband edge frequency
fs stopband edge frequency
17
2. Coefficient calculation
22
5. Implementation of a filter
• The computation of the filter output y(n) involves only
multiplications, additions/subtractions and delays.
• Thus to implement the filter, we need the following basic
blocks:
§ memory ( for example ROM) for storing filter
coefficients;
§ memory (such as RAM) for storing the
present and past inputs and outputs;
§ hardware or software multiplier(s);
§ adder or arithmetic logic unit;
23
• The designer provides these basic blocks and also ensures that
they are suitably configured for the application.
• For batch (non-real time) processing, the entire data is already
available in some memory device and the filter is often
implemented in a high level language and runs in a general-
purpose computer.
• Real-time filtering may require fast and dedicated hardware if
the sample rate is very high or if the filter is of a high order.
• For most audio-frequency work, DSP processors such as the
DSP56000 (by Motorola) and the TMS320C25 (by Texas
Instruments) will be adequate and offer considerable flexibility.
24