Sunteți pe pagina 1din 28

Infinite Impulse Response (IIR) Filters

Recursive Filters:

y (n) a1 y (n 1) ... a N y (n N ) b0 x (n) ...bN x (n N )


with ai , ... , b j
Advantages:
Disadvantages:

constant coefficients.
very selective filters with a few parameters;
a) in general nonlinear phase,
b) can be unstable.

Design Techniques: discretization of analog filters


analog

digital

s-plane

z-plane

H a ( s)

( z)

Problem: we need to map


the derivative operator s into the time shift operator z,
and make sure that the resulting system is still stable.

Two major techniques


Euler Approximation (easiest),
Bilinear Transformation (best).
Euler Approximation of the differential operator:

y (nT ) y (nT T )
y (nT )
T
take the z-Transform of both sides:

approximation of s

Y ( z ) z 1Y ( z ) 1 z 1
Z y (nT )

Y ( z)
T
T

1 z 1
s
T

Example:
take the analog filter with transfer function
with a sampling frequency Fs 5Hz

H a ( s)

2
s 1

and discretize it

By Eulers approximation

Hd ( z )

2
0.333 z

z 0.833
1 z 1

0.2

The filter is implemented by the difference equation

y (n) 0.833 y (n 1) 0.333x ( n)


analog

digital

s-plane

z-plane

Problem with Euler Approximation:


it maps the whole stable region of the s-plane into a subset of the stable region in the z-plane

s-plane

z-plane

since

1
1
1 1
z

2 1 sT 2 2

1
s
T
1
s
T

1
1
z

2
2

if Re[s]<0.

1
T

1
T

Bilinear Transformation. It is based on the relationship

T
y (nT ) y (nT T )
y (t ) dt y (nT ) y (nT T )
nT T
2
nT

area ABCD

C
Take the z-Transform of both sides:

T
Y ( z ) z Y ( z ) Y1 ( z ) z 1Y1 ( z )
2
1

which yields the bilinear transformation:

2 1 z 1
s
T 1 z 1

2
s
T
z
2
s
T

nT-T

D
nT

Main Property of the Bilinear Transformation: it preserves the stability regions.

s-plane

z-plane

since:

2
T
2
s
T
s

| z|

2
T

2
T

Mapping of Frequency with the Bilinear Transformation.


Magnitude:

2
T
2
j
T

| e j |

Phase:

T
phase
( ) 2

2
j

T
1 T
where
tg

2
j

T
2tg

2
1

2
T

2
T

2
T

2
tg

T 2

See the meaning of this:

T
2tg

2
1

2
tg

T
2

it is a frequency mapping between analog frequency and digital freqiency.

Example: we want to design a digital low pass filter with a bandwith Fo 8kHz
and a sampling frequency

Fs 24 kHz . Use the Bilinear Transformation.

Solution:
Step 1: specs in the digital freq. domain

c (2 )(8 / 24) 2 / 3 rad

Step 2: specs of the analog filter to be digitized:

c
c 2 Fs tg

or equivalently

(2)(24 103 ) tg ( / 3) 8313


. 103 rad / sec

Fc 13.23kHz

Step 3: design an analog low pass filter (more later) with a bandwith Fc 13.23kHz ;
Step 4: apply Bilinear Transformation to obtain desired digital filter.

Design of Analog Filters


| H ()|2

Specifications:

1
1

1
2

2 2
p

pass
band

transition

stop
band

Two Major Techniques: Butterworth, Chebychev


Butterworth:

| H ()|
2

1

1

2N

Specify , p from passband, determine

| H ( s )|
2

2 s

1
p

2N

2 2

1

2

1
p

2N

from stopband:

1 2 2
log 2 2
2
s

2 log
p

Poles of Butterworth Filter:

| H ()| H ( s) H ( s) s j
2

H ( s) H ( s)

1

1

2N

which yields the poles as solutions


1
s2
N
2 1
c

s j c e

k 2
2N

and choose the N poles in the stable region.

ce e

j ( 2 k 1)

2N

s
j

1
s
1
2
c
2

, k 0,...,2 N 1
N=2

poles

s-plane

Example: design a low pass filter, Butterworth, with 3dB bandwith of 500Hz and 40dB
attenuation at 1000Hz.

c 1000 ; s 2000 ,

Solution:

solve for N from the expression

1
s
1

2N

1
2

2 N 0.01
1 2
| H ()|dB

log(104 1)
N
6.64 N 7
2 log(2)
poles at

sk 1000 e j ( / 2 ( 2 k 1) /14 ) , k 0,...,6

Chebychev Filters.
Based on Chebychev Polynomials:

TN ( x ) cos( Nt ) x cos( t )

T0 ( x ) cos(0) 1,

T3 ( x )

T1 ( x ) cos(t ) x cos( t ) x ,
T2 ( x ) cos(2t ) 2 cos2 (t ) 1 x cos( t ) 2 x 2 1,

TN 1 ( x ) 2 xTN ( x ) TN 1 ( x )

