Sunteți pe pagina 1din 22

Infinite Impulse Response Filter (IIF)

Realizable IIR is characterized by the following recursive equqtion:

y( n ) = h ( k ) x ( n k ) = b k x ( n k ) a k y( n k )
k =0 k =0 k =0

H (z) =

Y (z) = X (z)

b
k =0 M k =0

z k

1 + a k z k
y(n)

X(n)

b0

Direct 1 form

Direct 2 form
X(n)

b0

y(n)

z-1
b1 -a1

z-1
-a1

z-1
b1

z-1 z-1

b2 . . . bN . . .

-a2

z-1 z-1

-a2 . . . -aM

z-1 z-1

b2 . . . bN

-aM

Design Steps
1. Filter Specification 2. Coefficient Calculations 3. Realisation 4. Implementation

Coefficient Calculations Methods


Pole-Zero Placement Impulse Invariant Bilinear Z-Transform (BZT)
2

Pole-Zero Placement
Basic Concept:
Zero in the z- plane Pole in the z- plane Fs/4 x Fs/4 0 0 x 3Fs/4 Fs/4 Fs/2 3Fs/4
3

H(f)=0 H(f)=max H(f)

Fs/2

Pole-Zero Placement
Example: Design Bandpass Digital Filter to meet the following Specifications: 1. Comlete signal rejection: f=0 (dc) and f=250 Hz; Fs=0; 3Fs/4=250 Hz; 2. Narrow passband centred: 125 Hz; 3. At 3 dB bandwidth: Bw=10 Hz; 4. Sampling frequency: Ft=500 Hz.
125Hz

Solution:
250Hz

x r 0

H(f)

r=1-(Bw/Ft)*=0.937

f 0 125Hz 250Hz

x
125Hz

Pole-Zero Placement
H(z) = (z 1)(z + 1) = (z re j / 2 )(z re j / 2 ) 1 z 2 = 1 + 0.877969 z 2
The difference equation: y(n) = - 0.877969 y(n-2)+x(n)- x(n-2)
1 x(n) y(n)

z-1

z-1

-1

z-1 z-1
- 0.877969 5

Impulse invariant Method


Basic Concept:
LT H(s) h(t) Sampling h(nt) ZT H(z)

Ilustration:

H(s) =

C ; h ( t ) = L1 [H(s)] = Ce pt sp
n

H(z) = h (nT)z
n =0

= Ce pnT z n
n =0

H(z) =

C 1 e pT z 1
6

Impulse invariant Method


Example:Design a IIF filter with Butterworth characteristic to meet the followingSpecifications: Matlab-files for design analog filter
FN=1000/2; % Nyquist frequency fc=300; N=5; % cut offf frequency % filter order
Magnitude (dB) -5 0

[z, p, k]=buttap(N);% create an analog filter w=linspace(0, FN/fc, 1000); % plot the response of filter h=freqs(k*poly(z), poly(p), w); f=fc*w; plot(f, 20*log10(abs(h))), grid; ylabel('Magnitude (dB)') xlabel('Frequency (Hz)')

-10

-15

-20

-25

50

100

150

200 250 300 Frequency (Hz)

350

400

450

500

Impulse invariant Method


Matlab-files for design digital Impulse invariant filter
Fs=1000; fc=300; % sampling frequency % cutoff frequency
2 0 -2 -4 Magnitude (dB) -6 -8 -10 -12 -14 -16 -18

WC=2*pi*fc; % cutoff frequency in radian N=5; % filter order [b,a]=butter(N,WC,'s'); % create an analog filter [z, p, k]=butter(N, WC, 's'); [bz, az]=impinvar(b,a,Fs);% determine coeff. of filter [h, f]=freqz(bz, az, 512,Fs); plot(f, 20*log10(abs(h))), grid xlabel('Frequency (Hz)') ylabel('Magnitude (dB)')

50

100

150

200 250 300 Frequency (Hz)

