Sunteți pe pagina 1din 50

Discrete Time Systems

Lecture # 11
IIR Filter Design

Filter Design Specifications

Problem

The filter design process

Analysis

Performance
Constraints

Magnitude Response
Phase response
Cost/complexity

Design
FIR/IIR
Subtype
order

Dr Sajjad Zaidi - DSP

Transfer
function

Implementation
Platform
structure

Performance Constraints
.. in terms of magnitude response:

Dr Sajjad Zaidi - DSP

Performance Constraints
Smallest
Passband
Ripple

Best Filter

Narrowest

Transition
Band
Min Stopband
Attenuation
Greatest
improving one usually worsens others

But: increasing filter order (i.e. cost)


improves all three measures

Dr Sajjad Zaidi - DSP

Passband Ripple

Assume peak passband gain = 1


then minimum passband gain =
Or, ripple

Dr Sajjad Zaidi - DSP

Stopband Ripple

Peak passband gain is A larger than peak stopband gain


Hence, minimum stopband attenuation

Dr Sajjad Zaidi - DSP

Filter Type Choice FIR vs IIR


FIR

IIR

No Feedback
(just zeros)

Feedback
(poles & zeros)

Always stable

May be unstable

Can be linear phase

Difficult to control phase

High order
(20 2000)

Typ < 1/10


Order of FIR (4-20)

Unrelated to CT filtering Derive from analog


prototype

Dr Sajjad Zaidi - DSP

FIR vs. IIR


If you care about computational cost
Use low-complexity IIR
Computation no object LP FIR

If you care about phase response


Use linear-phase FIR
Phase unimportant go with simple IIR)

Dr Sajjad Zaidi - DSP

INFINITE IMPULSE RESPONSE FILTERS

Dr Sajjad Zaidi - DSP

IIR Filter Design


IIR filters are directly related to
analog filters (continuous time)
via a mapping of H(s) (Continuous Time)
to H(z) (Discrete Time)

It preserves many properties

Analog filter design is sophisticated


decades of pre-DSP signal processing

Design IIR filters via analog prototype


hence, need to learn some CT filter design

Dr Sajjad Zaidi - DSP

10

Analog Filter Design


Decades of analysis of transistor-based
filters sophisticated, well understood

Basic choices:
ripples vs. flatness in stop and/or passband
more ripples narrower transition band

Dr Sajjad Zaidi - DSP

11

CT Transfer Functions
Analog systems: s-transform (Laplace)

Dr Sajjad Zaidi - DSP

12

Butterworth Filters
Maximally flat in both pass & stop bands

Dr Sajjad Zaidi - DSP

13

Butterworth Filters

Dr Sajjad Zaidi - DSP

14

Butterworth Filters
How to meet design specifications?

Dr Sajjad Zaidi - DSP

15

Butterworth Filters

Dr Sajjad Zaidi - DSP

16

Butterworth Example
Design a Butterworth filter
with 1 dB cutoff at 1kHz and
a minimum attenuation of 40
dB at 5 kHz

Dr Sajjad Zaidi - DSP

17

Steps in Filter Design


The general filter design problem can be briefly stated as
follows.
Given some ideal frequency response, D(f), find a realizable IIR or
FIR digital filter whose frequency response, H(f), approximates D(f)

The realizable filter is found by optimizing some measure


of the filters performance, e.g
Minimizing the filter order (IIR) or the filter length (FIR),
Minimizing the width of the transition bands,
Reducing the passband error and/or stopband error

Setting up the specifications for the general filter design


problem will define these parameters and show which
trade-offs are possible.

Dr Sajjad Zaidi - DSP

18

Butterworth Example
Order N = 4 will satisfy constraints;
What are c and filter coefficients?
from a lookup table, -1dB = 0.845 when c = 1
So c = 1000/0.845 = 1.184 kHz

from a table, get normalized coefficients for


N = 4, scale by 1184

Or, use Matlab:


[b,a] = butter(N,c,s);

Dr Sajjad Zaidi - DSP

19

Analog Filter Types Summary

Dr Sajjad Zaidi - DSP

20

Dr Sajjad Zaidi - DSP

21

Dr Sajjad Zaidi - DSP

22

