Documente Academic
Documente Profesional
Documente Cultură
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
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
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
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
[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
350
400
450
500
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
350
400
450
500
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)
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.6
0.7
0.8
0.9
10
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)
12
'
s=
Ws (LPF to BSF); 2 s2 + 0
W = 'p1 'p2
4. Apply BZT
s=k
z 1 z +1
13
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
350
400
450
500
Fs=1000; fc=300;
[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
350
400
450
500
ylabel('Magnitude (dB)')
14
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
[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
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)
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
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
b 0 + b1z 1 + b 2 z 2 H(z) = 1 + a 1z 1 + a 2 z 2
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
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
z-1
b21 b0n
-a2n y(n)
z-1
b2n
z-1
-a11 b11 -a1n
z-1
b1n
z-1
b2n
19
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
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) =
z-1
0.0490
21
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