### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# DIGITAL SIGNAL PROCESSING EE 475

ISU

GPA 3.81

### View Full Document

## 25

## 0

## Popular in Course

## Popular in Electrical Engineering

This 59 page Class Notes was uploaded by Amara Morar on Monday October 12, 2015. The Class Notes belongs to EE 475 at Idaho State University taught by Staff in Fall. Since its upload, it has received 25 views. For similar materials see /class/222194/ee-475-idaho-state-university in Electrical Engineering at Idaho State University.

## Similar to EE 475 at ISU

## Popular in Electrical Engineering

## Reviews for DIGITAL SIGNAL PROCESSING

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/12/15

Chapter 7 FIR Filter Design 1 The basic FIR lter is characterized by the following two equations N71 N71 Equations 71a b p 343 yn Zhkxn k Hz 2 hkz k k0 k0 where hk k01 N l are the impulse response coefficients of the lter Hz is the transfer function of the lter N is the lter length The rst equation is the FIR difference equation and is a time domain equation describing the FIR lter in nonrecursive terms Note that in a FIR lter the output yn is a function only of past and present values of the input xn When FIR lters are implemented by direct evaluation of Equation 71a they are always stable Equation 71b is the transfer function of the lter and provides a way of analyzing the lter eg its frequency response 2 FIR lters can have an exactly linear phase response More on this later but the key is symmetry in the lter coef cients 3 FIR lters are easy to implement All DSP processors have architectures that are suited to FIR ltering Nonrecursive FIR lters suffer less from the effects of nite wordlength than IIR lters There are recursive FIR lters more in section 77 FIR lters should be used whenever we wish to eXploit any of the above advantages especially the linear phase response The ability to have an exactly linear phase response is one of the most important properties of a FIR lter When a signal passes through a lter it is modi ed in amplitude and or phase The phase delay or group delay of the lter provides a useful measure of how the lter modi es the phase characteristics of the signal If we consider a signal that consists of several frequency components the phase delay of the lter is the amount of time delay each frequency component of the signal suffers in going through the lter The group delay is the average time delay the composite signal suffers at each frequency Mathematically the phase delay is the negative of the phase angle divided by frequency whereas the group delay is the negative of the derivative of the phase with respect to frequency 2 6a T d6a Equation 72ab p344 Tp a da BB 475 575 Digital Signal Processing 142 A lter with nonlinear phase response will cause a phase distortion in the signal that passes through it This is because the frequency components in the signal will each be delayed by an amount NOT proportional to its frequency thereby altering their harmonic relationships This is undesimble in music data transmission video and biomedicine A lter is said to have a linear phase response if its phase response satis es one of the following relationships Equation 73a b p 344 8a 70m or 8a 67 am where alpha and beta are constants If a lter satis es both of the above equations it will have constant group and phase delay responses If Equation 73a holds then the impulse response of the lter will have positive symmetry hn hN n l and alpha N l 2 When Equation 73b holds the lter will have constant group delay only and the impulse response will have negative symmetry hn hN n 1 alpha N l 2 and beta pi 2 For example when N 7 then for positive symmetry h0 h6 hlh5 and h2 h4 A summary ofthe key points about linear phase FIR lters is shown in Table 71 p 347 Impulse rcrpmm Number uf Frequency rexponse f xyluneuy coef cientx N Him lingquot Phase A 7M Positive xynmctry Odd equot quotquot 5 2 ltllCOSdrl 1 I111 httVi I i H Een cquot 39 H39 3 2 hn cosLaXt 7 J 2 m tun Negmive lt39mmulru Odd e quotquot 3 1 2 am simmn 3 t litt tV l n v 1 Even quotIquot 3 E but sintmm 7 fit 4 w There are four types of linear phase FIR lters as can be seen in Table 71 depending on whether N is even or odd and whether hn has positive or negative symmetry The frequency response of a type 2 lter positive symmetry and even length is always zero at half the sampling frequency therefore it is unsuitable EE 475 575 Digital Slgial Processing for ahigh pass lter Types 3 4 negative symmetry each introduce a90 deg phase shi and a frequency response of 0 at zero frequency so they are both unsuitable for a loW pass lter and type 3 is also unsuitable for a high pass lter These tWo types are used to design differentiators and Hilbert transformers because of their 90 deg phase shi Type 1 is the most versatile A comparison of the impulse responses of the 4 lter types in shown in Figure 71 Centre of syIumeLry N odd positive symmeu y 0 l 2 4 1 Centre of symme INEVEIL positive symmetry 1 N I 3 I I 10 I 0 I 1 6 8 I n CenII e of symmetry N odd negative symmetry A39 6 8 I I n 2 r I l 39 n Centre of symmetry N even negative symmetry I I I 1 5 8 I 0 2 4 I 39 n EE 475 575 DIgItaI sngaI ProcessIng ABCBA numl5 1 z 1 I25 requnumn a Magnum Nuw luuk at its guup and phase delay m MatLab and we see mm are cunstznt g E Group 12an sammes Nuvmahzed FvEuuencv xv vansamme phasa lalaynm1 EE67SS7SDlguxgndecsslr6 0 N 01 3901 Phase delay samples M 02 04 06 08 1 Normalized Frequency x1 radsample 0 NeXt try different lter coef cients num12345654321 oABCDEFEDCBA Typelagain freqznum1 50 El E D x g quotR 2 g 50 ll I 6 E l 100 0 01 02 03 04 05 05 0 08 09 1 0 Normalized Frequency xnradfsample E Erman g quotHath i 500 quot m u 3 m a U E amp EH 1000 0 01 02 03 04 05 05 0 08 09 1 Normalized Frequency X11 radfsample Note the group and phase delay are again constant A B C D E 0 E D C B A Type 3 odd number of coef cients with negative symmetry good for band pass num1 2 3 4 5 0 5 4 3 2 1 freqznum1 BB 475 575 Digital Signal Processing Magmmde ea n1 n2 n3 n4 n5 ms n7 n9 xnvadsa me 3 E g 39 39 a 2 n n4 n5 n7 n Nuvmahzed Fveuuencv X vadsaNME numl llll 7gtABIBA Typelzpin r eq1num1 Magmmde ea Phase degrees n 3 n A n 5 n E n 7 Nuvmahzed Fveuuencv ixnvadsamme due m n Wrapping aruund p degrees A B B A Type 2 Even number ufcue iments wnh pusmve symmetry guud mew pass Dr band pass num1 z z 1 mvssvsngusgeunmeswe r eq1nm1 LI 72 3 3 72 L1 n r eq1nm1 E g El 1 El 2 El 3 El 4 El 5 El E El 7 El 9 xn vadsa me 1 w 39 Ti i r 1 El 2 El 3 El 4 El 5 El E El 7 El 9 Nuvmahzed Fvauuencv X vadsaNME AB B A TypeA num127271 freq1nm1 EE67SS7SDlguxgndecsslr6 Magmmde dB Phase degrees Secnuns 7 Z and 7 3 we have already cuvered m Ch 6 Sec nn 74 FIR Inef cient Calnllatinn M hnds meetsthe desigq specs There are 3 general methudsused the rstufwhchxsthe Sec nn 75 Windnw Methnd hm are related by the In Equanun75 p 352 hoot 1104 mpgmm 7r remhses aesthea cutru 39equmcy Next we take the In efthe hlteneepehse Ever 1 heme and get the result shuWn m Equanun 7 a mvstsvsngusghunmeswe 7 I l 1 1mm fj 1gtlt equotquotquotda 2 e de Jr 7 w 7 f smmw 71 0 N 571 0 Ila Z n 0 using L39H piml s rule In Figure 74a We see the ideal loW pass frequency response and in b We see the impulse response of this ideal LP lter Hutu l 77 Va U n M wmnm i 41 1mm t I I i Q l A l 7 n o w ur 1 if u w Note We see that this response is symmetric about n 0 and Will therefore have linear phase response but it is not a true FIR since it requires an in nite number of coef cients Therefore this represents the ideal impulse response of the loW pass lter The ideal impulse response for all 4 types of lters is shown in Table 72 p 353 EE 475 575 Digital Sigial Processing Ideal impulse response hunt I Filler vpe hnUlL n 3 0 110 sin uzw Lowpnss 2 3L nil ilt10 J Highpass 2 l 7 2 nu sinma sin Inc I Bandpass 2 11 7 271 It 7 till nu sinmw invnw Bundslop lbil 7 3f l 31 l 7 I no 1m L f andf are the normalized passbzmd or slopbund edge frequencies N is the length N ller In Figure 75 p 353 we see the effects on the frequency response if we truncate our ideal impulse response to 13 and 25 coefficients in order to make a real FIR We see broadening of the response and ripples both in the pass band and in the stop band due to ringing or Gibb s phenomenon One way to mathematically truncate the series is to multiply it by some type of window function whose duration is nite Here we multiply the ideal hD n by wn to get a realizable lter hn see Figure 76 p 355 BB 475 575 Digital Signal Processing 151 HOMO 1Dll Wa lenl When we compare this result with simple truncation shown in Figure 75 we see that windowing has reduced the magnitude of the ripples but at the eXpense of widening the pass band Many different window functions have been proposed and several are in MatLab One is the Hamming window which is de ned as 27m Equatlon 77 p 355 wn 054 046cos 7 Figure 77a b p 356 compares the time and frequency domain characteristics of this window with the rectangular window BB 475 575 Digital Signal Processing 152 12000 gt 04000 7 02000 mm 41 AAALLl 0 7 H 11 28 35 42 49 36 11000 10000 08000 00000 04000 0 2000 00 100 0 l 2000 i l 0000 08000 00000 04000 0200 00000 0 In the time domain Hamming decreases more gently towards zero on either side In the frequency domain the amplitude of the main lobe is about twice the Width of the main rectangular lobe The Hamming side lobes are smaller relative to the main 40 dB down vs only 14 dB down for the rectangular This mean that the Hamming Window Will lead to a lter With Wider transition Width but higher stop band attenuation The EE475 575 Digital Slgtal Processing 153 appropriate relationship between the transition width from pass band to stop band for a lter designed using the Hamming window is and the lter length N is given by 33 Equation 78 p 355 Af 7 where delta f is the normalized transition width The maximum stop band attenuation possible with Hamming is about 53 dB and the minimum peak pass band ripple is about 00194 dB To obtain the results of Figure 77 in MatLab we use a different tool window oowhich opens up the Window Design and Analysis tool then plot the windows of interest or to compare using the Window Visualization tool enter N 56 w windowrectwinN w1 windowhammingN w2 windowblackmanN wvtoolww1w2 which results in the following plot BB 475 575 Digital Signal Processing 154 Ammmme Leakage Faclm n z Re ahve swde ahe anenuahan 5m aa me damam Fvequency damam u g ran 2 1 an 1 3 5 39 u 2 u a u 5 u a Samp es Nmmahzed Fvequermv Xmadsamme Maxn ahe mm 3an n D5855 Try nus m MaLLab an ynur awn w Table 7 3 p m MatLab 1 mumum quotW M mm mm m memm er mm mmmmun mm mm hum ummumuymn mm M run WWW MmM m z w u u m in u wwzm n K m mm W m s vu tzww an 475 575 Dam Sign mum palam L x The relevant equannns farthe Kmser mnan are Shawn on p 358 N56 w windnwectwinm wl windnw1nnn an wmn1ww1w2w wA A We damam FYEquermv damam u S g esu s g 2 Ann 1 2 3 a 5 39 n2 m us ne 5 mp es NamahzedFvequeUDV Xmadsamme Leakage reem 2 z Re ahvesxde aheanenuahan 2 318 Maxn ahewxdlhlid mamas an an Example 7331venthe speemeaunns 15k1Iz Puss band edge frequency Innsiu39nn width 0 mm Equatmn s Sap 325 720 1ag100 00316 so 0063 dB Sampung Frequency 8 kHz 2 Ms s75 menu 5 Ian Pun er me Table7 3 p andmund up w 5 sum Equanun7 a p 355 N v wzwinduwhamningm wtsw22753 quotu mplay LhelasL halfufthevecturtu get thewmduw weights rrememberthey are symmemc 7mm um weights uzm mm u1957 mum um um my mum ummw mums 1 U E U E U 4 U 2 TTTTT 1U 15 2D 25 me Table 7 z p 353 we salsa the meal transfer fuann fur aluwpass lterwhnh xs hDn2s quot2fymquotw famth 11012 farn0 n K Nuw calculate the 27 53 1 Zvalues fur the hd vedunn MatLab EE67SS7SDlguxgndecsslr6 lamp 7 1Nr 1 z r 15 nu 8 amp sanaanp z pi rs pi tanp mmzrc quotman375 hrl mm temp MW cums mm unsm mm Muss umso man may mm rumsg mm mum mm mm cmv um mm mm mum mum nun rum ruum umz7 mum EIsz nunkh m mama FIR g wts hrl39 m g A cums mm mm rumss rum nuns and arms rumw rumz um mums uum ruuuu mum ucmg Emu rumsu umlg umx umzzr a mm mm u 2 umuz rummma SIEMFIRian EE67SS7SDlguxgndecsslr6 urda cme FIRicueffvectur and pan39Lhem up m n 27 7211101 FIRJnanzs r n m umm umm ruum ruuuu mum ucmg mm mm mm mm mm mm mm mm umu umuz mm a nding mm lawman1 an lnnkslikz Table 74 Nuts these are the actual lter cuef nems yuu wuulduse m a DSF nanmmuwm EE67SS7SDlguxgndecsslr6 spans 1 transmon wxdth 0 5 KHz and stop band attenuation 50 dB freq1 nalicn2 3915128 Note the unearphase s the pass band g 1 1 I 1 s 1 a 3 WW WWW m 2 gm I w l w I I D 5 1 1 5 2 5 3 3 5 A A Fvenu w Hz WMVNWI i El D 5 I l 2 5 3 3 5 A command E 475 575 mm ngml Pmcesmng N1vecturB H W nu qutn xlt1nwn111 sample mte Au 141152 175 4 default windnw is Hamming freq1h1512x The values nfh arevery clnsetn what we gut previnusly in Table 74 h um umuz umu umm rum mm mm mm mm rumsu mm mm mum ruuuu uum umm umm rumz rumw mums mm mm rum 7mm um mm um7 mm mm rumss rum nuns new rucms mm mm umm umm ruuuz mm mum mm mm mm mm mm mm mm mm u mu mm mm 2 77 h 152 EU 154 24 1 l 1 I l new 1 51m EEO7SS7SD9NSgndecssxrg 151 h4mszun1541xm11 1 u an freqme 1 512 X FIRcuef mems are 215 dif rmt smce u uses a Migrant algumhm m calculate the cuef nems umm umm rumm mm 7mm was mm mm mm umm my mum rumaa mm mum mum um rumzu mm mum mum um96 mm mm mm mm mm 2 EEO7SS7SD9NSgndecssxrg m Now do Example 74 p 361with the following speci cations Pass band 150 250 Hz band pass Transition width 50 Hz Pass band ripple 01 dB gt equivalent to a deviation of00115 from Equation 65b p 325 20 log101 00115 00993 Stop band attenuation 60 dB gt equivalent to an attenuation of 0001 from Equation 65a p 325 20 log100001 60 dB Sampling Frequency 1 kHz From these specs we nd the window that can meet the two attenuation requirements from Table 73 p 357 Blackman yields a pass band ripple of 00017 and a maximum stop band attenuation of 75 dB which exceeds our specs and Kaiser with a large enough beta We rst choose Kaiser and now calculate the number of lter coef cients using Equation 711 p 358 N Z 14 36 50 39 Af 1436 7249 gt 73 1000 The ripple parameter is given by Equation 710c p 358 01102A 87 0110260 87 565 We now repeat what we did before in MatLab N 73 w2 windowkaiser N 565 wts w23773 stemwts oo displays the last half of the vector to get the window weights remember they are symmetric total of 37 weights 10000 09980 09921 09823 09688 09516 09309 09070 08799 08501 08178 07833 07468 07087 06694 06292 05884 05473 05063 04657 04257 03867 03488 03124 02776 02446 02135 01844 01575 01328 01103 00901 00720 00561 00423 00304 00204 BB 475 575 Digital Signal Processing 163 E B TTTTTEDWW me Table7 z p 353 we select Lhaideal transfer funean fu hm 2 mg 7 2A 5mg Muffin 7 2 i and 202 711rn 0 25 r abznd pass lterwhinh is 27 fem 0 m band edge e v 125 Nuw calculate the 37 values furthe hd vectur m MatLab temp Nr mu m 150 725 mm 250 5 mun z pi m 1 pi map 7 sinaapp mun mini mum enumu Ammo VDEIEIIE Emssvsnmismi Mam z pi rel pi temp U3 U2 El 1 f T 1 V i o o VEI 1 VEIZ VEI3 5 1E 15 2D 25 3D 35 FlRicndT wt hd39 um um rumm rmsm um um Harm umm mm mm mm mm mm um 029 ung mm mm mm mm mm mm um um mm mm mm mm uuun um um um mm mm mm mm mm 75p may cme FIRicueffvectur and pan them up 37 7211101 FlRicnef SXr n and u 1 rumm rumm uuun rumns a mammalan EE 7SS75nglxlgml Mam Ricnet 7y quotuanlnnksliszzhle 7511353 zsn Hz txmsxsuun mam 5n Hz smp band attenuanun n as and passbznd npple n 1 as cumpzre wah Figure7 8p 52 freqltfmalicne 1 512 mm Maynnude 15 Phase degrees Magmfy the mp pluttu shuwthe passbznd attenuatmn as Ms 575 mm sum Mam ms Magnitude dB 00 l 160 180 200 220 240 260 Frequency Hz Phase degrees 0 50 100 150 200 250 300 350 400 450 500 Frequency Hz Note the linear phase response in the pass band Another related way with the results below that match the above analysis but more simply b r172 125500 275500 kaiser73 565 freqzb 1 512 1000 BB 475 575 Digital Signal Processing Magmmde ea 2 u 2 u 3 Fveque cy Hz Phase degrees mm mm 7mm mm mm um mm mm eumn mm mm mm mmzz mm mm mm mm euum eumso mm mm mum eumzs ruuszu mum um94 umss um emsm u mum eumm m ms n max euum ruuszu eum2s mum umm eumsa euum um umm run22 rum um mum mus mm mm mm 332 eee ee EEEEEEE um mum mm mm um94 mm mm u mum eumn mm u mm 2 n 2 n 3 n Fveuuencv Hz Table73 5 ssumuu11u h r1lm 12550n2755m hlachnanll maqu 1 512 mm mvssvsngusgxunmeswe Magnllude ea 3 Hz 2 n 2 n Fveque y Phase degrees 2 El 2 El 3 El Fveuuencv HZ sue wnh 1 1n cuef ments cumpzred wnh 73 fur the Kmsa39xmplanemanun In geneml the Kaiser wmduw 15 mum ef nem than the Ether wmduw Wewm useLhe an eummanam an Bizmple7 s p 354 The calculanuns fur N and betaare an 354 N 71 and beta 5 48 Cumpare wth Fgure7 9 p m and the ltercue iments m Table 7 h rl7 14susum kaisu39ULSAX maqu 1 51 1mm mvssvsngusgxunmeswe Magmmde ea Phase degrees b umm en mm eucms 5E umns mm mm mm mm eucms 7mm umm required ltsmajm39 mdvanmgesare 1 us lack uf nemmy am the peak pass band and sup band npples are appmmmately equal 5 the remnse me pass and stup band edge equennes cannut be precisely speci ed Thus fur a gwen attenuaan wen me desxgqer muSL nd a sunsble wmduw EE 7SS7SD19NSgndecsslr6 4 In some applications the expression for the lter response will be too complicated to be obtained analytically from Equation 75 Section 76 The Optimal Method The optimal method of calculating FIR lter coefficients is powerful exible and easy to apply due to good design programs It is generally the rst choice for many FIR applications It is eVident in the window method that inherent in the process of calculating lter coefficients is the problem of finding a suitable approximation to a desired frequency response The peak ripple of filters designed by the window method occurs near the band edges and decreases away from the band edges Figure 710a p 368 12000 10000 08000 06000 04000 02000 00000 0 12000 10000 08000 06000 04000 02000 00000 0 BB 475 575 Digital Signal Processing 171 If the ripples were distributed more evenly over the pass and stop bands Figure 710b a better approximation to the desired frequency response can be achieved The optimal method is based on this concept of equiripple in the pass and stop bands Consider the low pass lter response shown in Figure 7 11 p 369 15 P A MIHMH Practical response 1 1 5p x lHDwl lt Ideal response lEwl 539quot n7Y7Tl W 55 5P1ul w Passband Stopband b The actual response in the pass band oscillates between lidp and in the stop band between 0 and d5 The difference between the ideal filter and the actual response can be viewed as an error function Equation 713 p 367 Ea WaHDa Ha Ww is a weighting function that allows the relative error of approximation between different bands to be de ned BB 475 575 Digital Signal Processing 172 In the optimal method the objective is to determine the lter coef cients hn such that the maximum weighted error is minimized in the pass and stop bands ie the maximum error between the desired and actual frequency response is minimized Mathematically it has been shown that when this function is minimized the resulting lter response will have equiripple in the pass and stop bands The minimum and maximum of the ripples are known as extrema For linear phase low pass lters there are either rl or r2 extrema where r N l 2 type 1 or r N 2 type 2 The extremal frequencies are shown in Figure 710b as small black dots For a given set of lter specs the locations of these extremal frequencies are not known ahead of time except at the band edges Thus the main problem in the optimal method is to nd the locations of the extremal frequencies A powerful technique which employs the Remez exchange algorithm has been developed see references p 368 and is available in MatLab as the command remez The MatLab algorithm uses the Parks McClellan algorithm which uses the Remez exchange algorithm and Chebyshev approximation theory to design lters with an optimal t between the desired and actual frequency I CSPOIISCS Knowing the locations of the extremal frequencies one can work out the actual frequency response and then the impulse response of the lter Figure 712 p 369 shows a owchart of the optimal method BB 475 575 Digital Signal Processing 173 Specify lter and determine program inputs Initial guess of r 1 extrema Determine 1Eal and its largest r l extrema Extrema changed 397 Obtain the impulse response coef cients Some equations for estimating N using the optimal method are shown on p 371 EE 475575 Digital Signal Processing 174 L0wpassmterHerrn1an er al 1973 065 NT39F j5pDAI l 11ch AF is the Width of the transition hand normalized 10 the sa DAB 6 log 6a1110g11513 a log 5p m a110gw 5Pquot 11411116 111 13915p1611101217 15124411051112 Inngij 1 5309x10quot 11 7114 gtlt10 1 11 4761gtlt10quot 11 7161X104 a 75941 x 10quot 11 74278 x 10quot 5 s the passband ripple or deviation and i 1 the slopband ripple Bandpass filter Mintzer and Liu 1979 14661 N g5p 5AF1 AF here CA5w 510gmt3 1b100gw 5P3 172 10gm 5P 1 17logm p1 bi logm 5 I70 6 may as 7146logm6 quot169 0012 01 b2 0096 64 17 153051325 2 000 03 1 05705 IF 0443 14 A summary of the procedure for calculating lter coef cients by the optimal method is detailed on p 372 Specify the pass and stop band frequencies ripple attenuation and sampling frequency 1 2 Normalize each of the above frequencies by dividing by the sampling frequency and determine the normalized transition Width 3 Use the pass band ripple and stop band attenuation to estimate the lter order from Equations 714 or 715 p 371 Generally you will need to add 2 or 3 to the result from these equations 4 Obtain the Weights for each band from the ratio of the pass band to stop band ripples EE 475 575 D1g1tal 3191111 Processmg 5 Input the parameters to the optimal design program to obtain the coef cients N band edge frequencies and weights for each band 9 Check the pass band ripple and stop band attenuation gt1 If the specs are not met increase the lter order N and repeat steps 5 and 6 Example 76 A linear phase band pass lter is required to meet the following specs Pass band 900 1100 Hz band pass Transition width 450 Hz Pass band ripple lt087 dB gt equivalent to a deviation of010535 from Equation 65b p 325 20 log101 010535 087 Stop band attenuation gt30 dB gt equivalent to an attenuation of 0031623 from Equation 65a p 325 20 log100031623 30 dB Sampling Frequency 15000 Hz From the above speci cations we see that we have three frequency bands lower stop band from 0 to 450 900 450 Hz pass band from 900 to 1100 Hz and an upper stop band from 1550 to 7500 Hz 1100 450 to 12 15000 NeXt we normalize the band edge frequencies using the sampling frequency 450 gt 450 15000 003 900 gt 900 15000 006 1100 gt 110015000 00733 1550 gt155015000 01033 7500 gt 05 which corresponds to the following bands 0 to 003 006 to 00733 and 01033 to 05 NeXt we choose weights for the bands which are dependent on the pass and stop band deviations The deviations attenuations were calculated in the original spec dlo 010535 BB 475 575 Digital Signal Processing 176 ds 0031623 and take the ratio of dp to ds dp dS 010535 0031623 33314 gt 103 therefore we could use a weight of3 for the pass band and 10 for the stop band orjust 1 and 33314 note that weighting is applied in the opposite sense to the ratio we just took We choose a grid density of 32 We now use Equation 715 to approximate N in MatLab see algorithm p 439 dp 010535 ds 0031623 df 450 15000 bl 001201 b2 009664 b3 051325 b4 000203 b5 05705 b6 044314 ddp log10dp dds log10ds t1 b1 ddp ddp t2 b2 ddp t3 b4 ddp ddp t4 b5 ddp cinf dds t1 t2 b3 t3 t4 b6 ginf 146 log10dp ds 169 Nb cinf dt ginf dt 1 339551 DISAGREE WITH THE BOOK BUT AGREE WITH remezord BELOW We now implement this lter in MatLab First we estimate the number of lter coef cients using command rpmord Pass it a vector containing the band edge frequencies the ripple attenuation deViations and the sampling frequency The results are a set of vectors which we can plug straight into the remez algorithm NeXt do Example 76 p 373 BB 475 575 Digital Signal Processing 177 nfomow rpmord 450 900 1100 1550 0 1 0 0031623 010535 0031623 15000 n 32 gt generally too small for actual implementation fo 0 gt 0 7500 00600 gt 4507500 01200 gt 9007500 01467 gt11007500 02067 gt 1550 7500 10000 gt 7500 7500 mo 0 gt relative magnitude response in the stop band 0 1 gt relative magnitude response in the pass band 1 0 0 W 33314 gt dp ds 010535 0031623 103 10000 33314 Now up the order of the lter to 41 as in the book and c Table 77 p 375 N 41 b rpmN 1 f0 mo w b 00154 00001 00050 00126 00211 00278 00301 00241 00442 00586 00633 00558 00366 00086 00231 00796 00723 00520 00241 00031 00145 00231 00259 00301 00278 00211 00126 0 00154 Check the frequency response freqzb 1 512 15000 BB 475 575 Digital Signal Processing ompare the coefficients with the results contained in 00259 00145 00031 005 20 00723 00086 00366 00558 00633 00586 00442 005 0 0 0001 225 52 dear Magmmde ma MA M MM M g W WVVVVV WWV WEIEI ZDEI EDD ADD SUD EDD 7D vequency Hz gm n n n m w W m 1H m WWW M 1 MM NMMM n3 NVVVJVVVMMHHHV u m inn m m m mm mm H m SS7SD19Nnglecsslr6 Magmmde ea Fvequency Hz W m M MM Mb IVVVVVV IVVVVV Phase degrees nu 2mm u n 4n n vequency Hz Use he fulluwmg e retum mure details abuut he results 11 m RES rpm lrl rnmnw b een ems he sue Eusf nems as befnre en E I961 Whinhxsthemzxxmum npple hagh egt zu legmm U um I 797 dB RES whmh 15 sveem eememmg he fulluwmg elds RES gm vectur eememmg he equmcy gm used m he sue design epumsuen RES des aesuearemnse un gna RES w wagms un fgm RES H actual frequeneyremnse un he gnd RES em ermr at each pm un he equmcy gnd aesuea 7 actual RES xexlx vectur ufmdmesmtu gna efememsl equenmes RES faxtx vectur uf mammal equenmes EEwssvsngmgeupmsswe RESfeXtr 3115 0 00417 00600 01200 02067 02245 02632 03079 03555 04031 04537 05013 05519 06025 06501 07007 07513 08019 08495 09001 09507 10000 Comments on our results 1 The pass band deviation is 333 times that of the stop band because the errors in the pass band and stop band were weighted 3 and 10 respectively The higher the weight is for a band the smaller is the resulting ripple or deviation Equot The pass band ripples and stop band attenuation are within specs 5 There are 22 eXtremal frequencies 41 3 2 in the amplitude response note that additional eXtremals occur and f 0 l and at the pass band edges 4 The impulse response is symmetrical about the middle lter coef cient This symmetry is required in order to obtain a linear phase response Now look at a good analytical tool for lters that MatLab has that allows you to quickly look at the key properties ofthe lter fvtoolb 1 BB 475 575 Digital Signal Processing Magnnude as You ean than group and phase delay coef cients step andxmpulse response etc Ammmme PrueLem Mm magmarv Pan E15475 575 1me mm Pmcesnng emue nelav on samples Phase Delay degrees l A m l c l l irrmin mHz and not normalized frequency For aglven design attenuation relaeve to eaen other as desired using the Weights an N Example 771 376 Ninth irequeney 1375 111 ninth liner Passhand edge frequencies 1575 and 2175 111 Passhand ripple lt001 3 e gt equivalent in a dzviztinn qr000115 rrqm Equau39qn 551 p 325 20 lng101 000115 001 dB gt 39 0001 rrqm Equatinn 55ap 325 720 lng100001 50 13 Sampling Frequency 7500 111 Required number at lter eqenieieme 51 BB 475 575 Digial Sign Pmcessmg Start with remezord command note for a notch lter you need to repeat the notch frequency in the band edge frequency vector nfomow rpmord 1575 1875 1875 2175 1 0 1 000115 0001 000115 7500 n80 We rede ne N to be 61 not work in MatLab 7 convergence problems so go to 7land use the remez command N 71 b err RES rpmN 1 f0 mo w b is different than in the book Plot the frequency response Figure 714 p 376 Note the linear phase response Look at the eXtemal values stored in RESfeXtr freqzb 1 512 7500 BB 475 575 Digital Signal Processing 184 Magnitude dB 0 500 1000 1500 2000 2500 3000 3500 Frequency Hz 0 a g 2000 0 D 3 4000 C n 6000 0 500 1000 1500 2000 2500 3000 3500 Frequency Hz Look at the notch in more detail below to see that it meets the specs focus on 1575 and 2175 Hz BB 475 575 Digital Signal Processing M E E a 0 quotU 3 g 1 V E 2 1600 1700 1800 1900 2000 2100 Frequency Hz 0 a g 2000 0 D 3 4000 C n 6000 0 500 1000 1500 2000 2500 3000 3500 Frequency Hz Now look at lter in more detail using fvt001b Imaginary Pan BB 475 575 Digital Signal Processing 1 PUIBJZero Plot Real Part Skip Example 78 p 378 Note MatLab also has the command CREMEZ which designs complex and nonlinear phase equiripple FIR lters CREMEZ allows arbitrary frequencydomain constraints to be speci ed for the design of a possibly complex FIR lter The ChebysheV or minimax lter error is optimized producing equiripple FIR filter designs Section 77 Frequency Sampling Method This method allows us to design nonrecursive FIR lters for standard lters LP HP BP and notch and lters with arbitrary frequency responses It also allows recursive implementation of F IR lters that lead to computationally efficient filters First we will look at nonrecursive frequency sampling lters The idea behind this technique is to take the desired lter response a sample it at multiples of k fs N b and then take the DFT of the samples as shown in Figure 7 l6c p 380 imam lHltkJ BB 475 575 Digital Signal Processing 187 For linear phase lters With positive symmetrical impulse response We get for even N N 7quot Equation 717 p 381 1111 Z 2 Hk cosw kl H0 Where alpha N 12 The resulting lter Will have a frequency response that is exactly the same as the original response AT THE SAMPLING INSTANTS But there are no guarantees between these instants therefore the key is to take a suf cient number of frequency samples An alternative method known as Type 2 results if We take our samples at multiples of k 2 fs N Each method yields a slightly different result and Figure 717 compares the sampling grid for both types of lters l Type l ru n Type 2 39c cn 1m lm t l RC Twit l odd Type 2 Mad Example 79 p 382 Pass band 0 7 5000 Hz Sampling frequency 18000 Hz Filter length 9 EE 475 575 D1g1talSigaalProcessing 188 The ideal frequency response is shown in Figure 718a p 383 lHkl ad to gt a The response is sampled at intervals of 18000 9 2000 Hz The magnitude of the frequency samples are l for the first 3 and 0 for the last 2 remember we only need half of the samples plus the origin due to symmetry We then plug these values into Equation 721 Note N 9 upper summation limit 4 because N is odd We use the MatLab function fir2 here N9 denN 1 2 1 fd0 lden Zden 3den 1 only works when N is odd fd 0 02500 05000 07500 10000 Hd 1 1 1 0 0 change Hd to get a different frequency response bf1r2N 1 fd Hd b00041 00070 00545 02484 06240 02484 00545 00070 00041 NOTE THESE DISAGREE WITH THE BOOK p 383 THE BOOK COEFFICIENTS RESULT IN 2 NOTCH FILTERS freqzb 1 512 18000 zplaneb 1 BB 475 575 Digital Signal Processing 189 Magmmde 15 R9611 Fan g 3 2 E 1 a E n E r i 71 r2 73 A 111 7 usedin 11 function call 11 111nm 1 512 18000 plotl39 ma1 E 475 ms 1319111519111 Pmcesang nruse meal and changethe Yamsumts 1nnn 2nnn 3nnn ADDEI 5nnn EDDEI 7nnn nnnn an n we use me fnllnwmg cnmmand ladmun m Ha 39hnmrN39 1114 qu 1 512 lsnn 111me 2h 4H wnn 1nnn 2nnn 3nnn ADDEI 5nnn EDDEI 7nnn nnnn an n me bnxczr square WmdnwmsLead nthe defaulthzmmmg m rZ mvssvsngmgeumeem Now do another example from the appendix of this chapter p 452 Here We Want to design a special lter With the response shoWninFigure 7B5 p 452 NOTE ERRORS IN FIGURE in book 7 corrected below the amplitude from 025 045 should be 03 not 02 and the last transition band should be from 075 to 085 The other lter speci cations are that the sampling frequency is 2000 Hz and We Want a lter length of 110 The MatLab code for this is N110 rd 0 015 025 045 05 075 085 1 hd1 1 03 03 01 01 0 0 b r2N71fd hd Hffreqzb 1 512 2000 plotfabsH grid on EE 475 575 ngm Stgtal Processing 192 urm dB tnqu 1 512 mm f mm W WV m 2m sun 2 a m a gun mm A E n ma Jun 4 5 7n at sun 1 mmm H Iplanaml as Ms ms mm um pmsm 1 t as E 715 V1 72 samples m the 1mman band as shuwn m gure 719 p 384 mm 7 PM Smpbum 1 1 1 386 m u wquot n see1nTable7 11 p 385 Wevmn tduLh1sexamplebuttheresultsshuwthatzsthenumhernftrani nn urda 1me 51135 EEO7SS7SD9NSgndecsslr6 nonrecursive forms if a large number of frequency samples are zero valued It can be shown see Example 712 p 392 that the transfer function of an FIR lter Hz can be expressed in recursive form 1 2 N4 Hk k01 exp J27zk erl N Equation 723 p 389 H z H1ZH2 Z We see that in recursive form Hz can be viewed as a cascade of two lters a comb lter which has N zeros uniformly distributed around the unit circle and a sum of N single allpole lters The zeros of the comb lter and the poles of the single pole lter are coincident on the unit circle at the following points 271k zk exp 7j and therefore they cancel each other resulting in an FIR lter no poles But in reality nite word length effects cause the poles not to be located exactly on the unit circle so they are not completely cancelled by the zeros potentially unstable Stability problems can be avoided by sampling Hz at a different rate Next making use of the symmetry inherent in the frequency response of a FIR lter with a real impulse response hn we obtain iHki 2 05 Z kaj 2rCOS MJZ rNZ N i N N HO N H 1 2r cos jfl r22392 1 Z N 1 Equation 725 p 390 Hz 71 where alpha N 12 ForNoddM N 12 and evenMN 2 1 The realization diagram for this equation is shown in Figure 722 p 391 Recursive implementation of FIR lters greatly reduces the number of arithmetic operations in digital lters If a lter also has integer coef cients this further reduces the computational burden Integer coefficients are only possible if some restrictions are placed on the locations of the poles in Eq 725 Also the pass band of lters with integer coefficients can only be centered at restricted frequencies Example 713 p 396 Want the transfer function and difference equation for a recursive FIR low pass lter with integer coef cients with a center frequency of 0 Hz and a sampling frequency of 18000 Hz We BB 475 575 Digital Signal Processing 195 arbitrarily set N 9 so the interval between frequency samples is 18000 9 2000 Hz What We Want are zeroes at these points Which causes the magnitude of the response to equal zero there see Figure 724a b Hlj lj 0 2 4 6 8 ftsz 172 9 So H1z 9 which has 9 zeros spread around the unit circle We Want to have one pole which 1 nulli es our zero at the lowest frequency bin Which is at x 1 y 0 on the unit circle ie H2 2 1771 7 2 Putting these together We get 17 z 9 1 H z 9 172quot In Matlab We set up num10000000071 den97900000000 freqznum den 512 18000 EE 475 575 Digital Sigial Processing 196 Magmmde ea ADD sun EDD mu EDD gnu Fvequency n Phase degrees mu 2mm 3mm sun EDD mu Bun BEIEI 4n n Fvequency n Compare mas wi39h Figure 7241 p 397 Next we plot the poles and zeros zplanenum den magmary F an Red Pan 4 39LFigure714a quot 39 39 quot 39 439 equation yn yn1 19 xn xn9 Now look atthe hn coef cients using Fainmulsqnum den 10 y e EB 47 ms ngm ngul Pmcessng 01111 01111 01111 01111 01111 If we multiply each coef cient by 9 we get our 9 integer coefficients for hn Now let us change the locations of our pole and cancel out a different zero remember when we cancel a complex zero pair we will need a compleX pair of poles and see what that does to the frequency response We nd the roots of the numerator using digits15 oo or use format long symrootsnum 39d39 0o To get more accuracy 3115 93 9692620785908342020143325669i 93 9692620785908342020143325669i 50000000000000086602540378443 8i 500000000000000866025403784438i 173648177666930984807753012210i 173648177666930984807753012210i 999999999999999 766044443118978642787609686539i 766044443118978642787609686539i We choose the compleX pair 01736 09848j and 01736 09848j p1 173648177666930984807753012210i p2 173648177666930 984807753012210i den1poly25ym1 p1 den2poly25ym1 p2 den3expandden1den2 den3 XAZ 0347296355333860 1 den 1 0347296355333860 1 0 0 0 0 0 0 0 freqznum den 512 18000 BB 475 575 Digital Signal Processing 198 E E 39 m n 2n u an n 4n u an u an n m an an Fvequency n i 1 zplanenumden 1 n 5 7 EL 2 E n 5 1 Red Pan But we see we do not get integer coef cients mas um yZdimpulsenumden10 EB 47 ms ngm ngul Pmcessng 03473 10000 00000 00000 The second part of Example 713 is similar to what we just did band pass but using an even number of coef cients Note the pole zero cancellation at Im z l at the center of the frequency As before our transfer function becomes 78 g and this leads to the following difference equation yn yn2 18 Xn Xn8 Note this a simple method to get integer coefficients but we see that the amplitude response of the lter is generally poor and the designer is restricted as to where the pass band can be located Section 78 Comparison ofthe 3 FIR methods The optimum method provides an easy and ef cient way of computing FIR lter coefficients and it provides total control of lter specs but proper lter design software is required For most applications this method yields lters with good amplitude responses for reasonable values of N The method is particular good for designing Hilbert transformers and differentiators More about Hilbert transformers in the neXt section Back to our comparison of the FIR methods in the absence of optimal software or when the pass and stop band ripples are equal the window method is a good choice It is simple and easy to understand but not as economical as the optimal method The windowing method also does NOT allow the designer to have precise control of the cutoff frequency or ripples in the pass and stop bands The frequency sampling approach is the only method that allows both nonrecursive and recursive implementation of FIR lters Filters with arbitrary amplitude phase responses can be readily designed with this method It lacks precise control over the location of the band edge frequencies or and the pass band ripples We will skip over Example 714 which is a comparison of the three methods in designing two different lters BB 475 575 Digital Signal Processing 200

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.