Steps in Filter Designing


Following are the steps to design a filter
1.
2.
3.
4.
5.
6.

Create the Design Specifications


Obtain Specs Derived from Analog Filtering
Specifying an Error Measure
Select the Filter Type and Order
Design the Filter
Realize the Designed Filter

Dr Sajjad Zaidi - DSP

23

Infinite Input Response Filter


The impulse response h(n) has an infinite number of nonzero samples (infinite length)
As an example, for a general IIR filter, h(n)0 only for No<n<,
where No is a non-negative integer

The frequency response H() is a rational function, i.e., a


ratio of two finite-degree polynomials in ej of the form

where No is an integer constant.

The order of an IIR filter is equal to N, which is the degree


of the denominator ;
Usually the degree of numerator M is not greater than N

Dr Sajjad Zaidi - DSP

24

Infinite Input Response Filter


Remember
The order N also determines the number of previous output
samples that need to be stored and then fed back to compute the
current output sample.
Therefore, IIR systems are also known as feedback systems.
The filter coefficients {bn} and {an} in the Eq correspond to the
unknown parameters of the design.

Dr Sajjad Zaidi - DSP

25

Infinite Input Response Filter


Designing an IIR filter amounts to finding the rational
function

The H( ) should best approximates the design


specifications.
In the frequency domain, this is done by computing the
optimal (relative to some criteria) coefficients {bn} and {an}
The filter order N is usually fixed, but can also be
considered as a free parameter to be optimized.

Dr Sajjad Zaidi - DSP

26

Infinite Input Response Filter


Filter transfer function, denoted by H(z), is the z-transform
of h(n) and is useful for studying the stability of the system.
For LSI filters, stability implies that a bounded input to the
filter will always result in a bounded output.
For IIR filters, H(z) is a rational function in the complex
variable z and is given by

Dr Sajjad Zaidi - DSP

27

Infinite Input Response Filter


Because the impulse response is infinitely long,
convolution can no longer be used to implement the IIR
filters.
Instead, IIR filters are efficiently implemented using
feedback difference equations
The noise characteristics of an IIR filter can be a major
consideration when doing an implementation, especially in
fixed-point arithmetic.
Coefficient quantization degrades the actual filter response
from that designed by high-precision software.
More critical is round-off noise sensitivity which can be
amplified by the feedback loops in the filter.

Dr Sajjad Zaidi - DSP

28

Infinite Input Response Filter - Pros


Compared to FIR filters,
IIR filters can achieve the desired design specifications with a relatively low order (as few
as 4 to 6 poles).

Fewer unknown parameters need to be computed and stored, which might


lead to a lower design and implementation complexity.
However, the phase response of IIR filters is never linear, which leads to the
use of all pass filters to compensate the group delay, and
Thus raises the order of the filter and
The complexity of the design process.

IIR filters are commonly designed by using closed-form design formulas


corresponding to classical filter types
The order-estimating formulas for IIR filters are exact since they are derived from
the mathematical properties of the classical prototypes.
These formulas are very useful to obtain the IIR filter order needed to satisfy the
desired design specifications.

Dr Sajjad Zaidi - DSP

29

Designing the Filter


IIR filters are Commonly designed by
Transforming the digital design specifications in to analog design
specifications
Performing the filter design in the analog domain.
Transforming the analog filter into a digital filter using a suitable
transformation.

Popular Method are


Bilinear Transformation method
1.
2.
3.
4.

Butterworth,
Chebyshev I
Chebyshev II
Elliptic

Digital-only IIR design methods

Dr Sajjad Zaidi - DSP

30

Example IIR Filter Design


Question Design a digital low-pass Butterworth filter with a 3dB cut-off frequency
of 2kHz and minimum attenuation of 30dB at 4.25kHz for a sampling rate of 10kHz.

Dr Sajjad Zaidi - DSP

31

Dr Sajjad Zaidi - DSP

32

Realizing the Designed Filter


Realizing the designed digital filter corresponds to
computing the output of the filter in response to any given
input.
For LSI filters, this is simplified by the fact that the input
and output signals are related through a simple convolution
operation in the time/space domain.
If x(n) is the input, y(n) the corresponding output, and h(n)
the impulse response of the LSI filter, then this relation is
given by

