Upcoming SlideShare
×

# Digital fiiter

268 views
210 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
268
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
20
0
Likes
0
Embeds 0
No embeds

No notes for slide
• Block diagram Signal-flow graph
• 可参考教材 P75 ～ 76
• 直接 II 型比直接 I 型节省存储单元（软件实现），或节省寄存器（硬件实现） 但不论是直接 I 型还是直接 II 型，其共同的缺点是系数对滤波器的性能控制作用不明显，这是因为它们与系统函数的零极点关系不明确因而调整困难。 另外，这两种结构极点对系数的变化过于敏感，从而使系统频率响应对系数的变化过于灵敏，也就是对有限精度（有限字长）运算过于灵敏，容易出现不稳定或产生较大误差。
• 为了简化级联形式，特别是在时分多路复用时，采用相同形式的子网络结构就更有意义，因而将实系数的两个一阶因子组合成二阶因子 若实系数的一阶因子有奇数个，则可认为某一个二阶因子的二阶系数为 0 可以不考虑 N&lt;M 的情况，因为这种情况转换为一个横向结构（只有分子，没有分母）和一个递归结构。
• 级联型的特点： 调整系数 b1k 和 b2k 就能单独调整滤波器的第 k 对零点，而不影响其它零点和极点。 同样，调整系数 a1k 和 a2k 就能单独调整滤波器 第 k 对极点，而不影响其它零点和极点。 这种结构便于准确实现滤波器零、极点，因而便于调整滤波器频率相应特性。
• 当 M&lt;N ，但 M 不等于 N 时，见教材 P207 （式 5 － 7 ）
• 并联型可以用调整 a1k 和 a2k 的方法来单独调整一对极点的位置，但是不能单独调整零点的位置。 此外，并联型结构中，各并联基本节的误差相互没有影响，所以比级联型的误差一般来说要稍小一些，因此在要求准确的传输零点的场合下，宜采用级联型结构。
• (digital signal processing\\chap5\\linear_phase.m)
• ### Digital fiiter