350

400

450

500

IIF design using Impulse invariant Method


Design IIF with following specifications: Passband edge frequency: wp=0.25*pi; Stopband edge frequency: ws=0.55*pi; Sampling frequency: T=1 Passband ripple: Rp=-0.5; Stopband ripple: Rs=-15;

10 Rs /10 1) log( Rp /10 10 1 N= 2 log(ws / wp)

Matlab Program:
wp=0.25*pi; ws=0.55*piRp=0.5; Rs=15; s=0.1*Rs; e2=(10^s)-1; v=0.1*Rp; e3=10^v-1; k=ws/wp; N=log10(e2/e3)/(2*log10(k)); N=ceil(N) [z p k]=buttap(N) % Buttap - Butterworth analog lowpass filter [num,den]=zp2tf(z,p,k); %[num,den]- numerator and denominator coefficients of analog filter [bz,az]=impinvar(num,den) % [bz,az] numerator BZ and AZ denominator coefficients of digital filter [h omega]=freqz(bz,az,512);%[h omega]-frequency response of digital filter g=20*log10(abs(h)); plot(omega/pi,g);'grid' xlabel('Normalized frequeny') ylabel('Gain,dB') [bz,az]=impinvar(num,den)

bz = -0.0000 0.0828 az = 1.0000 -1.5587 Transfer function:

0.1657

0.0226

0 0.0733

1.2283 -0.4722

0 . 08 z 1 + 0 . 16 z 2 + 0 . 02 z 3 H (z) = 1 1 . 5 z 1 + 1 . 2 z 2 0 .4 z 3 + 0 . 07 z 4
5 0 -5 -10 Gain,dB -15 -20 -25 -30 -35 -40

0.1

0.2

0.3

0.4 0.5 Normalized frequeny

0.6

0.7

0.8

0.9

10

Bilinear Z-Transform (BZT)


Basic Concept:
H(s)
Im x x x x Re x x x x x x Im x

s=k

z 1 ; z +1

k = 1 or

2 T

H(z)

x x x x Re

S-plane

z-plane

11

Warping Effect
s=k
'

z 1 ; z +1

k = 1 or

2 T

z = e j T ;
T 2

s = j'
- analog frequency - digital frequency T-sampling period

e j T 1 j = k j T ; e +1

' = k tan

Relationship between and is nonlinear (tangensoidal) leading to a distortyion or warping of digital frequency.Passband for the analog filter are with regular intervals, whereas the passband for the digital filterare somewhat squashed up. This effect is Compensated for by prewarping the analog filter before applying the BZT.

(analog)

' = k tan

T 2

p = k tan

'

p T 2

(digital)

p- specified cutoff frequency p- prewarped frequency

12

Summary of the BZT


1. Use the DF specifications to find a suitable analog LPF, H(s) 2. Determine and prewrap bandedge frequencies pT For LPF and HPF 'P = ktan 2 p1 T p2 T 'P1 = ktan ; 'P2 = ktan ; For Band pass and stopband filters 2 2
p- desired cutoff frequency ; p- prewarped critical frequency

3. Denormalized analog filter or H(s) by replac s one of the following transformations

p s (LPF to HPF); s = ' (LPF to LPF); s = p s


2 s2 + 0 (LPF to BPF); s= Ws 2 0 = 'p1 'p2 ;

'

s=

Ws (LPF to BSF); 2 s2 + 0

W = 'p1 'p2

4. Apply BZT

s=k

z 1 z +1
13

Matlab-files using BZT


50

Fs=1000; % Sampling frequency FN=Fs/2; % Nyquist frequency fc=300; N=5; % cut offf frequency % filter order
Magnitude (dB) 0

-50

[z, p, k]=butter(N, fc/FN); [h, f]=freqz(k*poly(z), poly(p), 512, Fs); plot(f, 20*log10(abs(h))), grid ylabel('Magnitude (dB)') xlabel('Frequency (Hz)')
2 0 -2 -4 Magnitude (dB) -6 -8 -10 -12 -14 -16 -18

-100

BZT

-150

-200

-250 0

50

100

150

200 250 300 Frequency (Hz)

350

400

450

500

Fs=1000; fc=300;

% sampling frequency % cutoff frequency

WC=2*pi*fc; % cutoff frequency in radian N=5; % filter order

Impulse invariant Method

[b,a]=butter(N,WC,'s'); % create an analog filter [z, p, k]=butter(N, WC, 's'); [bz, az]=impinvar(b,a,Fs);% determine coeffs of IIR filter [h, f]=freqz(bz, az, 512,Fs); plot(f, 20*log10(abs(h))), grid xlabel('Frequency (Hz)')

50

100

150

200 250 300 Frequency (Hz)

350

400

450

500

ylabel('Magnitude (dB)')

14

Matlab-files using BZT


Problem: Design Bandpass filter with Butterworth characteristics rhat meets the following specifications: Passband 200-300 Hz Sampling frequency 2000 Hz Filter order 8 Fs=2000; % Sampling frequency
1 Magnitude Response 0.8 0.6 0.4 0.2 0 0 100 200 300 400 500 600 Frequency (Hz) 700 800 900 1000

FN=Fs/2; fc1=200/FN; fc2=300/FN; [b,a]=butter(4,[fc1, fc2]); % Create and digit. analogue filter. [z,p,k]=butter(4, [fc1, fc2]); subplot(2,1,1) % Plot magnitude freq. response

1 Imaginary Part 0.5 0 -0.5 -1 -3 -2 -1 0 Real Part 1 2 3 4 4

[H, f]=freqz(b, a, 512, Fs); plot(f, abs(H)) xlabel('Frequency (Hz)') ylabel('Magnitude Response ') subplot(2,1,2) % Plot pole-zero diagram zplane(b, a)

15

Matlab-files using BZT


Problem: Design Bandpass filter with Butterworth characteristics rhat meets the following specifications: Lower passband edge frequency Uppere passband edge frequency Lower stopband edge frequency Uppere stopband edge frequency Passband ripple Stopband attenuation Sampling frequency 200 Hz 300 Hz 50 Hz 450 Hz 3 dB 20 dB 1 kHz

Magnitude Response

1 0.8 0.6 0.4 0.2 0 0 50 100 150 200 250 300 Frequency (Hz) 350 400 450 500

Determine the order N of filter; b) poles, zeros, gain, coefficients and transfer functon of DF Fs=1000; % Sampling frequency Ap=3; As=20; Wp=[200/500, 300/500]; % Band edge frequencies Ws=[50/500, 450/500]; [N, Wc]=buttord(Wp, Ws, Ap, As); % Determine filter order [zz, pz, kz]=butter(N,Wp); % Digitise filter [b, a]=butter(N, Wp); subplot(2,1,1) % Plot magnitude freq. response [H, f]=freqz(b, a, 512, Fs); plot(f, abs(H)) xlabel('Frequency (Hz)') ylabel('Magnitude Response ') subplot(2,1,2) % Plot pole-zero diagram zplane(b, a)