where N1,N2 are the indices of the 1st and last non-zero samples of h(n).
Dr Sajjad Zaidi - DSP

33

Realizing the Designed Filter


In the frequency (Fourier transform) domain, the
convolution relation (11.14) corresponds to multiplication of
the respective Fourier transforms:

where X(), H(), and Y() are the DTFT of x(n), h(n), and y(n), respectively.

But The variable is continuous and, therefore, it cannot be


implemented in practice
An implementable version is obtained by using the Discrete
Fourier Transform (DFT), which is a sampled version of the
DTFT and which consists of samples of the DTFT
evaluated at the points
N is the size of the DFT and
2 k

k 0,K , N 1 corresponds to the number of


sample points within the period 2
N DFT
DFT

Dr Sajjad Zaidi - DSP

34

Simple IIR Lowpass


IIR feedback, zeros and poles,
conditional stability, h[n] less useful
1

1 z
H LP [ z ] K
1 z 1
scale to make
gain = 1 at = 0

pole-zero
diagram

K = (1 - )/2

frequency
response
Dr Sajjad Zaidi
- DSP

FR on
log-log axes

35

Simple IIR Lowpass


1

1 z
H LP [ z ] K
1 z 1
Cutoff freq. c from

Dr Sajjad Zaidi - DSP

36

Simple IIR Highpass

1 z 1
H HP [ z ] K
1
1 z
Pass =
HHP(-1)=1

K=(1+)/2

Dr Sajjad Zaidi - DSP

37

Highpass and Lowpass


Consider lowpass filter:

then

However
(unless H(ejw) is pure real not for IIR)
Dr Sajjad Zaidi - DSP

38

Simple IIR Bandpass

Dr Sajjad Zaidi - DSP

39

Simple Filter Example


Task
Design a second order IIR bandpass filter with c=0.4,
3dB bandwidth of 0.1

Dr Sajjad Zaidi - DSP

40

Simple IIR Bandstop

Dr Sajjad Zaidi - DSP

41

Cascading Filter
Repeating a filter (cascade connection) makes its
characteristics more abrupt:

Repeated roots in z-plane:

Dr Sajjad Zaidi - DSP

42

Cascading Filter
Cascade systems are higher order
e.g. longer (finite) impulse response:

In general, cascade filters will not be optimal for a given


order

Dr Sajjad Zaidi - DSP

43

Linear-phase Filters
|H(ej)| alone can hide phase distortion
differing delays for adjacent frequencies can mangle the signal

Prefer filters with a flat phase response


e.g. () = 0

zero phase filter

A filter with constant delay p = D at all freqs has


() = D

linear phase

Linear phase can shift to zero phase

Dr Sajjad Zaidi - DSP

44

Time reversal filtering


u[n]

v[n]
x[n]

H(z)

Time
reversal

H(z)

w[n
]

Time
reversal

y[n]

Achieves zero-phase result


Not causal! Need whole signal first
Dr Sajjad Zaidi - DSP

45

Some Filter Types


We have seen the basics of filters and a range of
simple examples
Now look at a couple of other classes:
Comb filters - multiple pass/stop bands
Allpass filters - only modify signal phase

Dr Sajjad Zaidi - DSP

46

Comb Filter
Replace all system delays z-1 with longer delays z-L

System that behaves the same at a longer timescale

Dr Sajjad Zaidi - DSP

47

Comb Filter
Parent filter impulse response h[n] becomes comb filter
output
g[n] = {h[0] 0 0 0 0 h[1] 0 0 0 0 h[2]..}

Thus,

Thus frequency response:

High-pass response
pass = /L, 3/L, 5/L...
cut = 0, 2/L, 4/L...
Dr Sajjad Zaidi - DSP

48

Allpass Filter
Allpass filter has |A(ej)|2 = K
i.e. spectral energy is not changed

Phase response is nonzero (else


trivial)
phase correction or special effects

e.g.
Allpass has special form of system
fn

AM(z) has poles where DM() = 0


AM(z) has zeros = 1/
Dr Sajjad Zaidi - DSP

49

Good Luck

Dr Sajjad Zaidi - DSP

50

S-ar putea să vă placă și