Equiripple Filters A filter which has the Smallest Maximum Approximation Error among all filters over the frequencies of interest: Define: e ( h ) max S | E ( ) | H ( ) 0 where p s E ( ) H d ( ) H ( ) Fact: filters with the smallest maximum deviation from ideal characteristic are equiripple.. | H ( )| same ripple They are computed as follows: B=firpm(N,F,M) F=[F(1),F(2),…], 0 F (k ) 1 M=[M(1), M(2), …]; F=1 corresponding to N = filter order. M F (1) F (2) F ( 3) F (4) F Fs / 2 Fact: the error frequencies such that E ( ) H ( ) H d ( ) is miminal in minmax sense, provided there exist L+2 1 E ( i 1 2 ... L2 , i S ) E ( i ) | E ( i )| m ax S | E ( )| E ( ) S H ( ) H d ( ) E ( 1) E ( 3 ) E ( 5 ) E ( 2 ) E ( 4 ) E ( 6 ) E ( 7 ) E ( 9 ) E ( 8 ) E ( E ( 10 11 ) ) E ( 12 ) Example: see the same example we saw for the FIR filter with window. Recall the specs: 1. Pass band 0 4 kHz 2. Stopband 5 kHz 3. Sampling Frequency Fs 20 kHz Apply Remez Algorithm. You have to determine the filter order a priori, and let’s choose the same order N=81: h=firpm(80,[0,0.4,0.5,1],[1,1,0,0]); h(n) 0 .5 0 .4 0 .3 The impulse response obtained is shown. 0 .2 The frequency response is shown in the next slide, compared with the one we obtained by using the hamming window. Notice that the attenuation in the stopband is higher in the equiripple. 0 .1 0 -0 .1 0 20 40 60 80 100 H ( ) 20 0 Equiripple (Remez Algorithm) -2 0 -4 0 -6 0 -8 0 -1 0 0 -1 2 0 0 H ( ) 0 .5 1 1 .5 0 .5 1 1 .5 2 2 .5 3 3 .5 20 0 Hamming window -2 0 -4 0 -6 0 -8 0 -1 0 0 -1 2 0 0 2 2 .5 3 3 .5 Frequency Response of the Non Ideal LPF | H ( ) | 1 1 ripple 1 1 2 P STOP stop pass f stop transition region LPF specified by: • passband frequency P • passband ripple 1 or R P 20 log 10 1 1 1 1 dB • stopband frequency STOP • stopband attenuation 2 or R S 20 log 10 2 dB attenuation Best Design tool for FIR Filters: the Equiripple algorithm (or Remez). It minimizes the maximum error between the frequency responses of the ideal and actual filter. | H ( ) | 1 1 ripple 1 1 2 1 2 attenuation h firpm N , 0, 1 , 2 , / , 1,1, 0, 0 , w1 , w 2 h h [ 0 ],..., h [ N ] / w1 ~ 1 / w2 0 1 2 3 Linear Interpolation 20 log 10 ( 2 ) 22 2 N Example: Low Pass Filter Passband P 0.4 Stopband S 0.5 Choose order N with attenuation 40dB 40 2 22 (0.5 0.4 ) 37 20 | H ( ) | 0 -20 Almost 40dB!!! -40 -60 -80 -100 -120 0 0.5 1 1.5 2 2.5 3 3.5 Example: Low Pass Filter Choose order N=40 > 37 | H ( ) | 10 0 -10 -20 OK!!! -30 -40 -50 -60 -70 -80 0 0.5 1 1.5 2 2.5 3 3.5