0% found this document useful (0 votes)
19 views

FIR - and - IIR Filter - Design1

Digital filters are mathematical algorithms that operate on digitized signals to achieve a filtering objective. There are two main types: FIR filters, which are always stable but require more coefficients, and IIR filters, which require fewer coefficients but can have stability issues. Designing a digital filter involves specifying requirements, calculating coefficients, realizing the filter structure, and implementing it in software or hardware.

Uploaded by

divyarajc073
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

FIR - and - IIR Filter - Design1

Digital filters are mathematical algorithms that operate on digitized signals to achieve a filtering objective. There are two main types: FIR filters, which are always stable but require more coefficients, and IIR filters, which require fewer coefficients but can have stability issues. Designing a digital filter involves specifying requirements, calculating coefficients, realizing the filter structure, and implementing it in software or hardware.

Uploaded by

divyarajc073
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Digital Filters

• Introduction

• Types of filters
1. FIR filters
2. IIR filters

• Choosing between FIR and IIR filters

• Filter design steps

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

• A digital filter in general can be represented by its impulse


response, h(k) (k=0,1,..) as in the following figure:

Fig 2: A conceptual representation of a digital filter1

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)

• Because of the infinite length of the impulse response of the


IIR filter, the IIR filtering equation can be expressed in a
recursive form as:
¥ N M
y ( n) = å h( k ) x ( n - k ) = å b x ( n - k ) - å a
k =0 k =0
k
k =1
k y (n - k ) (3)

where ak and bk are the coefficients of the filter.


7
• We note that in eqn (3), the current output sample, y(n), is a
function of past outputs as well as present and past input
samples, that is the IIR is a feedback system of some sort.
• In the FIR equation, the current output sample, y(n), is a
function only of past and present values of the input.
• The transfer functions of FIR and IIR filters:
N -1
H ( z) = å h( k ) z
k =0
-k
FIR (4)
N

å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:

• Use IIR when the only important requirements are


sharp cutoff filters and high throughput, as IIR filters
will give fewer coefficients than FIR.

• Use FIR if the number of filter coefficients is not


too large and, in particular, if little or no phase
distortion is desired.

10
Filter design steps

The design of a digital filter involves five steps:

1. Specification of the filter requirements.


2. Calculation of suitable filter coefficients.
3. Representation of the filter by a suitable structure
(realization).
4. Analysis of the effects of finite wordlength on
filter performance.
5. Implementation of filter in software and/or
hardware.
14
1. Specification of the filter requirements

Requirement specifications include specifying the


following:

(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.

Fig 4: Tolerance scheme for a low pass filter1

• The width of the transition band specifies how sharp the


filter is.
16
The following are the key parameters of interest:

dp passband deviation

ds stopband deviation
fp passband edge frequency
fs stopband edge frequency

As (stopband attenuation) = -20 log 10 d s

A p (passband ripple) = 20 log 10 (1 + d p )

17
2. Coefficient calculation

§ For IIR filters (calculating ak and bk )


• Calculations of IIR filter coefficients are traditionally based on
the transformation of known analog filter characteristics into
equivalent digital filters.
• The two basic methods used are impulse invariant and
bilinear transformation methods.
• The impulse invariant method is good for simulating analog
systems, but the bilinear method is best for frequency selective
IIR filters.
• The pole-zero placement method offers an alternative
approach and is an easy way of calculating the coefficients of
very simple filters. 18
§ For FIR filters (calculating h(k) )

• The three methods generally followed are window, frequency


sampling, and optimal (Parks-McClellan algorithm) methods.
• The window method offers a very simple and flexible way of
computing FIR filter coefficients, but it does not allow the
designer adequate control over the filter parameters.
• Frequency sampling method allows a recursive realization of
FIR filters which can be computationally very efficient, but
however lacks flexibility in specifying or controlling filter
parameters.
• The optimal method is now widely used in the industry, with the
availability of an efficient and easy-to-use program, and for most
applications, will yield the desired FIR filters.
19
3. Representation of a filter by a suitable
structure (realization)
• Realization involves converting a given transfer function,
H(z), into a suitable filter structure that is generally depicted
using block or flow diagrams and shows the computational
procedure for implementing the digital filter.
• Commonly used realization structures for FIR and IIR filters:
FIR IIR
• transversal (direct) • direct form
• frequency sampling • cascade
• fast convolution • parallel
• lattice • lattice
20
4. Analysis of finite wordlength effects

• In actual implementations, it is necessary to represent the filter


coefficients using a limited number of bits, typically 8 to 16 bits.
• The arithmetic operations indicated in the difference equations
are performed using finite precision arithmetic.
• As a result, there is a degradation in the performance of the
filters from the following sources:

1. Input/output signal quantization


2. Coefficient quantization
3. Arithmetic roundoff errors
4. Overflow
21
• The extent of filter degradation depends on:

(i) the wordlength and type of arithmetic used to


perform the filtering operation
(ii) the method used to quantize filter coefficients and
variables to the chosen wordlengths
(iii) the filter structure

• With a knowledge of these factors, the designer can assess the


effects of finite wordlength on the filter performance and take
remedial action if necessary.

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

You might also like