1 Imaginary Part 0.5 0 -0.5 -1 -3 -2 -1 0 Real Part 1 2 3 2 2

16

N=2 pz= [-0.1884 0.7791j ; 0.1884 0.7791j] zz= [1 1 -1 -1] 0 -0.1349 0 0.0675] 0.4128] kz=0.0675 b= [0.0675 a= [1.0000 -0.0000 1.1430 -0.0000

0.0675 0.1349z 2 + 0.0675z 4 H(z) = 1 + 1.1430z 2 + 0.4128z 4

y(n)= 0.0675x(n)- 0.1349x(n-2) +0.0675x(n-4) -1.1430y(n-2)- 0.4128y(n-4)


0.0675 0.0675

x(n)

y(n)

z-1

z-1

z-1

z-1
-0.1349

z-1
- 1.1430

z-1 z-1

- 0.4128

z-1
17

Realization of IIR
y( n ) = b k x ( n k ) a k y( n k ) M N
k =0 k =1 N M

Direct 1 2nd order


2 2

b 0 + b1z 1 + b 2 z 2 H(z) = 1 + a 1z 1 + a 2 z 2

Direct 2 2nd order

y( n ) = b k x ( n k ) a k y( n k )
k =0 k =1

w (n ) = x (n ) a k w (n k )
k =1

X(n)

b0

y(n) X(n)

y( n ) = b k w ( n k )
k =0

z-1
b1 -a1

z-1

w(n)

b0

y(n)

z-1

b2

-a2

z-1

z-1
-a1 b1

-a2

z-1

b2

18

Cascade Realization of IIR


b + b z + b2z N (z) = k H (z) = 0 1 1 2 k =1 1 + a 1z + a 2 z k =1 D k (z)
N/2 1 2 N/2

N k (z) = b 0 + b1z 1 + b 2 z 2 D k (z) = 1 + a1z 1 + a 2 z 2


b01 b0n y(n)

X(n)

H(z) = H(z) =

N (z) N 2 (z) N1 ( z ) N 2 ( z ) ; H(z) = 1 D 2 (z) D1 (z) D1 (z) D 2 (z) N (z) N1 (z) N 2 ( z ) N1 ( z ) ; H(z) = 2 D 2 (z) D1 (z) D1 (z) D 2 (z)

z-1
-a11 b11 -a1n

z-1
b1n

-a21 X(n) b01

z-1

b21 b0n

-a2n y(n)

z-1

b2n

z-1
-a11 b11 -a1n

z-1
b1n

Cascade realization of a 3rd order IIR -a2n

z-1

b2n

19

Parallel Realization of IIR


H(z) = C + H k (z)
k =1 N/2

C b01

z-1
b C= N , aN b 0 k + b1k z 1 H(z) = 1 + a 1k z 1 + a 1k z 1
X(n) -a11 b11

-a21

z-1
. . . b0n

y(n)

b 0 k + b1k z 1 H(z) = C + 1 1 k =1 1 + a 1k z + a 1k z
n

z-1
-a1n b1n

-a2n

z-1
20

Develop Cascade and Parallel Realization


0.1432(1 + 3z 1 + 3z 2 + z 3 ) H(z) = 1 0.1801z 1 + 0.3419z 2 0.0165z 3 )
1. For casacade realization H(z) is expressed in factored form:

1 + 2z 1 + z 2 1 + z 1 H(z) = 0.1432 1 0.1307 z 1 + 0.3355z 2 1 0.0490z 1


x(n) 0.1432 1 1 y(n)

z-1
0.1307 2

z-1
0.0490 1

-8.7107 1.2916

-0.33557

z-1

z-1
0.1310 -0.0841 X(n) -0.3355 y(n)

1. For parallel realization H(z) is expressed using partial fraction expansion as the sum second- and first order sections:

z-1
10.1764

H(z) =

1.2916 0.08407z 10.1764 + 8.7107 1 0.131z 1 + 0.3355z 2 1 0.049z 1

z-1
0.0490

21

Finite Wordlength Effects


The main errors in IIR: 1. ADC quantizing noise, with resulths from representing the samplesof x(n) by small number of bits 2. Coefficients ak and bk quantizing errors, caused by representing ak and bk by a finite number of bits 3. Overflow errors, which result from arithmetic operations and storage the results in a limited register length One of reserves to reduce errors in IIF is broken H(z) into smaller first and second order bloks which are then cconnected up in cascade or in parallel

Application of IIR
1. Telecommunication- in Transmitter as antialiasing filter and in Receiver anti imaging filter 2. Digital Telephony-digital dual tone multifrequency touch-tone receiver 3. Clock recover in Data communications etc

22

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