1. 1. EXPERT SYSTEMS AND SOLUTIONS Email: expertsyssol@gmail.com expertsyssol@yahoo.com Cell: 9952749533 www.researchprojects.info PAIYANOOR, OMR, CHENNAI Call For Research Projects Final year students of B.E in EEE, ECE, EI, M.E (Power Systems), M.E (Applied Electronics), M.E (Power Electronics) Ph.D Electrical and Electronics.Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
2. 2. Digital Filter StructuresContentIntroductionIIR Filter StructuresFIR Filter Structures
3. 3. Introduction What is a digital filter A filter is a system that is designed to remove some component or modify some characteristic of a signal A digital filter is a discrete-time LTI system which can process the discrete-time signal. There are various structures for the implementation of digital filters The actual implementation of an LTI digital filter can be either in software or hardware form, depending on applications
4. 4. Introduction  Basic elements of digital filter structures Adder has two inputs and one output. Multiplier (gain) has single-input, single-output. Delay element delays the signal passing through it by one sample. It is implemented by using a shift register. a z-1 a z-1
5. 5. x (n) b0 y(n) 1 a2 2 z-1 z-1 a1 a1 5 3 z-1x (n) y(n) 0 b a2 z-1 4 y( n) = b0 x ( n) + a1 y( n − 1) + a 2 y( n − 2) w 2 ( n) = y( n) w 3 ( n) = w 2 ( n − 1) = y( n − 1) w 4 ( n) = w 3 ( n − 1) = y( n − 2) w 5 ( n) = a1 w 3 ( n) + a 2 w4 ( n) = a1 y( n − 1) + a 2 y( n − 2) w1 ( n) = b0 x( n) + w5 ( n) = b0 x ( n) + a1 y( n − 1) + a 2 y( n − 2)
6. 6. Introduction  The major factors that influence the choice of a specific structure Computational complexity refers to the number of arithmetic operations (multiplications, divisions, and additions) required to compute an output value y(n) for the system. Memory requirements refers to the number of memory locations required to store the system parameters, past inputs, past outputs, and any intermediate computed values. Finite-word-length effects in the computations refers to the quantization effects that are inherent in any digital implementation of the system, either in hardware or in software.
7. 7. IIR Filter Structures  The characteristics of the IIR filter IIR filters have Infinite-duration Impulse Responses The system function H(z) has poles in 0 <| z |< ∞ An IIR filter is a recursive system M Y (z) ∑ bk z − k b0 + b1 z −1 +  + bM z − M H (z) = = k =0 = X (z) N 1 − (a1 z −1 +  + a N z − N ) 1 − ∑ ak z − k k =1 N M y( n) = ∑ a k y( n − k ) + ∑ bk x( n − k ) k =1 k =0The order of such an IIR filter is called N if aN≠0
8. 8. IIR Filter Structures  Direct form In this form the difference equation is implemented directly as given. There are two parts to this filter, namely the moving average part and the recursive part (or the numerator and denominator parts). Therefore this implementation leads to two versions: direct form I and direct form II structures M M N ∑ bk z − ky( n) = ∑ bk x ( n − k ) + ∑ a k y( n − k ) H ( z ) = k =0 N k =0 k =1 1 − ∑ ak z − k k =1
9. 9. y(n) b 0 z-1 a1 x (n) y( n − 1) b1 z-1 z-1 a2 x ( n − 1) y ( n − 2) z-1 b 2 x ( n − 2) aN-1y( n − N + 1) bM-1 x ( n − M + 1) z-1 aN b z-1 y( n − N ) M y2 ( n) y1 ( n) x( n − M ) k =1 k =0 y( n) = ∑ bk x ( n − k ) + ∑ a k y( n − k ) N M Direct form I 
10. 10.  Direct form IIFor an LTI cascade system, we can change the orderof the systems without changing the overall systemresponsex (n) y(n) bM z-1 bM-1 a1 z-1 a2 z-1 b2 z -1 b1 z -1 b0 aN-1 z-1 aN
11. 11. IIR Filter Structures  Cascade form In this form the system function H(z) is written as a product of second-order sections with real coefficients M M1 M2 ∑ bk z − k ∏ (1 − pk z −1 )∏ (1 − qk z −1 )(1 − qk z −1 ) ∗H (z) = k =0 N =A k =1 N1 k =1 N2 1 − ∑ ak z −k ∏ (1 − c k z −1 )∏ (1 − d k z −1 )(1 − d k z −1 ) ∗ k =1 k =1 k =1 M1 M2 M = M1 + 2M 2 ∏ (1 − p z )∏ (1 + b k −1 1k −1 z + b2 k z ) −2 N = N1 + 2N 2H (z) = A k =1 N1 k =1 N2 ∏ (1 − c k z −1 )∏ (1 − a1k z −1 − a 2 k z − 2 ) k =1 k =1
12. 12. IIR Filter Structures 1 + b1k z −1 + b2 k z −2 H ( z ) = A∏ −1 −2 = A∏ H k ( z ) k 1 − a1 k z − a2k z kEach second-order section (called biquads) is implemented ina direct form ,and the entire system function is implementedas a cascade of biquads. If N=M, there are totally  N + 1  biquads.  2    If N>M, some of the biquads have numerator coefficientsthat are zero, that is, either b2k = 0 or b1k = 0 or both b2k= b1k = 0 for some k. if N>M and N is odd, one of the biquads must have ak2 = 0,so that this biquad become a first-order section.
13. 13. biquad −1 −2 1 + b1k z + b2 k z a1k z-1 b1k H k (z) = 1 − a1k z −1 − a 2 k z − 2 a2k z-1 b2k First-order section a1k z-1 b1k a1k z-1 b1k a2k z-1 a1k z-1 a1k z-1 a2k z-1
14. 14. 8 − 4 z −1 + 11z −2 − 2 z −3 Example H (z) = 5 3 1 1 − z −1 + z − 2 − z − 3 4 4 8 ( 2 − 0.3799 z −1 )(4 − 1.2402 z −1 + 5.2644 z −2 ) H ( z )= (1 − 0.25 z −1 )(1 − z −1 + 0.5 z − 2 )x (n) 4 2 y(n) z-1 -1.2402 0.25 z-1 -0.3799 -0.5 z-1 5.2644
15. 15. IIR Filter Structures  Parallel form In this form the system function H(z) is written as a sum of sections using partial fraction expansion. Each section is implemented in a direct form. The entire system function is implemented as a parallel of every section. Suppose M=N M ∑ bk z − k N1 Ak N2 b0 k + b1k z −1H (z) = k =0 = G0 + ∑ −1 +∑ −1 N k =1 1 − c k z k =1 1 − a1 k z − a2k z −2 1 − ∑ ak z −k k =1N = N 1 + 2N 2
16. 16. IIR Filter Structures  N +1   2    b0 k + b1k z −1 H ( z ) = G0 + ∑ k =1 1 − a1k z −1 − a 2 k z −1 if N is odd, the system has one first-order N −1 section and 2 second-order sections. N if N is even, the system has 2 second-order sections.
17. 17. Example 1 −1 2 10(1 − z )(1 − z −1 )(1 + 2 z −1 ) H (z) = 2 3 (1 − z −1 )(1 − z −1 )1 − ( + j ) z −1  1 − ( − j ) z −1  3 1 1 1 1 1 4 8   2 2   2 2   A1 A2 A3 A4H (z) = + + + 3 −1 1 −1 1 1 −1 1 1 −1 (1 − z ) (1 − z ) 1 − ( + j ) z 1 − ( − j )z 4 8 2 2 2 2A1 = 2.93, A2 = −17.68, A3 = 12.25 − j14.57, A4 = 12.25 + j14.57 − 14.75 − 12.90 z −1 24.50 + 26.82 z −1 H (z) = + 7 −1 3 − 2 −1 1 −2 1− z + z 1− z + z 8 32 2
18. 18. − 14.75 − 12.90 z −1 24.50 + 26.82 z −1 H (z) = + 7 −1 3 − 2 −1 1 −2 1− z + z 1− z + z 8 32 2 -14.75 7/8 z-1 -12.9x (n) y(n) -3/32 z-1 24. 5 1 z-1 26.82 -1/2 z-1
19. 19. IIR Filter Structures Transposition theoremIf we reverse the directions of all branch transmittancesand interchange the input and output in the flow graph,the system function remains unchanged.The resulting structure is called a transposed structureor a transposed form.
20. 20. FIR Filter Structures  The characteristics of the FIR filter FIR filters have Finite-duration Impulse Responses, thus they can be realized by means of DFT The system function H(z) has the ROC of | z |> 0 , thus it is a causal system An FIR filter is a nonrecursive system FIR filters can be designed to have a linear-phase response N −1 It has N-1 order poles at z = 0 H ( z ) = ∑ h( n) z −n and N-1 zeros in | z |> 0 n=0 The order of such an FIR filter is N-1
21. 21. FIR Filter Structures  Direct form In this form the difference equation is implemented directly as given. N −1 y( n) = ∑ h( m ) x( n − m ) m =0 z-1 z-1 z-1x (n) h(0) h(1) h(2) h(N-2) h(N-1) y(n) It requires N multiplications
22. 22. FIR Filter Structures  Cascade form In this form the system function H(z) is converted into products of second-order sections with real coefficients N It requires (3N/2) multiplications N −1 2  H ( z ) = ∑ h( n) z −n = ∏ (b0 k + b1k z + b2 k z ) −1 −2 n=0 k =1x (n) b01 b02 b0x y(n) z-1 b11 z-1 b12 z-1 b1x z-1 b21 z-1 b22 z-1 b2x
23. 23. FIR Filter Structures Linear-phase form Linear phase:The phase response is a linear function of frequency Linear-phase conditionh( n) = h( N − 1 − n) Symmetric impulse responseh( n) = − h( N − 1 − n) Antisymmetric impulse response When an FIR filter has a linear phase response, itsimpulse response exhibits the above symmetryconditions. In this form we exploit these symmetryrelations to reduce multiplications by about half.
24. 24. If N is odd N −1H ( z ) = ∑ h( n) z −n n=0 N −1 −1 N −1 N −1 2 N −1 −= ∑ h(n)z n=0 −n + h( 2 )z 2 + ∑ h(n)z N −1 −n n= +1 2 N −1 −1 N −1 −1 let n = N − 1 − m N −1 2 N −1 − 2= ∑ h( n) z − n + h( n=0 2 )z 2 + ∑ h( N − 1 − m ) z −( N −1− m ) m =0 N −1 −1 let n ← m 2 N − 1 − N2−1= ∑ h( n)[ z − n ± z −( N −1− n ) ] + h( )z n=0 2 h( n) = ± h( N − 1 − n)
25. 25. If N is odd N −1 −1 N −1 2 N −1 − H (z) = ∑ h(n)[ z n=0 −n ±z − ( N −1− n ) ] + h( 2 )z 2x (n) z-1 z-1 z-1 ±1 ±1 ±1 ±1 z-1 z-1 z-1h(0) h(1) h( 2) N −1 N −1 h( − 1) h( ) 2 2 y(n) 1 for symmetric -1 for antisymmetric
26. 26. If N is even N −1 N −1 2 N −1 H ( z ) = ∑ h( n) z − n = ∑ h( n) z − n + ∑ h( n) z − n n=0 n=0 N n= 2 N 2 −1 N 2 −1 let n = N − 1 − m = ∑ h( n) z − n + ∑ h( N − 1 − m ) z −( N −1− m ) n=0 m =0 N −1 let n ← m 2 = ∑ h( n)[ z − n ± z −( N −1− n ) ] n=0 h( n) = ± h( N − 1 − n)
27. 27. NIf N is even 2 −1 H (z) = ∑ h( n)[ z − n ± z −( N −1− n ) ] n=0 x (n) z-1 z-1 z-1 ±1 ±1 ±1 ±1 ±1 z-1 z-1 z-1 z-1 h(0) h(1) h( 2) N N h( − 2) h( − 1) 2 2 y(n) 1 for symmetric -1 for antisymmetric The linear-phase filter structure requires 50% fewer multiplications than the direct form.
28. 28. FIR Filter Structures  Frequency sampling form This structure is based on the DFT of the impulse response h(n) and leads to a parallel structure. It is also suitable for a design technique based on the sampling of frequency response H(z) N −1 N −1 1 H (k ) 1H ( z ) = (1 − z − N ) ∑ − k −1 = H c ( z )∑ H k ( z ) ′ N k =0 1 − W N z N k =0
29. 29. Hc (z) = 1 − z − N − z−NIt has N equally spaced j 2π kzeros on the unit circle zk = e N , k = 0,1,  , N − 1 ωN jω − jω N −j ωNH c (e ) = 1 − e = 2 je 2 sin( ) 2 ωNH c (e jω ) = 2 sin( ) All-zero filter 2 H c ( e jω ) or comb filter 2   2π 4π ω 0 N N
30. 30. N −1 N −1 H (k ) ∑ H k′ ( z ) = ∑ 1 − W −k z −1 k =0 k =0 resonant filter N It has N equally spaced poles on the unit circle 2π j k zk = e N , k = 0,1,  , N − 1The pole locations are identical to the zero locations and that 2πboth occur at ω= k , which are the frequencies at which Nthe designed frequency response is specified. The gains ofthe filter at these frequencies are simply the complex-valuedparameters H (k )
31. 31. N −1 N −1 1 H (k ) 1H ( z ) = (1 − z −N ) N ∑ 1 − W −k z −1 = N H c ( z ) ∑ H k′ ( z ) k =0 k =0 N H ( 0) 0 WN z-1 H (1) x (n) y(n) − WN1 z-1 − z−N H ( N − 1) W N ( N −1) z-1 −
32. 32. FIR Filter Structures Problems It requires a complex arithmetic implementationIt is possible to obtain an alternate realization in which onlyreal arithmetic is used. This realization is derived using the −symmetric properties of the DFT and the W N k factor. It has poles on the unit circle, which makes this filtercritically unstableWe can avoid this problem by sampling H(z) on a circle |z|=r where the radius r is very close to one but is less thanone.
33. 33. jIm[z] − N N −1 1− z H (k ) ∑ 1 − W − k z −1 H (k )H (z) = unit circle N k =0 N r Re[z] N −1 1 − r N z−N H r (k )H (z) = N ∑ 1 − rW − k z −1 k =0 H r (k ) N H r (k ) ≈ H (k ) − N N −1 1− r z N H (k ) H (z) ≈ N ∑ 1 − rW − k z −1 k =0 N
34. 34. N −1 1 − r N z−N H (k ) H (z) ≈ N ∑ 1 − rW − k z −1 k =0 N −By using the symmetric properties of the DFT and the W N kfactor, a pair of single-pole filters can be combined to forma single two-pole filter with real-valued parameters. 2π j kFor poles zk = e N , k = 0,1,  , N − 1 ∗ z N −k = zk 2π 2π −( N − k ) j ( N −k ) j k ∗ −k ∗rW N = re N = r (e N ) = r (W N ) = rW k Nh(n) is a real-valued sequence, so ∗ H ( k ) = H (( N − k )) N RN ( k )
35. 35. So the kth and (N-k)th resonant filters can be combined to forma second-order section H k (z ) with real-valued coefficients H (k ) H(N − k)H k (z) = − k −1 + 1 − rW N z 1 − rW N ( N − k ) z −1 − H (k ) ∗ H (k ) b0 k + b1k z −1= + = − k −1 1 − rW N z k −1 1 − rW N z −1 2π 2 −2 1 − z 2r cos( k ) + r z Nk = 1,2,  , N − 1 , N is odd 2 b0 k = 2 Re[ H ( k )] N k = 1,2, , − 1, N is even b1k = −2r Re[ H ( k )W N ] k 2
36. 36. N is even jIm[z] N is odd jIm[z] |z|=r |z|=rk=N k=0 k=N k=0 2 2 Re[z] Re[z] If N is even, the filter has a pair of real-valued poles z = ±r H ( 0) H(N ) H 0 (z) = H N (z) = 2 1 − rz −1 2 1 + rz −1 If N is odd, the filter has a single real-valued pole z=r H ( 0) H 0 (z) = −1 1 − rz
37. 37. second-order section b0k 2π z-1 b1k 2r cos( k) N − r2 z-1first-order sectionsH0 (z) H N (z) 2 H ( 0) H(N ) 2 r z-1 r z-1
38. 38. 1 −r z N −N  N −1 2 N is even H (z) =  H 0 ( z ) + H N ( z ) + ∑ H k ( z ) N  2 k =1    −N  ( N −1 ) N is odd 1 −r z N 2 H 0 ( z ) + ∑H k ( z ) H (z) = N  k =1    H0 (z) 1 H1 ( z) Nx (n) y(n)  H k (z ) − r N z−N  H N (z) 2
39. 39. FIR Filter Structures  Fast convolution form x(n): N1-point sequence h(n): N2-point sequence L ≥ N1 + N2 - 1x (n) X (k ) L-point DFT Y (k ) y(n) L-point IDFTh(n) L-point DFT H (k )
40. 40. h(n)=h(N-1-n) h(n)=-h(N-1-n) 46 N = 11 N = 11 24 02 -20 -4 0 1 2 3 4 5 6 7 8 9 10 n 0 1 2 3 4 5 6 7 8 9 10 n h(n)=h(N-1-n) h(n)=-h(N-1-n) 46 N = 10 N = 10 24 return 02 -20 -4 0 1 2 3 4 5 6 7 8 9 n 0 1 2 3 4 5 6 7 8 9 n Copyright © 2005. Shi Ping CUC