Property of Chenychev Polynomials:


within the interval 1 x 1 Chebychev polynomials have least maximum deviation
from 0 compared to polynomials of the same degree and same highest order coefficient

P ( x ) 4 x 3 ax 2 bx c
T3 ( x ) 4 x 3 3x

Why? Suppose there exists

P( x ) 4 x 3 ax 2 bx c

P T3 1

T3 ( x )

with smaller deviation then

P T3 1

P ( x ) T3 ( x )

P( x )

T3 ( x )

P T3 1

P T3 1

root

But: P ( x ) T3 ( x ) 4 x ax bx c 4 x 3x
3

root

root

has degree 2

and it cannot have three roots!!!

So: you cannot find a P(x) which does better (in terms of deviation from 0) then the
Chebychev polynomial.

Chebychev Filter:

| H ()|

1 TN
p
2

Since TN (1) 1 (easy to show from the definition), then | H ( p )|2


| H ()|2

1
1

1
1

Design of Chebychev Filters:


Formulas are tedious to derive. Just give the results:
Given: p

the passband, and


which determines the ripple in the passband,

compute the poles from the formulae

1 1

1
N

2 1
r1,2
2

k (2 k 1)
, k 0,..., N 1
2
2N

s-plane

Example: design a Chebychev low pass filter with the following specs:
passband Fp 500 Hz ,
Fs 1000 Hz ,

stopband

Step 1: determine
For 1dB ripple,

1
20 log
2
1

1
2

, p

with a 1dB ripple,


with attenuation of at least 40dB.
. The passband frequency p 1000

10 log(1 2 ) 1dB

| H ()|

Step 2: determine the order N. Use the formula

log

1 2 2 1 2 2 (1

log ( s / p ) ( s / p ) 2 1

with 2 0.01, to obtain N 4

0.5088

Frequency Transformations
We can design high pass, bandpass, bandstop filters from transformations of low pass filters.
Low Pass to High Pass:

| H ()|

c2
s

c2
H

same value at

c 2
c
H
H
H ( j c )
j
j c

Low Pass to Band Pass:

The tranformation
maps

s2 l u
s c
s( u l )

s j l

l 2 l u
c
j c
j l ( u l )

s j u

u 2 l u
c
j c
j u ( u l )

Low Pass to Band Stop

s( u l )
s c 2
s cl

How to make the transformation:


Consider the transfer function

K ( s z1 )( s z2 )...( s zm )
H ( s)
, mn
( s p1 )( s p2 )...( s pn )
then with s F ( s)

we obtain

H T ( s) H F ( s)

K F ( s) z1 ... F ( s) zm

F ( s) p ... F ( s) p
1

with zeros and poles solutions of

F ( s) zk , k 1,..., m
F ( s) p j , j 1,..., n

also n-m extra zeros at s where F ( s)

IIR filter design using Matlab


In Matlab there are three functions for each class of filters (Butterworth, Chebytchev1, Chebytchev2):
BUTTAP

CHEB1AP

CHEB2AP

Poles and Zeros of Analog Prototype Filter

BUTTER

CHEBY1

CHEBY2

Numerator and Denominator from N and c

BUTTORD

CHEBY1ORD

CHEBY2ORD

N and c from specifications

Example. We want to design an IIR Digital Filter with the following specifications:
Pass Band

0 to 4kHz, with 1dB ripple;

Stop Band

> 8kHz with at least 40 dB attenuation

Sampling frequency 40kHz


Type of Filter: Butterworth.
Using Matlab:
>> [N, fc]=butterord(fp, fs, Rp, Rs);
>> [B, A]=butter(N, fc);

% fp, fs=passband and stopband freq relative to Fs/2

% B, A vectors of numerator and denominator coefficients.

In our case:
[N, fc]=butterord(4/20, 8/20, 1, 40),

would yield N=7, fc=0.2291;

[B, A]=butter(7, 0.2291), would yield the transfer function B(z)/A(z).

Lets verify these numbers:


Step 1: specifications in the digital frequency domain:

4
p 2
rad
40 5
8 2
s 2

rad
40 5

band pass freq


stop band freq

Step 2: specifications for analog filter from the transformation 2 Fs tan


p 2(40 10 ) tan
26 103 rad / sec
10
3


58 103 rad / sec
5

s 2(40 103 ) tan

H ( )

Step 3: choose (say) Butterworh Filter

1
p

2N

with

p 26 103 rad / sec

and

1
20 log10
2
1

1
2

from the ripple specification

1 0.5

Step 4: determine order N from attenuation of 40dB

10 log10

1
s

1 0.5

p
2

with

s 58

p 26

yields

N=7

2N

40

Step 5: finally the cutoff frequency, from the equation

H ( c )

Which yields

26 103

2
1 0.5

c 28.7 103 rad / sec

14

, corresponding to a digital frequency

28.7
c 2atan
0.6889 radians
2 40
Step 6: the desired Filter is obtained by the function
[num, den] = butter( 7 , 0.6889/)

Magnitude and Phase Plots:

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