Practical Analog and Digital Filter Design

Size: px
Start display at page:

Download "Practical Analog and Digital Filter Design"

Transcription

1 Practical Analog and Digital Filter Deign Artech Houe, Inc. Le Thede 004

2 Thi text i dedicated to my wife who keep me grounded, and to my grandchildren who know no bound.

3 Content Preface xi Chapter Introduction to Filter and Filter Deign Software. Filter Selectivity.. Lowpa Filter 3.. Highpa Filter 4..3 Bandpa Filter 5..4 Bandtop Filter 5. Filter Approximation 6.3 Filter Implementation 8.4 WFilter - Filter Deign Software 9.5 Concluion 4 Chapter Analog Filter Approximation Function 5. Filter Tranfer Function 5.. Tranfer Function Characteriation 6.. Pole-Zero Plot and Tranfer Function 7..3 Normalied Tranfer Function 8. Butterworth Normalied Approximation Function 9.. Butterworth Magnitude Repone 9.. Butterworth Order 0..3 Butterworth Pole Location 0..4 Butterworth Tranfer Function.3 Chebyhev Normalied Approximation Function 7.3. Chebyhev Magnitude Repone 7.3. Chebyhev Order Chebyhev Pole Location Chebyhev Tranfer Function 9.4 Invere Chebyhev Normalied Approximation Function 34 vii

4 viii Practical Analog and Digital Filter Deign.4. Invere Chebyhev Magnitude Repone Invere Chebyhev Order Invere Chebyhev Pole-Zero Location Invere Chebyhev Tranfer Function 37.5 Elliptic Normalied Approximation Function Elliptic Magnitude Repone Elliptic Order Elliptic Pole-Zero Location Elliptic Tranfer Function 47.6 Comparion of Approximation Method 5.7 Concluion 54 Chapter 3 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter Unnormalied Lowpa Approximation Function Handling a Firt-Order Factor Handling a Second-Order Factor Unnormalied Highpa Approximation Function Handling a Firt-Order Factor Handling a Second-Order Factor Unnormalied Bandpa Approximation Function Handling a Firt-Order Factor Handling a Second-Order Factor Unnormalied Bandtop Approximation Function Handling a Firt-Order Factor Handling a Second-Order Factor Analog Frequency Repone Mathematic for Frequency Repone Calculation C Code for Frequency Repone Calculation Saving the Filter Parameter Concluion 84 Chapter 4 Analog Filter Implementation Uing Active Filter Implementation Procedure for Analog Filter Lowpa Active Filter Uing Op-amp Highpa Active Filter Uing Op-amp Bandpa Active Filter Uing Op-amp Bandtop Active Filter Uing Op-amp Implementing Complex Zero with Active Filter Analog Filter Implementation Iue Component Selection Senitivity Analyi Uing WFilter in Active Filter Implementation 4.9 Concluion 3

5 Content ix Chapter 5 Introduction to Dicrete-Time Sytem 5 5. Analog-to-Digital Converion Frequency Spectrum and Sampling Rate Quantiation of Sample A Complete Analog-to-Digital-to-Analog Sytem 9 5. Linear Difference Equation and Convolution Linear Difference Equation 5.. Impule Repone and Convolution Dicrete-Time Sytem and -Tranform Frequency Repone of Dicrete-Time Sytem Playing Digitied Waveform on a Computer Sytem Concluion 39 Chapter 6 Infinite Impule Repone Digital Filter Deign 4 6. Impule Repone Invariant Deign 4 6. Step Repone Invariant Deign Bilinear Tranform Deign C Code for IIR Frequency Repone Calculation Concluion 60 Chapter 7 Finite Impule Repone Digital Filter Deign 6 7. Uing Fourier Serie in Filter Deign Frequency Repone and Impule Repone Coefficient Characteritic of FIR Filter Ideal FIR Impule Repone Coefficient Windowing Technique to Improve Deign Park-McClellan Optimiation Procedure Decription of the Problem The Reme Exchange Algorithm Uing the Park-McClellan Algorithm Limitation of the Park-McClellan Algorithm C Code for FIR Frequency Repone Calculation Concluion 85 Chapter 8 Digital Filter Implementation Uing C Digital Filter Implementation Iue Input and Output Signal Repreentation Coefficient Repreentation Retaining Accuracy and Stability 9 8. C Code for IIR Filter Implementation C Code for FIR Filter Implementation Real-Time Implementation of FIR Filter 0

6 x Practical Analog and Digital Filter Deign 8.3. Nonreal-Time Implementation of FIR Filter Filtering Sound File Concluion 07 Chapter 9 Digital Filtering Uing the FFT The Dicrete Fourier Tranform DFT The Fat Fourier Tranform FFT The Derivation of the FFT The Invere FFT C Code for the FFT Application of FFT to Filtering 9.5 Concluion 5 Appendix A Technical Reference 7 Appendix B Filter Deign Software and C Code 9 Appendix C Filter Deign Uing C 3 Appendix D C Code for Normalied Approximation Function 33 Appendix E C Code for Unnormalied Approximation Function 39 Appendix F C Code for Active Filter Implementation 47 Appendix G C Code for IIR Filter Deign 53 Appendix H C Code for FIR Filter Deign 57 Appendix I Filtering Sound File 59 About the Author 63 Index 65

7 Preface Thi book wa intentionally written to be different from other filter deign book in two important way. Firt, the mot common analog and digital filter deign and implementation method are covered in a no-nonene manner. All important derivation and decription are provided to allow the reader to apply them directly to hi or her own filter deign problem. Over forty example are provided to help illutrate the fundamental of filter deign. Not only are the detail of analog active and digital IIR and FIR filter deign preented in an organied and direct manner, but implementation iue are dicued to alert the reader to potential pitfall. An added feature to thi text i the dicuion of fat Fourier tranform and how they can be ued in filtering application. The imulation of analog filter i made eaier by the generation of PSpice circuit decription file that include R-C component value calculated directly from the filter coefficient. In addition, the teting of IIR and FIR filter deigned for audio ignal i enhanced by providing ample ound file that can be filtered by uing the digital filter deign coefficient. Anyone with a ound card on their computer can then play the original and proceed ound file for immediate evaluation. The econd difference between thi book and other i that the text i accompanied by WFilter, a fully functional, Window -baed filter deign oftware package, and the ource code on which it i baed. The CD provide the reader with the ability to intall WFilter with a few imple click of the moue, and alo upplie the reader with the well organied and clearly documented ource code detailing the intricacie of filter deign. No, the ource code provided i not jut a collection of fragmented function, but rather a et of three organied program that have been developed with the addition of an eay-to-ue graphical interface into the organied tructure of WFilter. A baic knowledge of C programming i expected of the reader, but the code preented in the text and the appendixe i thoroughly dicued and well documented. The text doe aume the reader i familiar with the fundamental concept of linear ytem uch a ytem tranfer function and frequency repone although no prior knowledge of filter deign i needed. xi

8 xii Practical Analog and Digital Filter Deign CHAPTER CONTENTS Chapter introduce the reader to the filter deign problem. An overview of WFilter i preented. Chapter develop the normalied tranfer function for the Butterworth, Chebyhev, invere Chebyhev, and elliptic approximation cae. Chapter 3 decribe the converion of the normalied lowpa filter to an unnormalied lowpa, highpa, bandpa, or bandtop filter. In addition, the calculation of the frequency repone for analog filter i dicued. By the end of the third chapter, a complete analog filter deign can be performed. In Chapter 4, the implementation of analog filter i conidered uing popular technique in active filter deign with dicuion of real-world conideration. A PSpice circuit decription file i generated to enable the filter developer to analye the circuit. Chapter 4 complete the dicuion of analog filter in thi book. Chapter 5 begin the dicuion of dicrete-time ytem and digital filter deign in thi book. Several key feature of dicrete-time ytem, including the notion of analog-to-digital converion, Nyquit ampling theorem, the -tranform, and dicrete-time ytem diagram, are reviewed. Similaritie and difference between dicrete-time and continuou-time ytem are dicued. In Chapter 6, digital IIR recurive filter are deigned. Three method of deigning IIR filter are conidered. In addition, the frequency repone calculation and related C code for the IIR filter are developed. Chapter 7 conider digital FIR nonrecurive filter uing a variety of window method and the Park-McClellan optimiation routine. The pecial technique neceary for FIR frequency repone calculation are dicued. The implementation of real-time and nonreal-time digital FIR and IIR filter i dicued in Chapter 8. Implementation iue uch a which type of digital filter to ue, accuracy of quantied ample, fixed or floating point proceing, and finite regiter length computation are dicued. The reader can then hear the effect of filtering by replaying the original and proceed ound file on a ound card. Chapter 9 complete the text with an introduction of the dicrete Fourier tranform and the more efficient fat Fourier tranform FFT. The reader will learn how to ue the FFT in filtering application and ee the code neceary for thi operation. For thoe reader who deire filter deign reference or further detail of the C code for the deign of analog and digital filter, nine eparate appendixe provide that added information. ACKNOWLEDGMENTS I would not have been able to complete thi book without the help and upport of a number of people. Firt, I thank the reviewer of thi text who provided many helpful comment, both in the initial and final tage of development. In particular I want to thank Walter A. Serdijn of Delft Univerity of Technology, The Netherland.

9 Preface xiii I alo thank the friendly people at Artech Houe, Inc. who have provided me with o much help. Thi book could not have been written without their profeional guidance throughout the publication proce. I alo thank Ohio Northern Univerity and the Department of Electrical & Computer Engineering and Computer Science for their upport. And finally, I thank my wife Diane for all of her encouragement and for the many hour of proofreading a econd text that made no ene to her! TRADEMARKS Window i a regitered trademark of Microoft Corp.

10 Chapter Introduction to Filter and Filter Deign Software Everyone ha probably come in contact with one type of filter or another in their lifetime. Maybe it wa a coffee filter ued to eparate the ground from the liquid, or perhap an oil filter to remove contaminant from the oil of an engine. Anyone working in an office often filter the unimportant work from the important. In eence then the act of filtering i the act of eparating deired item from undeired item. Of coure when we dicu filter in thi text, we are not talking about coffee, oil, or paperwork, but rather electronic ignal. The electronic filter we will be deigning will eparate the deirable ignal frequencie from the undeirable, or in other application imply change the frequency content which then change the ignal waveform. There are many type of electronic filter and many way that they can be claified. A filter' frequency electivity i probably the mot common method of claification. A filter can have a lowpa, highpa, bandpa, or bandtop repone, where each name indicate how a band of frequencie i affected. For example, a lowpa filter would pa low frequencie with little attenuation reduction in amplitude, while high frequencie would be ignificantly reduced. A bandtop filter would everely attenuate a middle band of frequencie while paing frequencie above and below the attenuated frequencie. Filter electivity will be the focu of the firt ection in thi chapter. Filter can alo be decribed by the method ued to approximate the ideal filter. Some approximation method emphaie low ditortion in the paband of the filter while other tre the ability of the filter to attenuate the ignal in the topband. Each approximation method ha viible characteritic that ditinguih it from the other. Mot notably, the abence or preence of ripple variation in the paband and topband clearly et one approximation method apart from another. Filter approximation method will be dicued in further detail in the econd ection.

11 Practical Analog and Digital Filter Deign Another mean of claifying filter i by the implementation method ued. Some filter will be built to filter analog ignal uing individual component mounted on circuit board, while other filter might imply be part of a larger digital ytem which ha other function a well. Several implementation method will be decribed in the third ection of thi chapter a well a the difference between analog and digital ignal. However, it hould be noted that digital filter deign and implementation will be conidered in detail tarting in Chapter 5, while the firt four chapter concentrate on filter approximation theory and analog filter implementation. In the final ection of thi chapter we dicu WFilter, an analog and digital filter deign package for Window, which i included on the oftware dik. WFilter determine the tranfer function coefficient neceary for analog filter or for digital FIR or IIR filter. After the filter ha been deigned, the uer can view the pole-ero plot, a well a the magnitude and phae repone. The filter deign parameter or the frequency repone parameter can alo be edited for eae of ue. In addition, for analog filter, the Spice circuit file can be generated to aid in the analyi of active filter. After digital filter have been deigned, they may be ued to filter wave file and the reult can be played for comparion a ound card mut be preent. Further dicuion of WFilter and the C code upplied with thi text can be found in Appendix B.. FILTER SELECTIVITY A indicated earlier, a filter primary purpoe i to differentiate between different band of frequencie, and therefore frequency electivity i the mot common method of claifying filter. Name uch a lowpa, highpa, bandpa, and bandtop are ued to categorie filter, but it take more than a name to completely decribe a filter. In mot cae a precie et of pecification i required in order to allow the proper deign of a filter. There are two primary et of pecification neceary to completely define a filter' repone, and each of thee can be provided in different way. The frequency pecification ued to decribe the paband and topband could be provided in hert H or in radian/econd rad/ec. We will ue the frequency variable f meaured in hert a filter input and output pecification becaue it i a lightly more common way of dicuing frequency. However, the frequency variable ω meaured in radian/econd will alo be ued a WFilter internal variable of choice a well a for unnormalied frequency repone ince mot of thoe calculation will ue radian/econd. The other major filter pecification are the gain characteritic of the paband and topband of the filter repone. A filter' gain i imply the ratio of the output ignal level to the input ignal level. If the filter' gain i greater than, then the output ignal i larger than the input ignal, while if the gain i le than, the output i maller than the input. In mot filter application, the gain

12 Introduction to Filter and Filter Deign Software 3 repone in the topband i very mall. For thi reaon, the gain i typically converted to decibel db a indicated in.. For example, a filter' paband gain repone could be pecified a or a db, while the topband gain might be pecified a or 80.0 db. gain db 0loggain. A we can ee, the value in decibel are more manageable for very mall gain. Some filter deigner prefer to ue attenuation or lo value intead of gain value. Attenuation i imply the invere of gain. For example, a filter with a gain of / at a particular frequency would have an attenuation of at that frequency. If we expre attenuation in decibel we will find that it i imply the negative of the gain in decibel a indicated in.. Gain value expreed in decibel will be the tandard quantitie ued a filter pecification, although the term attenuation or lo will be ued occaionally when appropriate. attn db 0loggain 0loggain gain db... Lowpa Filter Figure. how a typical lowpa filter repone uing frequency and gain pecification neceary for preciion filter deign. The frequency range of the filter pecification ha been divided into three area. The paband extend from ero frequency dc to the paband edge frequency f pa, and the topband extend from the topband edge frequency f top to infinity. We will ee later in thi text that digital filter have a finite upper frequency limit. We will dicu that iue at the appropriate time. Thee two band are eparated by the tranition band that extend from f pa to f top. The filter repone within the paband i allowed to vary between 0 db and the paband gain a pa, while the gain in the topband can vary between the topband gain a top and negative infinity. The 0 db gain in the paband relate to a gain of.0, while the gain of negative infinity in the topband relate to a gain of 0.0. A lowpa filter' electivity can now be pecified with only four parameter: the paband gain a pa, the topband gain a top, the paband edge frequency f pa, and the topband edge frequency f top. Lowpa filter are ued whenever it i important to limit the high-frequency content of a ignal. For example, if an old audiotape ha a lot of high-frequency hi, a lowpa filter with a paband edge frequency of 8 kh could be ued to eliminate much of the hi. Of coure, it alo eliminate high frequencie that were intended to be reproduced. We hould remember that any filter can differentiate only between band of frequencie, not between information and noie.

13 4 Practical Analog and Digital Filter Deign Figure. Lowpa filter pecification... Highpa Filter A highpa filter can be pecified a hown in Figure.. Note that in thi cae the paband extend from f pa to infinity for analog filter and i located at a higher frequency than the topband which extend from ero to f top. The tranition band till eparate the paband and topband. The paband gain i till pecified a a pa db and the topband gain i till pecified a a top db. Figure. Highpa filter pecification. Highpa filter are ued when it i important to eliminate low frequencie from a ignal. For example, when turntable are ued to play LP record ome reader may remember thoe black vinyl dik that would warp in a car' back window, turntable rumble can ometime occur, producing ditracting low-

14 Introduction to Filter and Filter Deign Software 5 frequency ignal. A highpa filter et to a paband edge frequency of 00 H could help to eliminate thi ditracting ignal...3 Bandpa Filter The filter pecification for a bandpa filter hown in Figure.3 require a bit more decription. A bandpa filter will pa a band of frequencie while attenuating frequencie above or below that band. In thi cae the paband exit between the lower paband edge frequency f pa and the upper paband edge frequency f pa. A bandpa filter ha two topband. The lower topband extend from ero to f top, while the upper topband extend from f top to infinity for analog filter. Within the paband, there i a ingle paband gain parameter a pa in decibel. However, individual parameter for the lower topband gain a top db and the upper topband gain a top db could be ued if neceary. Figure.3 Bandpa filter pecification. A good example for the application of a bandpa filter i the proceing of voice ignal. The normal human voice ha a frequency content located primarily in the range of 300 3,000 H. Therefore, the frequency repone for any ytem deigned to pa primarily voice ignal hould contain the input ignal to that frequency range. In thi cae, f pa would be 300 H and f pa would be 3,000 H. The topband edge frequencie would be elected by how fat we would want the ignal repone to roll off above and below the paband...4 Bandtop Filter The final type of filter to be dicued in thi ection i the bandtop filter a hown in Figure.4. In thi cae the band of frequencie being rejected i located between the two paband. The topband exit between the lower topband edge frequency f top and the upper topband edge frequency f top. The bandtop filter

15 6 Practical Analog and Digital Filter Deign ha two paband. The lower paband extend from ero to f pa, while the upper paband extend from f pa to infinity for analog filter. Within the topband, the ingle topband gain parameter a top i ued. However, individual gain parameter for the lower and upper paband, a pa and a pa in db repectively, could be ued if neceary. Figure.4 Bandtop filter pecification. An excellent example of a bandtop application would be a 60-H notch filter ued in enitive meaurement equipment. Mot electronic meaurement equipment today run from an AC power ource uing a 60-H input frequency. However, it i not uncommon for ome of the 60-H ignal to make it way into the enitive meaurement area of the equipment. In order to eliminate thi troubleome frequency, a bandtop filter ometime called a notch filter in thee application could be ued with f top et to 58 H and f top et to 6 H. The paband edge frequencie could be adjuted baed on the other technical requirement of the filter.. FILTER APPROXIMATION The repone of an ideal lowpa filter i hown in Figure.5, where all frequencie from 0 to f o are paed with a gain of, and all frequencie above f o are completely attenuated gain 0. Thi type of filter repone i phyically unattainable. Practical filter repone that can be attained are alo hown. A a filter' repone become cloer and cloer to the ideal, the cot of the filter time delay, number of element, dollar, power conumption, etc. will increae. Thee practical repone are referred to a approximation to the ideal. There are a variety of way to approximate an ideal repone baed on different criteria. For example, ome deign may emphaie the need for minimum ditortion of the ignal in the paband and would be willing to trade off topband attenuation for

16 Introduction to Filter and Filter Deign Software 7 that feature. Other deign may need the fatet tranition from paband to topband and will allow more ditortion in the paband to accomplih that aim. It i thi engineering tradeoff that make the deign of filter o intereting. Figure.5 Practical and ideal filter repone. We will be dicuing the primary approximation function ued in filter deign today that can be claified both by name and the preence of ripple or variation in the ignal band. Elliptic or Cauer filter approximation provide the fatet tranition between paband and topband of any tudied in thi text. An illutration of the magnitude repone of an elliptic filter i hown in Figure., where we can ee that ripple exit in both the paband and topband. What i not hown in that figure i the phae ditortion that the elliptic filter generate. If the filter i to be ued with audio ignal, thi phae ditortion mut uually be corrected. However, in other application, for example the tranmiion of data, the elliptic filter i a popular choice becaue of it excellent electivity characteritic. The elliptic approximation i alo one of the more complicated to develop. We will dicu all approximation method in detail in Chapter. The invere Chebyhev repone i another popular approximation method that ha a mooth repone in the paband, but variation in the topband. On the other hand, the normal Chebyhev repone ha ripple in the paband, but a mooth, ever-decreaing gain in the topband. The phae ditortion produced by thee filter i not a evere a for the elliptic filter, and they are typically eaier to deign. The invere Chebyhev repone i hown in Figure., and the normal Chebyhev repone i illutrated in Figure.3. The Chebyhev approximation provide a good compromie between the elliptic and Butterworth approximation. The Butterworth filter i a claic filter approximation that ha a mooth repone in both the paband and topband a hown in Figure.4. It provide the mot linear phae repone of any approximation technique dicued in thi text. The Beel approximation provide better phae characteritic, but ha very poor tranition band characteritic. However, a we will ee in Chapter, a

17 8 Practical Analog and Digital Filter Deign Butterworth filter will require a much higher order to match the tranition band characteritic of a Chebyhev or elliptic filter..3 FILTER IMPLEMENTATION After a filter ha been completely pecified, variou numerical coefficient can be calculated a decribed in Chapter. But after all the paperwork ha been completed, the filter till ha to be placed into operation. The firt major deciion i whether to ue analog or digital technology to implement the filter. The difference between analog and digital filter deign are baed primarily on the difference between analog and digital ignal themelve. Any ignal can be repreented in the time domain by plotting it amplitude veru time. However, the amplitude and time variation can be either continuou or dicrete. If both the amplitude and time variation are continuou a hown in Figure.6, the ignal i referred to a an analog ignal. Mot real-life ignal are analog in nature; for example, ound that we hear, electrocardiogram ignal recorded in a medical lab, and eimic variation recorded on monitoring equipment. However, the problem with analog ignal i that they contain o much information. The exact amplitude of the ignal with infinite preciion i available at every intant of time. Do we actually need all of that information? And how do we tore and tranfer that information? Figure.6 Comparion of analog and digital ignal. A technique for the torage and tranmiion of information in digital form are becoming more efficient and cot effective, it i increaingly advantageou to ue ignal that are in a digital form. The advantage of uing the reulting digital ignal i that the amount of information can be managed to a level appropriate for each application. An analog ignal can be converted to a digital ignal in two tep. Firt, the ignal mut be ampled at fixed time interval, and then the

18 Introduction to Filter and Filter Deign Software 9 amplitude of the ignal mut be quantied to one of a et of fixed level. Once the analog ignal ha been converted to a dicrete-time and dicrete-amplitude ignal it i commonly referred to a a digital ignal a hown in Figure.6. The operation of ampling and quantiing i accomplihed by an analog-to-digital converter ADC. After filtering the ignal in the digital domain, a digital-to-analog converter DAC can be ued to return the ignal to analog form. A more complete dicuion of thee operation will be given in Chapter 5 where digital filter deign i introduced and in Chapter 8 where practical conideration of digital filter implementation are dicued. Today the digital image and ound file on computer a well a the muic on compact dic are example of ignal in digital form. If we chooe to implement a filter in analog form, we till have further choice to make. We could chooe to implement the filter with purely paive component uch a reitor, capacitor, and inductor. Thi approach might be the bet choice when high frequencie or high power i ued. In other circumtance, analog active filter might be the bet choice where either tranitor or operational amplifier are ued to provide a gain element in the filter. The implementation of analog active filter i conidered in Chapter 4. Digital filter will be implemented by uing digital technology available today. Generally, the proce will take place within a microproceor ytem that could have other function beide the filtering of ignal. We dicu two baic type of digital filter in Chapter 6 and 7 of thi text. The firt i the infinite impule repone IIR digital filter that i baed in a large part on the deign methodology of analog filter. The econd type i the finite impule repone FIR digital filter that ue a completely different method for it deign. The implementation of digital filter i conidered in Chapter 8. Chapter 9 introduce the fat Fourier tranform FFT and dicue how it can be ued in filtering. A we can now ee, there i more to decribing a filter than referring to it a a lowpa filter. For example, we might be deigning an analog active lowpa Butterworth filter or a digital IIR bandpa Chebyhev filter. Thee name along with a filter' pecification parameter will completely decribe a filter..4 WFILTER - FILTER DESIGN SOFTWARE Although we haven t dicued filter deign in detail, it may be educational to ee how to ue a filter deign oftware package. Thi book include a filter deign oftware package called WFilter that automate the deign proce and provide filter coefficient and frequency repone characteritic for the filter, and other feature a well. A a firt example, we will chooe an analog lowpa Chebyhev filter with paband and topband gain of db and 30 db, repectively. The paband and topband edge frequencie will be 500 H and,000 H and the data file and frequency plot will be labeled with the title Lowpa Chebyhev Filter. You will need to intall WFilter on your computer before you can

19 0 Practical Analog and Digital Filter Deign duplicate the action decribed below. Pleae ee Appendix B for content of the accompanying dic and intallation intruction for WFilter. After tarting WFilter, you can begin the deign of a new filter by electing New from the File menu bar a hown in Figure.7. You can alo Open a previouly deigned filter or eek Help from thi tartup creen. Figure.7 WFilter opening creen. After electing New, you will be able to elect the type of filter you want to deign and pecify a decription a indicated earlier. The Filter Specification dialog box hown in Figure.8 include ection for the different characteritic of the filter, a well a ampling frequency for digital filter only and a filter title. Figure.8 Filter Specification dialog box. After electing the characteritic of the filter, you can elect Next and the Lowpa Specification dialog box hown in Figure.9 will appear, allowing you to pecify the gain and frequency characteritic. For a lowpa filter you mut

20 Introduction to Filter and Filter Deign Software enter the paband gain and edge frequency a well a the topband gain and edge frequency a pecified in our ample filter. You then have the option of deigning the filter or returning to the previou dialog box to make change. At each tage of thi proce you can cancel your action or eek help determining proper action. Figure.9 Lowpa Specification dialog box. After completing the pecification, you can elect Deign Filter and the following information will be diplayed in the Filter Parameter text window a hown in Figure.0. Pole-ero information will alo be diplayed, but i not hown in thi example. A indicated, our filter will be fourth-order length i a term ued with digital FIR filter and will have an overall gain a indicated. The coefficient of the tranfer function are given in the form of quadratic. Detail concerning thee value will be dicued in the next chapter. Lowpa Chebyhev Filter Selectivity: Lowpa Approximation: Chebyhev Implementation: Analog Paband gain db: -.0 Stopband gain db: Paband freq H: Stopband freq H: Filter Length/Order: 04 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E06 Denominator Coefficient QD [S^ S ] E E E E06 Figure.0 Filter Characteritic creen.

21 Practical Analog and Digital Filter Deign We can now diplay the frequency repone of our filter by electing Magnitude Repone from the View menu. A indicated in the Repone Specification dialog box hown in Figure., the uer can pecify frequency limit of the diplay a well a the magnitude range. Both the frequency and magnitude axe can be caled in a linear or logarithmic fahion. WFilter initialie the value with educated guee that can be changed by the uer. Figure. Repone Specification dialog box. Selecting Diplay Repone will bring up the graphic plot of the magnitude and phae repone. Thee graph are hown in Figure. and.3. Notice that on the phae plot, the phae angle i alway diplayed a a value between 80 and 80 degree. Therefore there i actually no dicontinuity in the phae plot. Figure. Magnitude repone creen.

22 Introduction to Filter and Filter Deign Software 3 Figure.3 Phae repone creen. In addition, for analog and digital IIR filter, the pole-ero poition for a filter can be diplayed by electing Pole-Zero Plot from the View menu. The ignificance of pole and ero will be dicued in the next chapter. The poleero plot for our filter i hown in Figure.4. Figure.4 Pole-ero plot. Any or all of the information provided by WFilter can be printed by electing Print from the File menu. The Print dialog box a hown in Figure.5 will be diplayed and the uer can chooe from everal option for printing. The detail of thi filter deign can now be aved by electing Save or Save A from the File menu. After aving the information, you can exit the program by electing Exit from the File menu. Further detail about the WFilter program will

23 4 Practical Analog and Digital Filter Deign be preented in the chapter to come. We will have many more chance to ue thi program a we develop the theory behind analog and digital filter deign. Figure.5 Print dialog box..5 CONCLUSION At thi point we have provided an introduction to filter deign by providing the tandard definition ued to decribe filter. We have alo introduced WFilter, a powerful filter deign oftware package. But we till need to learn the theory behind filter deign and how we can deign and implement the filter. We ll begin in the next chapter to tudy the deign of analog filter. For thoe intereted in the C code ued in the deign and implementation of filter, pleae refer to Appendix C I.

24 Chapter Analog Filter Approximation Function A indicated in the firt chapter, an ideal filter i unattainable; the bet we can do i to approximate it. There are a number of approximation we can ue baed on how we want to define bet. In thi chapter we dicu four method of approximation, each uing a lightly different definition. Four ection are devoted to the major approximation method ued in analog filter deign: the Butterworth, Chebyhev, invere Chebyhev, and elliptic approximation. In each of thee ection we determine the order of the filter required given the filter pecification and the required normalied tranfer function to atify the pecification. In the following ection we dicu the relative advantage and diadvantage of uing thee approximation method. But firt we begin thi chapter by decribing analog filter mathematically in the form of linear ytem tranfer function.. FILTER TRANSFER FUNCTIONS An analog filter i a linear ytem that ha an input and output ignal. Thi ytem primary purpoe i to change the frequency repone characteritic of the input ignal a it move through the filter. The characteritic of thi filter ytem could be tudied in the time domain or the frequency domain. From a ytem point of view, the impule repone ht could be ued to decribe the ytem in the time domain. The impule repone of a ytem i the output of a ytem that ha had an impule applied to the input. Of coure, many ytem would not be able to utain an infinite pike the impule being applied to the input of the ytem, but there are way to determine ht without actually applying the impule. A filter ytem can alo be decribed in the frequency domain by uing the tranfer function H. The tranfer function of the ytem can be determined by finding the Laplace tranform of ht. Figure. indicate that the filter ytem can be conidered either in the time domain or in the frequency domain. However, 5

25 6 Practical Analog and Digital Filter Deign the tranfer function decription i the predominant method ued in filter deign, and we will perform mot of our filter deign uing it. Figure. The filter a a ytem... Tranfer Function Characteriation The tranfer function H for a filter ytem can be characteried in a number of way. A hown in., H i typically repreented a the ratio of two polynomial in where in thi cae the numerator polynomial i order m and the denominator i a polynomial of order n. G repreent an overall gain contant that can take on any value. ] [ ] [ 0 0 b b b b a a a a G H n n n n n m m m m m. Alternately, the polynomial can be factored to give a form a hown in.. In thi repreentation, the numerator and denominator polynomial have been eparated into firt-order factor. The repreent the root of the numerator and are referred to a the ero of the tranfer function. Similarly, the p repreent the root of the denominator and are referred to a the pole of the tranfer function. ] [ ] [ 0 0 n n m m p p p p G H. Mot of the pole and ero in filter deign will be complex valued and will occur a complex conjugate pair. In thi cae, it will be more convenient to repreent the tranfer function a a ratio of quadratic term that combine the individual complex conjugate factor a hown in.3. The firt-order factor that are included will be preent only if the numerator or denominator polynomial order are odd. We will be uing thi form for mot of the analog filter deign material. ] [ ] [ r r q q b b b b p a a a a G H.3

26 Analog Filter Approximation Function 7 A an example of each expreion, conider the three form of a tranfer function that have a econd-order numerator and third-order denominator: H a.4a H b 6.0 j j b j j H c.4c Pole-Zero Plot and Tranfer Function When the quadratic form of the tranfer function i ued, it i eay to generate the pole-ero plot for a particular tranfer function. The pole-ero plot imply plot the root of the numerator ero and the denominator pole on the complex - plane. A an example, the pole-ero plot for the ample tranfer function given in.4 i hown in Figure.. Figure. Pole-ero plot for.4. A pole i traditionally repreented by an X and a ero by an O. If the tranfer function i odd, the firt-order pole or ero will be located on the real axi. All pole and ero from the quadratic factor are ymmetrically located pair in the complex plane on oppoite ide of the real axi. The gain of the tranfer function

27 8 Practical Analog and Digital Filter Deign mut be indicated on the plot or the information would be incomplete. Note that there are only two ero hown, but there i one located at infinity. We can verify thi by oberving that if we were to allow to approach infinity, H would approach ero. Tranfer function alway have the ame number of pole and ero, but ome exit at infinity. Converely, we can alo determine a filter tranfer function from the poleero plot. In general, any critical frequency pole or ero i pecified by indicating the real σ and imaginary ω component. The tranfer function would then include a factor of [ σ jω]. If the critical frequency i complex, we can combine the two complex conjugate factor into a ingle quadratic factor by multiplying them a hown in.5: [ σ jω] [ σ jω] σ σ ω.5 Example. Generating a Tranfer Function from a Pole-Zero Plot Problem: Aume that a pole-ero plot how pole at 3 ± j and 4.5 and ero at 5 ± j and. Determine the tranfer function if it gain i.0 at 0. Solution: Uing the technique of.5, the complex conjugate pole and ero can be combined into quadratic factor a indicated. The firt-order factor are handled directly and the gain i included in the numerator. The eaiet method to ue when given a gain requirement of.0 at 0 i to prepare each factor independently to have a gain of at that frequency a hown in the firt tranfer function. Then the et of contant can be combined a hown in the econd equation. H Normalied Tranfer Function In thi chapter we concentrate on developing what i referred to a a normalied tranfer function. A normalied lowpa tranfer function i one in which the paband edge radian frequency i et to rad/ec. Of coure, thi eem a rather unuual frequency, ince eldom would a lowpa filter be required to have uch a low frequency. However, the technique actually allow the filter deigner coniderable latitude in deigning filter becaue a normalied tranfer function

28 Analog Filter Approximation Function 9 can eaily be unnormalied to any other frequency. In the next chapter, we will dicu in detail the procedure ued to unnormalie lowpa filter to other frequencie and even learn how to tranlate a lowpa filter to a highpa, bandpa, or bandtop filter. Before we begin the development of the approximation function for analog filter, it may be helpful to go over the general approach taken in thee ection. In each cae, the general characteritic of the approximation method will be dicued, including it relative advantage and diadvantage. Next, a decription of the tranfer function for each approximation will be given. There will be no attempt to give an exhautive derivation of each approximation method in thi text; there are more than enough ource of theoretical development already available. A lit of reference for material preented in thi chapter i given in Appendix A. The text by Daniel, Van Valkenburg, and Park/Burru are particularly helpful when tudying approximation theory. We will then determine numerical method to find the order and the coefficient of the tranfer function neceary to meet the filter pecification.. BUTTERWORTH NORMALIZED APPROXIMATION FUNCTIONS The Butterworth approximation function i often called the maximally flat repone becaue no other approximation ha a moother tranition through the paband to the topband. The phae repone alo i very mooth, which i important when conidering ditortion. The lowpa Butterworth polynomial ha an all-pole tranfer function with no finite ero preent. It i the approximation method of choice when low phae ditortion and moderate electivity are required... Butterworth Magnitude Repone Equation.6 give the Butterworth approximation magnitude repone where ω o i the paband edge frequency for the filter, n i the order of the approximation function, and ε i the paband gain adjutment factor. The tranfer function will carry ubcript to help identify them in thi chapter. In thi cae, the ubcript B indicate a Butterworth filter, and n indicate an nth-order tranfer function. where H B, n [ j ω / ωo ].6 ε ω / ω n o 0.a pa ε 0.7

29 0 Practical Analog and Digital Filter Deign If we et both ε and ω o, the filter will have a gain of / or 3.0 db at the normalied paband edge frequency of rad/ec. The Butterworth approximation ha a number of intereting propertie. Firt, the repone will alway have unity gain at ω 0, no matter what value i given to ε. However, the gain at the normalied paband edge frequency of ω will depend on the value of ε. In addition, the repone gain decreae by a factor of 0n db per decade of frequency change. That happen becaue for large ω, the tranfer function gain become inverely proportional to ω, which increae by 0 for every decade. A decade in frequency i a ratio of 0. For example, the pan of frequencie from to 0 rad/ec and the pan of frequencie from,000 to 0,000 H are both referred to a one decade. Therefore, if we deign a fifth-order Butterworth filter, the gain will decreae 00 db per decade for frequencie above the paband edge frequency... Butterworth Order The order of the Butterworth filter i dependent on the pecification provided by the uer. Thee pecification include the edge frequencie and gain. The tandard formula for the Butterworth order calculation i given in.8. In thi formulation, note that it i the ratio of the topband and paband frequencie which i important, not either one of thee independently. Thi mean that a filter with a given et of gain will require the ame order whether the edge frequencie are 00 and 00 rad/ec or 00,000 and 00,000 H. The value of n calculated uing thi equation mut alway be rounded to the next highet integer in order to guarantee that the pecification will be met by the integer order of the filter deigned: 0.a 0.a pa top log[0 /0 ] n B.8 log ω / ω top pa..3 Butterworth Pole Location The pole for a Butterworth approximation function are equally paced around a circle in the -plane and are ymmetrical about the jω axi. Plotting the pole of the magnitude-quared function H how twice a many pole a the order of the filter. We are able to determine the Butterworth tranfer function from the pole in the left half plane LHP that produce a table ytem. In order to determine the exact pole poition in the -plane we ue the polar form for pecifying the complex location. For each of the pole, we mut know the ditance from the origin the radiu of the circle and the angle from the poitive real axi.

30 Analog Filter Approximation Function The radiu of the circle for our normalied cae i a function of the paband gain and i given in.9: R / ε n.9 Once the radiu of the circle i known, the pole poition are determined by calculating the neceary angle. Equation.0 can be ued to determine the angle for thoe complex pole in the econd quadrant: π m n θ m, m 0,,, n/ n even.0a n π m n θ m, m 0,,,[ n /] n odd.0b n It i important to remember that in thi equation θ m repreent only the angle in the econd quadrant that have complex conjugate in the third quadrant. In other word, θ m doe not include the pole on the real axi for odd-order function. For thi reaon,.0b i valid only for odd-order filter where n 3 ince a firtorder filter would have no complex conjugate pole. We ll ee that thi definition allow a cleaner algorithm for the C code that i dicued in Appendix D. The precie pole location can then be determined from. and.: σ m R co θ m. ω m R in θ m. In the cae of odd-order tranfer function, the firt-order pole will be located at a poition σ R equal to the radiu of the circle a indicated in.3: σ R R.3..4 Butterworth Tranfer Function The Butterworth tranfer function can be determined from the pole location in the LHP a we aw in the firt ection of thi chapter. Since mot of thee pole are complex conjugate pair except for the poible pole on the real axi for odd order, we can get all of the information we need from the pole in the econd quadrant. The complete approximation tranfer function can be determined from a combination of a firt-order factor for odd order and quadratic factor. Each of

31 Practical Analog and Digital Filter Deign thee factor will have a contant in the numerator to adjut the gain to unity at ω 0 a illutrated in Example.. We tart by defining the form of the firt-order factor in.4. Note that at thi point the tranfer function variable are repreented by an uppercae S where prior to thi we have been uing a lowercae. Thi i an attempt to ditinguih between the normalied tranfer function uing S and the unnormalied function uing, which will be developed in the next chapter. R S R S H o.4 For each complex conjugate pole in the econd quadrant, there will be the following quadratic factor in the tranfer function: m m m m B S B S B S H.5 where m m B σ.6.7 m m m B ω σ The complete Butterworth tranfer function can now be defined a hown in.8: even /, 0,,,, n n m B S B S B S H m m m m m n B.8a odd /],[ 0,,,, n n m B S B S R S B R S H m m m m m n B.8b

32 Analog Filter Approximation Function 3 We have now reached a point where ome example are in order. Firt, we will conider ome numerical example, and then tet the WFilter program on the ame pecification. Example. Butterworth Third-Order Normalied Tranfer Function Problem: Determine the order, pole location, and tranfer function coefficient for a Butterworth filter to atify the following pecification: a pa db, a top db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the fundamental contant needed from.7.9: ε n.9 3rd order R.5576 Next, we find the location of the firt-order pole and the complex pole in the econd quadrant from.0.3. A graph of the pole location including thoe from the magnitude-quared function in the right-half plane i hown in Figure.3. t order σ R.5576 ω R 0.0 θ 0 π/3 σ ω Finally, we generate the tranfer function from.4.8: H B, S S.56 S.56 S.5689 Figure.3 Pole location for third-order Butterworth normalied filter.

33 4 Practical Analog and Digital Filter Deign In order to ue WFilter to determine the normalied tranfer function, we will aume a paband edge frequency of rad/ec H and a topband edge frequency of rad/ec H. We mut enter the frequencie into WFilter uing the hert value and they mut have more ignificant digit than we require in our anwer. Twelve ignificant digit were ued to enter the edge frequencie, but they are diplayed on the coefficient creen with only ten ignificant digit. Ret aured that they are tored internally with the higher accuracy, but the diplay i et for the more typical requirement of filter frequency. The coefficient value determined are hown in Figure.4. Butterworth 3rd-Order Normalied Lowpa Selectivity: Lowpa Approximation: Butterworth Implementation: Analog Paband gain db: -.0 Stopband gain db: -.0 Paband freq H: Stopband freq H: Filter Length/Order: 03 Overall Filter Gain: E00 Numerator Coefficient QD [S^ S ] E E E E00 Denominator Coefficient QD [S^ S ] E E E E00 Figure.4 Butterworth normalied third-order coefficient from WFilter. Example.3 Butterworth Fourth-Order Normalied Tranfer Function Problem: Determine the order, pole location, and tranfer function coefficient for a Butterworth filter to atify the following pecification: a pa db, a top 8 db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the contant needed from.7.9: ε n th order R Next, we find the location of the two complex pole in the econd quadrant from.0.3. A graph of the pole location i hown in Figure.5. θ 0 5π/8 σ ω θ 7π/8 σ ω

34 Analog Filter Approximation Function 5 Finally, we generate the tranfer function from.4.8. The coefficient value determined by WFilter are hown in Figure.6. H B,4 S S S.409 S S.409 Figure.5 Pole location for fourth-order Butterworth normalied filter. Butterworth 4th-Order Normalied Lowpa Selectivity: Lowpa Approximation: Butterworth Implementation: Analog Paband gain db: -.0 Stopband gain db: -8.0 Paband freq H: Stopband freq H: Filter Length/Order: 04 Overall Filter Gain: E00 Numerator Coefficient QD [S^ S ] E E E E00 Denominator Coefficient QD [S^ S ] E E E E00 Figure.6 Butterworth normalied fourth-order coefficient from WFilter.

35 6 Practical Analog and Digital Filter Deign The aociated magnitude and phae repone for the previou two example are hown in Figure.7 and.8 and illutrate the difference between a thirdorder and fourth-order filter. Notice that the magnitude repone ue a different cale for the paband and topband repone. WFilter doe not put two different repone on the ame graph or ue different cale for paband and topband. They are diplayed here in that manner for eae of comparion. However, the magnitude cale of WFilter can be changed on different graph to provide more detail. Figure.7 Butterworth third-order and fourth-order magnitude repone. Figure.8 Butterworth third-order and fourth-order phae repone.

36 Analog Filter Approximation Function 7.3 CHEBYSHEV NORMALIZED APPROXIMATION FUNCTIONS The Chebyhev approximation function alo ha an all-pole tranfer function like the Butterworth approximation. However, unlike the Butterworth cae, the Chebyhev filter allow variation or ripple in the paband of the filter. Thi reduction in the retriction placed on the characteritic of the paband enable the tranition characteritic of the Chebyhev to be teeper than the Butterworth tranition. Becaue of thi more rapid tranition, the Chebyhev filter i able to atify uer pecification with lower-order filter than the Butterworth cae. However, the phae repone i not a linear a the Butterworth cae, and therefore if low phae ditortion i a priority, the Chebyhev approximation may not be the bet choice..3. Chebyhev Magnitude Repone The magnitude repone function for the Chebyhev approximation i hown in.9: H C, n where the definition of ε i again [ j ω / ωo ].9 ε C ω / ω n o 0.a pa ε 0.0 and C n ω i the Chebyhev polynomial of the firt kind of degree n. The normalied Chebyhev polynomial ω o i defined a C n ω co[ n co ω ], ω 0.a C n ω coh[ ncoh ω ], ω > 0.b We can ee that the mathematical decription ued for thi approximation i more involved than the Butterworth cae. We will be concerned with the expreion where ω > 0, but the Chebyhev polynomial ha many intereting feature which are dicued in the reference at the end of thi text.

37 8 Practical Analog and Digital Filter Deign.3. Chebyhev Order The order of the Chebyhev filter will be dependent on the pecification provided by the uer. The general form of the calculation for the order i the ame a for the Butterworth, except that the invere hyperbolic coine function i ued in place of the common logarithm function. A in the Butterworth cae, the value of n actually calculated mut be rounded to the next highet integer in order to guarantee that the pecification will be met. 0.a top 0.a pa coh 0 /0 n C. coh ω / ω top pa.3.3 Chebyhev Pole Location The pole for a Chebyhev approximation function are located on an ellipe intead of a circle a in the Butterworth cae. The ellipe i centered at the origin of the -plane with it major axi along the jω axi with intercept of ± cohd, while the minor axi i along the real axi with intercept of ± inhd. The variable D i defined a inh D ε n.3 The pole location can be defined in term of D and an angle φ a hown in.4. The angle determined locate the pole of the tranfer function in the firt quadrant. However, we can ue them to find the pole in the econd quadrant by imply changing the ign of the real part of each complex pole. The real and imaginary component of the pole location can now be defined a hown in.5 and.6: π m φ m, m 0,,, n/ n even.4a n π m φ m, m 0,,,[ n /] n odd.4b n σ m inh D in φm.5

38 Analog Filter Approximation Function 9 ωm coh D co φm.6 If the function ha an odd-order, there will be a real pole located in the LHP a indicted by.7: σ R inhd Chebyhev Tranfer Function Uing the reult of.7, we know that an odd-order Chebyhev tranfer function will have a factor of the form illutrated in.8: H inh D S o S.8 inh D The quadratic factor for the Chebyhev tranfer function will take on exactly the ame form a the Butterworth cae, a hown below: H m Bm S.9 S B S B m m B m σ m.30 B m σ m ωm.3 We are now jut about ready to define the general form of the Chebyhev tranfer function. However, one mall detail till mut be conidered. Becaue there i ripple in the paband, Chebyhev even and odd-order approximation do not have the ame gain at ω 0. A een in Figure.3 a reult of a future example, each approximation ha a number of half-cycle of ripple in the paband equal to the order of the filter. Thi force even-order filter to have a gain of a pa at ω 0. However, the firt-order and quadratic factor we have defined are all et to give 0 db gain at ω 0. Therefore, if no adjutment of gain i made to even-order Chebyhev approximation, they would have a gain of 0 db at ω 0 and a gain of a pa that i, a gain greater than.0 at certain other frequencie where the ripple peak. A gain contant mut therefore be included for even-order tranfer function with the value of

39 30 Practical Analog and Digital Filter Deign G a pa.3 We are now ready to define a generalied tranfer function for the Chebyhev approximation function a hown below: H C, n 0.05apa 0 B m S S B S B m m m 0,,, n/ n even m m,.33a H C, n inh D S S inh D m S m 0,,,[ n /] n odd m B m B m S B m,.33b It i again time to conider ome numerical example before uing WFilter to determine the filter coefficient. Example.4 Chebyhev Third-Order Normalied Tranfer Function Problem: Determine the order, pole location, and coefficient of the tranfer function for a Chebyhev filter to atify the following pecification: a pa db, a top db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the fundamental contant needed from.0,., and.3: ε n.96 3rd order D cohd.5439 inhd Next, we find the location of the firt-order pole and the complex pole in the econd quadrant from.4.7. A plot of the pole i hown in Figure.9: t order σ R ω R 0.0 φ 0 π/6 σ ω Finally, we generate the tranfer function from The reult from WFilter are hown in Figure.0.

40 H C,3 Analog Filter Approximation Function S S S Figure.9 Pole location for third-order Chebyhev normalied filter. Chebyhev 3rd-Order Normalied Lowpa Selectivity: Lowpa Approximation: Chebyhev Implementation: Analog Paband gain db: -.0 Stopband gain db: -.0 Paband freq H: Stopband freq H: Filter Length/Order: 03 Overall Filter Gain: E00 Numerator Coefficient QD [S^ S ] E E E E-0 Denominator Coefficient QD [S^ S ] E E E E-0 Figure.0 Chebyhev normalied third-order coefficient from WFilter.

41 3 Practical Analog and Digital Filter Deign Example.5 Chebyhev Fourth-Order Normalied Tranfer Function Problem: Determine the order, pole location, and tranfer function coefficient for a Chebyhev filter to atify the following pecification: a pa db, a top 33 db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the fundamental contant needed from.0,., and.3: ε n 3.9 4th order D cohd inhd Next, we find the location of the two complex pole in the econd quadrant from.4.7. A plot of the pole i hown in Figure.. θ 0 π/8 σ ω θ 3π/8 σ ω Finally, we generate the tranfer function from Note that in thi even-order cae, the gain contant of i included. The reult from WFilter for thi Chebyhev pecification are hown in Figure.. H C,4 S S S S S Figure. Pole location for fourth-order Chebyhev normalied filter.

42 Analog Filter Approximation Function 33 The magnitude and phae repone for the third and fourth-order Chebyhev filter are hown in Figure.3 and.4. Chebyhev 4th-Order Normalied Lowpa Selectivity: Lowpa Approximation: Chebyhev Implementation: Analog Paband gain db: -.0 Stopband gain db: Paband freq H: Stopband freq H: Filter Length/Order: 04 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E-0 Denominator Coefficient QD [S^ S ] E E E E-0 Figure. Chebyhev normalied fourth-order coefficient from WFilter. Figure.3 Chebyhev third-order and fourth-order magnitude repone.

43 34 Practical Analog and Digital Filter Deign Figure.4 Chebyhev third-order and fourth-order phae repone..4 INVERSE CHEBYSHEV NORMALIZED APPROXIMATION FUNCTIONS The invere Chebyhev approximation function, alo called the Chebyhev type II function, i a rational approximation with both pole and ero in it tranfer function. Thi approximation ha a mooth, maximally flat repone in the paband, jut a the Butterworth approximation, but ha ripple in the topband caued by the ero of the tranfer function. The invere Chebyhev approximation provide better tranition characteritic than the Butterworth filter and better phae repone than the tandard Chebyhev. Although the invere Chebyhev ha thee feature to recommend it to the filter deigner, it i more involved to deign..4. Invere Chebyhev Magnitude Repone The development of the invere Chebyhev repone i derived from the tandard Chebyhev repone. We will dicu the method needed to determine the invere Chebyhev approximation function while leaving the intricate detail to the reference work. The name invere Chebyhev i well-deerved in thi cae ince we will ee that many of the computation are baed on invere or reciprocal value from the tandard computation. Let begin with the definition of the magnitude frequency repone function a hown in.34. The firt obervation concerning.34 i that it indeed ha a numerator portion that allow for the finite ero in the tranfer function. Upon cloer inpection, we find the ue of ε i in place of ε. Equation.35 indicate ε i, the

44 Analog Filter Approximation Function 35 invere of ε, where a pa i replaced with a top. Becaue of the difference, we will ue the ubcript to ditinguih ε i from the tandard ε. Although C n till repreent the Chebyhev polynomial of the firt kind of degree n a defined in., we notice that the argument of the function i the invere of the tandard definition ω o /ω intead of ω/ω o. We will ee a little later in thi ection how thee difference affect our determination of the pole and ero of the tranfer function. H I, n [ j ω / ω ] o ε i Cn ωo / ω.34 ε C ω / ω i n o where ε i.35 0.a top 0.4. Invere Chebyhev Order Becaue of the nature of the derivation of the invere Chebyhev approximation function from the tandard Chebyhev approximation, it hould come a no urprie that the calculation of the order for an invere Chebyhev i the ame a for the tandard Chebyhev. The expreion i given in.36 and i the ame a. except for the ubcript I deignating the calculation a the invere Chebyhev order: 0.a top 0.a pa coh 0 /0 n I.36 coh ω / ω top pa.4.3 Invere Chebyhev Pole-Zero Location The determination of the pole location for the normalied invere Chebyhev approximation i baed on technique imilar to thoe ued for the tandard normalied Chebyhev approximation. The pole poition for the invere Chebyhev cae are found uing the ame value of φ m, but the value of ε i i calculated differently. Once the pole poition are found, however, the invere Chebyhev pole are the reciprocal of the tandard pole. There that invere relationhip again. For example, if there exit a tandard Chebyhev pole at p σ jω.37

45 36 Practical Analog and Digital Filter Deign then the reciprocal of p give the invere Chebyhev pole poition a σ jω σ ω p j.38 σ jω σ jω σ ω σ ω Notice that if a pole ditance from the origin i greater than one, the reciprocal ditance will be le than one, and vice vera. In addition, the poition of the pole i reflected acro the real axi, o although the original pole poition may be in the econd quadrant, the reciprocal i located in the third quadrant. Conequently, if we are able to determine pole poition for the tandard Chebyhev approximation function a dicued in the previou ection, we hould have little problem finding the invere Chebyhev pole location. Let derive the mathematical equation neceary to determine the pole location for the invere Chebyhev approximation function along the ame line a we did for the tandard Chebyhev cae. Firt, D i will be defined in term of ε i in.39. D i inh ε i n.39 Next, we can define the pole location in the econd quadrant in the manner of the previou ection a hown in.40.4, remembering that thee primed value mut till be inverted. σ m inh Di in φm.40 ωm coh Di co φm.4 π m φ m, m 0,,, n/ n even.4a n π m φ m, m 0,,,[ n /] n odd.4b n We can determine the final pole location by inverting thee pole a indicated in.43 and.44: σ σ m.43 σ ω m m m

46 Analog Filter Approximation Function 37 ω m ω.44 σ m m ωm If the approximation function i odd-order, then there will be a firt-order pole on the negative real axi at σ R a defined in.45: σ R [inh D ] i.45 Next, we need to determine the placement of the finite ero of the invere Chebyhev approximation function, which are all purely imaginary complex conjugate pair located on the jω axi. Becaue they only occur in pair, the numerator of an invere Chebyhev tranfer function will alway be even. If the order of the denominator i odd, then one ero of the tranfer function will be located at infinity. The location of the ero on the jω axi i determined by.46 and.47, where φ m i a defined in.4. A i ued in the ubcript to differentiate the ero location from the pole location. By the way, did you notice that the ecant function in.47 i the reciprocal of the coine function ued in the tandard Chebyhev function? σ m ω ec φ m.47 m.4.4 Invere Chebyhev Tranfer Function Now that we have located the neceary pole and ero that are pertinent to the definition of the invere Chebyhev approximation, we can define the variou factor that decribe the tranfer function. Firt, for odd-order approximation,.48 decribe the firt-order factor: [inh Di ] H o S.48 S [inh D ] Next, the quadratic component of the tranfer function are decribed in Thee are imilar to the quadratic definition for the Chebyhev cae, but we have added a numerator quadratic for the ero a well. H m i Bm S A m S Am S.49 A S B S B m m m

47 38 Practical Analog and Digital Filter Deign where m m B σ.50.5 m m m B ω σ 0.0 m m A σ.5.53 m m m m A ω ω σ Although the value of A m i ero, it i included to be conitent with the format ued throughout the remainder of the text. We are now ready to define the generalied tranfer function form for the invere Chebyhev approximation function hown in.54. Since the invere Chebyhev ha a maximally flat repone in the paband a the Butterworth, there i no need for a gain adjutment contant a in the tandard Chebyhev cae. even /, 0,,,, n n m B S B S A A S A S B S H m m m m m m m m m m n I.54a odd /],[ 0,,, ] [inh ] [inh, n n m B S B S A D S A S A S B D S H m m m m m i m m m m m i n I.54b The following numerical example hould help to illutrate the proce. Example.6 Invere Chebyhev Third-Order Normalied Tranfer Function Problem: Determine the order, pole and ero location, and tranfer function coefficient for an invere Chebyhev filter to atify the following pecification: a pa db, a top db, ω pa rad/ec, and ω top rad/ec

48 Analog Filter Approximation Function 39 Solution: Firt, we determine the fundamental contant needed from.35,.36, and.39: ε i n.96 3rd order D i cohd i inhd i.9406 Next, we find the location of the firt-order pole, the complex pole in the econd quadrant, and the econd-order ero on the jω axi from A pole-ero plot i hown in Figure.5. t order σ R ω R 0.0 φ 0 π/6 σ ω σ ω ero σ ω Finally, we generate the tranfer function from.48.54: * H I S.3333 S,.3333 S S S H I, S S S.5456 S.0675 S.6498 Figure.5 Pole and ero location for third-order invere Chebyhev filter. There i a problem with the firt tranfer function above hown with an aterik *. It implement an invere Chebyhev approximation function that i normalied to ω top rad/ec intead of ω pa rad/ec. Thi mean that ω pa

49 40 Practical Analog and Digital Filter Deign would be at 0.5 rad/ec. Therefore the entire frequency repone i a factor of too low. The attenuation at ω 0.5 rad/ec i ~ db and the attenuation at ω rad/ec i ~ db. The proce we ue to correct the problem i actually an unnormaliation procedure that i covered in Chapter 3. Thi unnormaliation will uually occur a part of the total filter deign proce, but we can make the adjutment manually in thi particular cae. The correct tranfer function can be determined by ubtituting S/ for S and then implifying a indicated in the econd tranfer function above. Thi proce i mentioned here o we undertand the WFilter coefficient, which are hown in Figure.6. Inv. Chebyhev 3rd-Order Normal. Lowpa Selectivity: Lowpa Approximation: Inv. Chebyhev Implementation: Analog Paband gain db: -.0 Stopband gain db: -.0 Paband freq H: Stopband freq H: Filter Length/Order: 03 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E00 Denominator Coefficient QD [S^ S ] E E E E00 Figure.6 Invere Chebyhev normalied third-order coefficient from WFilter. Example.7 Invere Chebyhev Fourth-Order Normalied Tranfer Function Problem: Determine the order, pole and ero location, and tranfer function coefficient for an invere Chebyhev filter to atify the following pecification: a pa db, a top 33 db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the fundamental contant needed from.35,.36, and.39: ε i n 3.9 4th order D i.307 cohd i inhd i.37450

50 Analog Filter Approximation Function 4 Next, we find the location of the two complex pole in the econd quadrant and the econd-order ero from A pole-ero plot i hown in Figure.7. φ 0 π/8 σ ω σ ω φ 0 3π/8 σ ω σ ω Zero σ ω Zero σ 0.0 ω.636 Finally, we generate the tranfer function from Refer to Example.6 for an explanation of the two tranfer function. The WFilter coefficient are hown in Figure.8. * H I S.76 S S, S S S.476 S H I,4 S S S S S.4584 S S.9649 Figure.7 Pole and ero location for fourth-order invere Chebyhev filter.

51 4 Practical Analog and Digital Filter Deign Inv. Chebyhev 4th-Order Normal. Lowpa Selectivity: Lowpa Approximation: Inv. Chebyhev Implementation: Analog Paband gain db: -.0 Stopband gain db: Paband freq H: Stopband freq H: Filter Length/Order: 04 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E0 Denominator Coefficient QD [S^ S ] E E E E00 Figure.8 Invere Chebyhev normalied fourth-order coefficient. The magnitude and phae repone for the two invere Chebyhev example are preented in Figure.9 and.0. The ame procedure wa ued a in the Butterworth and Chebyhev cae. Figure.9 Invere Chebyhev third-order and fourth-order magnitude repone.

52 Analog Filter Approximation Function 43 Figure.0 Invere Chebyhev third-order and fourth-order phae repone..5 ELLIPTIC NORMALIZED APPROXIMATION FUNCTIONS The elliptic or Cauer approximation function provide the bet electivity characteritic of any of the approximation method dicued thu far. No other approximation method will be able to provide a lower-order filter for the pecification provided. The elliptic filter combine ripple in the paband and topband in order to accomplih thi feat. However, the elliptic approximation i alo the mot difficult to deign. It involve the mot ophiticated mathematical function of any of the method dicued in thi text. Luckily, many good mind have laid the foundation for thi work and their reult will be preented here o that we can put the deign procedure into a workable algorithm..5. Elliptic Magnitude Repone The elliptic approximation magnitude frequency repone function i hown in.55, where R n i the Chebyhev rational function of order n. R n i compoed of both numerator and denominator portion, which allow an equiripple repone in both the paband and topband. The Chebyhev rational function R n and much of elliptic approximation theory i baed on the elliptic integral and the Jacobian elliptic function. Thee function can be evaluated via advanced mathematical package available for mot computer and are dicued in Appendix D. The incomplete elliptic integral of the firt kind i hown in.57, where k i referred to a the modulu and φ i the amplitude of the integral. The modulu k mut be le than or equal to for the elliptic integral to be real. The elliptic ine, coine, tangent, and difference function baed on the elliptic integral are given in.58.6, repectively.

53 44 Practical Analog and Digital Filter Deign Thee function are ued in the calculation of the pole-ero location in the next ection. H E, n [ j ω / ωo ].55 ε R ω / ω n o where ε i a defined previouly. 0.a pa ε 0.56 φ / u φ, k k in x dx 0.57 n u, k in φ.58 cn u, k co φ.59 c u, k tan φ.60 dφ dn u, k.6 du The complete elliptic integral of the firt kind will be ued more often than the incomplete integral and it i defined in.6. It hould be noted at thi point that there are variou way to define the elliptic integral and elliptic function. Some author ue the modulu k a we have in thi text, while other ue other parameter related to k. CEI k u π /, k π / 0 k in x / dx.6

54 Analog Filter Approximation Function Elliptic Order The order of the elliptic approximation function required to meet the pecification for a filter i given in.63: n E CEI rt CEI kn.63 CEI rt CEI kn where CEI refer to the complete elliptic integral, and the ratio rt and the kernel kn are defined a rt ω pa /ω top.64 0.apa 0. a top kn 0 /0.65 Example.8 Elliptic Order Calculation Problem: Determine the order of an elliptic filter required to atify the following pecification: a pa db, a top 34 db, ω pa rad/ec, and ω top rad/ec Solution: In order to determine the order of the elliptic approximation, we firt determine that rt 0.5 and kn Then, uing any appropriate math package, we can determine that n E which indicate that a third-order filter will be required. Notice that the tandard and invere Chebyhev approximation require a fourth-order function to provide a top 33 db and a Butterworth approximation would require a eventh-order function to meet thi pecification..5.3 Elliptic Pole-Zero Location The pole and ero location for the elliptic approximation function are alo dependent on the elliptic integral and the elliptic function defined in the previou ection. We ll tart by defining a variable v o, which i ued in the calculation of the pole and ero location.

55 46 Practical Analog and Digital Filter Deign v o ε CEI rt c n CEI kn, kn.66 Next, the pole real and imaginary component are determined a [ f m, rt] dn[ f m, rt] cn n vo, rt cn vo, rt σ.67 m [ ] dn f m, rt n vo, rt [ f m, rt] n dn vo, rt ω m.68 [ ] dn f m, rt n vo, rt where CEI rt m f m, m 0,,, n/ n even.69a n CEI rt m f m, m 0,,,[ n /] n odd.69b n Note the negative ign for σ m, which effectively move the pole location from the firt quadrant to the econd quadrant. In the cae of odd-order approximation, the firt-order denominator pole will be located on the negative real axi at n vo, rt cn vo, rt σ R.70 n vo, rt And finally, the location of the ero that will be purely imaginary on the jω axi are given by σ m

56 Analog Filter Approximation Function 47 ω m.7 rt n [ f m, rt] Although the elliptic approximation require a number of mathematical function which aren t in everyday uage, we have mot of the hard work done in determining the tranfer function we need. Our primary objective in thi ection i to develop an orderly manner to calculate the pole and ero location..5.4 Elliptic Tranfer Function Now we are able to define the firt-order and quadratic factor that will make up the elliptic approximation function. The firt-order factor for the elliptic approximation i indicated in.73, where σ R i a indicated in.70. Again, there i no matching finite ero for the firt-order pole factor; it i located at infinity. σ R H o S.73 S σ The form of the quadratic component of the tranfer function will alo be identical to the invere Chebyhev cae, a indicated below: where H m R Bm S A m S Am S.74 A S B S B m B m m m σ m.75 B m σ m ωm.76 A σ m m A m σ m ωm ωm.78 We are now ready to define a generalied tranfer function for the elliptic approximation function that i almot identical to the invere Chebyhev cae. The difference lie in the ripple in the paband a in the tandard Chebyhev cae.

57 48 Practical Analog and Digital Filter Deign Conequently, the even-order ripple adjutment factor i included in.79. The ratio of product factor i combined with thi value to determine the total gain adjutment: even /, 0,,, , pa n n m B S B S A A S A S B S H m m m m m m m m m m a n E.79a odd /],[ 0,,,, n n m B S B S A S A S A S B S H m m m m m R m m m m m R n E σ σ.79b Example.9 Elliptic Third-Order Normalied Tranfer Function Problem: Determine the order, pole and ero location, and tranfer function coefficient for an elliptic filter to atify the following pecification: a pa db, a top 34 db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the fundamental contant needed from.56 and.63.66: ε n.97 3rd order rt 0.50 kn CEIrt CEIkn CEI[qrt rt ].5656 CEI[qrt kn ] v o Next, we find the location of the firt-order pole, the complex pole in the econd quadrant, and the econd-order ero on the jω axi from A pole-ero plot i hown in Figure.. t order σ R ω R 0.0 f σ ω Zero σ ω Finally, we generate the tranfer function from The WFilter coefficient are given in Figure..

58 H E,3 Analog Filter Approximation Function S S S S.006 Figure. Pole and ero location for third-order elliptic normalied filter. Elliptic 3rd-Order Normalied Lowpa Selectivity: Lowpa Approximation: Elliptic Implementation: Analog Paband gain db: -.0 Stopband gain db: Paband freq H: Stopband freq H: Filter Length/Order: 03 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E00 Denominator Coefficient QD [S^ S ] E E E E00 Figure. Elliptic normalied third-order coefficient from WFilter.

59 50 Practical Analog and Digital Filter Deign Example.0 Elliptic Fourth-Order Normalied Tranfer Function Problem: Determine the order, pole and ero location, and tranfer function coefficient for an elliptic filter to atify the following pecification: a pa db, a top 5 db, ω pa rad/ec, and ω top rad/ec Solution: Firt, we determine the fundamental contant needed: ε n th order rt 0.50 kn CEIrt CEIkn CEI[qrt rt ].5656 CEI[qrt kn ] vo Next, we find the location of the two complex pole in the econd quadrant and the econd-order ero on the jω axi from A pole-ero plot i hown in Figure.3. f σ ω f.6433 σ ω Zero σ ω Zero σ ω Finally, we generate the tranfer function from Note that in thi even-order cae, the gain contant of i included. The WFilter coefficient are given in Figure.4. H E,4 S S S 4.7 S S S S Figure.3 Pole and ero location for fourth-order elliptic normalied filter.

60 Analog Filter Approximation Function 5 Elliptic 4th-Order Normalied Lowpa Selectivity: Lowpa Approximation: Elliptic Implementation: Analog Paband gain db: -.0 Stopband gain db: -5.0 Paband freq H: Stopband freq H: Filter Length/Order: 04 Overall Filter Gain: E-03 Numerator Coefficient QD [S^ S ] E E E E00 Denominator Coefficient QD [S^ S ] E E E E-0 Figure.4 Elliptic normalied fourth-order coefficient from WFilter. The magnitude and phae repone for the elliptic filter are preented in Figure.5 and.6. Figure.5 Elliptic third-order and fourth-order magnitude repone.

61 5 Practical Analog and Digital Filter Deign Figure.6 Elliptic third-order and fourth-order phae repone..6 COMPARISON OF APPROXIMATION METHODS Now that we have dicued the four approximation method and diplayed thirdorder and fourth-order magnitude and phae plot, we are in a poition to compare the reult. Firt, we look at the magnitude plot of Figure.7,.3,.9, and.5. Table. how the gain achieved at the topband edge frequency of rad/ec for each normalied filter type and order. Each filter wa deigned with a paband gain of db. Obviouly, if attenuation characteritic in the topband are the primary concern, an elliptic filter would have to be the choice. It provide db more attenuation than the Chebyhev type and db more attenuation than the Butterworth filter for the third-order cae. In the fourth-order cae, the difference increae to over 8 and 33 db compared to the Chebyhev and Butterworth filter. The Chebyhev filter type themelve afford better topband characteritic when compared to the Butterworth filter. They provide 0 and 5 db more attenuation for the third-order and fourth-order cae. Although the table only lit the gain for third-order and fourth-order filter, the ame trend continue for higher-order filter. Although the Chebyhev and invere Chebyhev filter provide the ame gain at the paband and topband edge frequencie, their repone are not identical. If we were to take a cloe look at the frequency repone in the paband, we would find that the invere Chebyhev provide a better approximation to the ideal repone except at frequencie very near to the normalied paband edge frequency. In that cae, the tandard Chebyhev produce a tighter fit. In the tranition band, the tandard Chebyhev repone provide a more rapid tranition. And in the topband, the tandard Chebyhev repone continue to increae the attenuation a the frequency increae, while the invere Chebyhev repone alternate between mall gain and a top. In

62 Analog Filter Approximation Function 53 ome cae, the filter deigner might trade the fater tranition for the nondecreaing attenuation. Table. Comparion of Filter Gain at rad/ec Filter Type 3rd Order 4th Order Butterworth.5 db 8.3 db Chebyhev.5 db 33.8 db Invere Chebyhev.5 db 33.8 db Elliptic 34.5 db 5.9 db Although the magnitude characteritic of a filter are very important, the phae characteritic of a filter are alo crucial in many project. Whether in audio network or data tranmiion ytem, deigner are looking for filter with linear phae repone. Nonlinear phae repone in an audio network will caue noticeable phae ditortion for the litener that cannot be tolerated, epecially in high-quality ytem. In data tranmiion ytem nonlinear phae repone produce group delay that are function of frequency. Thi produce ditortion in the pule ent over the ytem and can ditort edge and level to the point of cauing error in the received ignal. We can compare the phae repone of Figure.8,.4,.0, and.6 to ee the level of phae ditortion for each approximation type. Remember that the tranition from 80 to 80 degree are not dicontinuitie, but rather a function of the diplay method. The phae repone i written to a data file in it true form. Table. how the phae angle for the third-order and fourth-order filter at the paband and topband edge frequencie. Table. Comparion of Filter Phae at and rad/ec Filter Type r/ r/ r/ r/ Butterworth Chebyhev Invere Chebyhev Elliptic A Table. and the phae plot indicate, the filter with the maximally flat repone in the paband Butterworth and invere Chebyhev provide the mot linear repone, although the invere Chebyhev doe have phae dicontinuitie in the topband caued by the complex ero. Thee are uually not critical becaue the filter magnitude repone i very mall at thee frequencie and the ditortion hould be minimal. The phae repone of the tandard Chebyhev and

63 54 Practical Analog and Digital Filter Deign elliptic are alo matched very cloely and can be judged equivalent except for the dicontinuitie in the topband caued by the ero for the elliptic cae. A filter deigner tak i not alway clear cut. It eem that every project require a much topband attenuation a poible while providing a phae repone a linear a poible. The tak become one of weighing the importance of each characteritic. If phae repone i more critical than magnitude repone, then the Butterworth filter i a better choice. If the oppoite i true, the elliptic filter i a better choice. If magnitude and phae repone are nearly equal in importance, then one of the Chebyhev filter may be the bet choice. Other alternative are alo poible. Elliptic filter can be ued for their electivity, with phae compenation filter added to make the phae more linear. Thee filter type are not covered in thi text, but reference in the analog filter deign ection of Appendix A provide further information. A deigner mut be careful when puruing thee alternative, ince in ome cae the reult may be no better than the equivalent Butterworth or Chebyhev filter..7 CONCLUSION In thi chapter, we tudied the core of analog filter deign, the normalied approximation function. By developing thee function, we have laid the foundation for the remainder of the chapter on analog filter deign a well a a good bit of digital IIR filter deign. By approaching each approximation function in the ame manner, and developing method for determining exact pole and ero placement, we have implified the job of generating the C code neceary to implement thee algorithm in a clean, efficient manner. Thoe who are intereted in eeing more on the development of the C code can turn to Appendix D. In the next chapter, we will finih up the analog filter deign calculation by determining a technique to unnormalie the tranfer function we have jut developed.

64 Chapter 3 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter In the lat chapter, we were able to determine the normalied approximation function for the mot common type of analog filter. Our tak in thi chapter i to unnormalie thoe approximation function in a manner to produce lowpa, highpa, bandpa, and bandtop filter at the deired frequencie. Thi unnormaliation will be carried out in uch a way that the deign of the normalied approximation function will be central to the development. Figure 3. how the three-tep procedure ued in the unnormaliation. The implicity of thi procedure i the fact that the econd tep i the ame for all filter deign method. Figure 3. Procedure for unnormaliation. 3. UNNORMALIZED LOWPASS APPROXIMATION FUNCTIONS Even though the normalied approximation function determined in the previou chapter are lowpa function, they till need to be unnormalied to the proper operational frequency. The firt tep in the unnormaliation procedure, a indicated in Figure 3., i to determine the order of the approximation function from the unnormalied pecification. The order of approximation function depend only on the paband and topband gain and frequencie. The gain for both the normalied and unnormalied approximation function will be the ame, the only pecification that change are the paband and topband edge frequencie. However, a indicated in Chapter, it i not the individual 55

65 56 Practical Analog and Digital Filter Deign frequencie that determine the order of the approximation function, but rather the ratio of the frequencie. Therefore, we can define a frequency ratio variable in 3. that will be ued for the lowpa filter type a indicated by the additional ubcript L. Ω ω top rl ωpa f f top pa 3. Each of the equation from Chapter that were ued to determine the order of a particular filter type can now be redefined in term of Ω r, a indicated in n B log[ 0 0.a top 0. a pa /0 log Ω r ] 3. n C n I coh 0 0.a coh /0 Ω 0.a top pa r 3.3 n E CEI rt CEI kn 3.4 CEI rt CEI kn where rt / Ω r apa 0. a top kn 0 /0 3.6 It may appear that we are doing a lot of work jut to change a variable name, but Ω r will be defined differently for each of the other type of filter electivitie a we will ee in the next ection. For that reaon do not include the additional ubcript L; however, in each ection we will define Ω r with a ubcript a in 3. for clarity.

66 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 57 So in thi lowpa cae, the firt tep in the unnormaliation procedure doen t require any work at all. We imply determine the order of the filter a we have in the pat. The econd tep of the unnormaliation procedure, determination of the normalied approximation function, ha already been developed in the previou chapter. It appear that we are ready to determine the third and final tep of the procedure, which i to unnormalie the normalied approximation function. In the lowpa cae, thi imply require a caling of the frequency characteritic from rad/ec to a more uable frequency. A imple ubtitution for the normalied variable S i all that i neceary, a hown in 3.7. A ubcript of L i ued to indicate that thi ubtitution i for lowpa filter only. The frequency contant ω o will be ω top for the invere Chebyhev approximation, a dicued in Chapter, and ω pa for all other approximation. S L 3.7 ω o 3.. Handling a Firt-Order Factor We will be developing code to implement the unnormaliation proce, o it i important to carefully decribe the ubtitution proce. For the firt-order factor, the proce begin with 3.8, where the B coefficient i typically : H A S A B S B S ω o A ω A o B ω B o 3.8 In thi equation, uppercae A and B repreent the coefficient of the normalied approximation function. After implification, 3.9 reult in a new et of coefficient. In thi equation, lowercae a and b repreent the unnormalied coefficient that will be ued in our final approximation function: H A A ω B B ω o o a a b b 3.9 We can generalie thee reult for the firt-order factor below: The gain contant i unchanged. The -term coefficient become a A, b B The contant term coefficient become a A ω o, b B ω o

67 58 Practical Analog and Digital Filter Deign 3.. Handling a Second-Order Factor In the cae of the quadratic term that are ued to decribe our coefficient, the unnormaliation proce i hown in 3.0 and 3.: B B B A A A B S B S B A S A S A H o o o o S o ω ω ω ω ω b b b a a a B B B A A A H o o o o ω ω ω ω 3. The coefficient A 0 will be or 0. A value of will be preent only if an invere Chebyhev or elliptic approximation i being unnormalied, while a 0 will be ued for Chebyhev and Butterworth. A will normally be 0 for all approximation, but i included for completene of the derivation in the event we want to ue any of our work at a later time when complex conjugate ero will occur off the jω axi. B 0 will typically be for all cae, but i retained for generality. By obervation, we can determine the following relationhip that can be ued in our C code: The gain contant i unchanged. The -term coefficient become a 0 A 0, b 0 B 0 The -term coefficient become a A ω o, b B ω o The contant term coefficient become a A b B o o ω ω, Complete numerical example of the lowpa unnormaliation proce are now in order. Example 3. Unnormalied Invere Chebyhev Lowpa Filter Problem: Determine the tranfer function for an invere Chebyhev lowpa filter to atify the pecification: a pa 0.5 db, a top 38.0 db, ω pa 600 rad/ec, ω top,000 rad/ec

68 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 59 Solution: Uing the material of Section.4, the important value for thi example and the normalied tranfer function are lited below. The unnormalied tranfer function i then determined by making the ubtitution S / ω o and uing the relationhip jut developed: Ω r.667 n th order ω o rad/ec H I,6 S S S S S.07 S.000 S S 0.74 S S.034 H I, , , Example 3. Unnormalied Butterworth Lowpa Filter Problem: Determine the tranfer function for a Butterworth lowpa filter to atify the following pecification: a pa 0.5 db, f pa,000 H, a top db, f top,000 H Solution: Uing the material of Section., the important value for thi example and the normalied tranfer function are lited below: Ω r.0 n th order ω o 6,83.9 rad/ec H B,5 S S.34 S S.53 S S.53 The unnormalied tranfer function i then determined by making the ubtitution S / ω o and uing the relationhip jut developed: H B,5 7, , We can alo ue WFilter to deign either of the lowpa filter jut decribed, but in thi cae we ll pick the Butterworth filter. The coefficient and repone of thi filter are hown in Figure 3. and

69 60 Practical Analog and Digital Filter Deign Butterworth Lowpa Filter Selectivity: Lowpa Approximation: Butterworth Implementation: Analog Paband gain db: -0.5 Stopband gain db: -.0 Paband freq H: Stopband freq H: Filter Length/Order: 05 Overall Filter Gain: E00 Numerator Coefficient QD [S^ S ] E E E E E E07 Denominator Coefficient QD [S^ S ] E E E E E E07 Figure 3. Filter coefficient for Example 3. from WFilter. Figure 3.3 Filter magnitude repone for Example UNNORMALIZED HIGHPASS APPROXIMATION FUNCTIONS The normalied lowpa approximation can alo be ued to generate the approximation function for a highpa filter. The calculation for the ratio frequency Ω r i baed on the ratio of paband to topband frequencie, a hown

70 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 6 in 3.. Thi i the reciprocal of the lowpa cae, but ince ω pa > ω top, the reult till produce a value greater than. The Ω r ratio alway produce a value greater than a we will ee in later ection a well and a the value get larger and larger, the order of the filter will reduce a long a other characteritic remain the ame. Ω ω pa rh ωtop f f pa top 3. Once the normalied lowpa approximation i determined baed on the order, we can unnormalie the lowpa tranfer function uing an appropriate unnormaliation ubtitution. In the cae of the highpa filter, the unnormaliation ubtitution i given in 3.3. A in the lowpa cae, ω o will take on the value of ω pa except for the invere Chebyhev approximation where it will have the value of ω top. S H ωo Handling a Firt-Order Factor For the firt-order cae, we tart with 3.4 and make the ubtitution of 3.3. The final reult i then hown in 3.5. In thi unnormaliation cae, we ee that there i a gain adjutment A / B that mut be conidered. H A S A B S B S ω o A ω B ω o o A B 3.4 H A B A / A ωo B / B ω o A B a a b b 3.5 From careful obervation we can draw the following information from thee equation: The gain contant i multiplied by A / B. The -term coefficient become a, b The contant term coefficient become a A / A ω o, b B / B ω o

71 6 Practical Analog and Digital Filter Deign 3.. Handling a Second-Order Factor In the cae of thi highpa unnormaliation proce, the econd-order factor will be unnormalied in the manner hown in 3.6: B B B A A A B S B S B A S A S A H o o o o S o ω ω ω ω ω 3.6 that can be implified to produce / / / / b b b a a a B A B B B B A A A A B A H o o o o ω ω ω ω 3.7 Notice that if A 0 and A are both ero which will be the cae for Butterworth and Chebyhev approximation, then a and a will be ero, leaving only an -term in the numerator. A will never be ero in a normalied approximation function. We can ummarie the reult of the unnormaliation below: The gain contant i multiplied by A / B. The -term coefficient become a 0, b 0 The -term coefficient become a A / A ω o, b B / B ω o The contant term coefficient become a A A b B B o o 0 0 /, / ω ω Numerical example of the highpa unnormaliation proce can now be ued to better illutrate the proce. Example 3.3 Unnormalied Elliptic Highpa Filter Problem: Determine the tranfer function for an elliptic highpa filter to atify the following pecification: a pa 0.5 db, a top 45.0 db, ω pa 3,000 rad/ec, ω top,000 rad/ec

72 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 63 Solution: Uing the material of Section.5, the important value for thi example and the normalied tranfer function are lited below: Ω r.5 n 4.6 5th order ω o 3,000.0 rad/ec H E, S S S S S S S S.03 The unnormalied tranfer function i then determined by making the ubtitution S ω o / and uing the relationhip jut developed: H E,5 7, , Example 3.4 Unnormalied Chebyhev Highpa Filter Problem: Determine the tranfer function for a Chebyhev highpa filter to atify the following pecification: a pa.5 db, f pa,000 H, a top 40 db, f top 800 H Solution: Uing the material of Section.3, the important value for thi example and the normalied tranfer function are lited below: Ω r.5 n th order ω o,566.4 rad/ec H C,4 S S S S S The unnormalied tranfer function i then determined by making the ubtitution S ω o / and uing the relationhip jut developed: H C,4 3, , The reult of uing WFilter to deign the filter of Example 3.4 are illutrated in Figure 3.4 and 3.5, which how the coefficient and magnitude repone.

73 64 Practical Analog and Digital Filter Deign 3.3 UNNORMALIZED BANDPASS APPROXIMATION FUNCTIONS In the cae of a bandpa unnormaliation, Ω r will be defined in 3.8. Note that for thi cae, Ω r will be greater than, a ha been the cae for the lowpa and highpa unnormaliation. Chebyhev Highpa Filter Selectivity: Highpa Approximation: Chebyhev Implementation: Analog Paband gain db: -.5 Stopband gain db: Paband freq H: Stopband freq H: Filter Length/Order: 04 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E00 Denominator Coefficient QD [S^ S ] E E E E08 Figure 3.4 Filter coefficient for Example 3.4 from WFilter. Figure 3.5 Filter magnitude repone for Example 3.4.

74 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 65 Ω rp ω ω top pa ω ω top pa f f top pa f f top pa 3.8 After determining the normalied lowpa approximation uing the order we determined from the bandpa pecification, we can unnormalie the lowpa function into a bandpa function. To accomplih thi we ue the ubtitution given in 3.9: S P ωo BW 3.9 where for all approximation except the invere Chebyhev, ωo ω pa ω pa 3.0 BW ωpa ω pa 3. For the invere Chebyhev cae thee value are defined a another example of the oppoite nature of thi approximation ωo ω top ω top 3. BW ωtop ω top 3.3 In order to provide an accurate value of Ω r in 3.8, the topband and paband edge frequencie mut be ymmetrically paced on either ide of ω o. The implet way to tet for thi i to check to ee that the relationhip of 3.4 i atified. If thi equation i not atified, the larger ide mut be reduced to form an equality by increaing ω top or decreaing ω top. Thi will tighten the retriction, o the original pecification will till be met, and an accurate order can be calculated. If there i an extreme inequality, other meaure can be ued to implement the filter. For example, an additional lowpa or highpa filter can be added to provide the required electivity. ω ω pa top ωtop 3.4 ω pa

75 66 Practical Analog and Digital Filter Deign A indicated by 3.9, the unnormaliation proce will reult in a bandpa approximation function that ha twice the order of the lowpa function ued to generate it. Thi eem reaonable when we conider that a bandpa filter mut provide a tranition from a topband to a paband like a highpa filter and another tranition from a paband to a topband like a lowpa filter. The reulting function mut therefore be twice the order of the original lowpa function on which it i baed Handling a Firt-Order Factor For a firt-order factor in the lowpa approximation function, 3.5 how how the ubtitution of 3.9 i made: H A S A B S B A [ ωo S ω BW B [ ωo BW ] A BW ] B o 3.5 And after ome implification we have the reult in 3.6. The relationhip between the coefficient are hown. Note that if A 0, a will normally be the cae, the numerator will only have an -term preent. H A B A BW A ω B o o BW B ω 0 a0 b a a b b 3.6 The gain contant i unchanged. The -term bandpa coefficient become a 0 A, b 0 B The -term bandpa coefficient become a A BW, b B BW The contant term bandpa coefficient become a A ω, b B ω o 3.3. Handling a Second-Order Factor o Unnormaliing a econd-order factor i a bit more of a challenge. When the ubtitution variable S P of 3.9 i inerted into a econd-order lowpa approximation, a fourth-order factor reult. What do we do with a fourth-order factor? All of our development to thi point i baed on quadratic factor and with good reaon. They repreent a complex conjugate pair and they will be ued to efficiently implement the filter in later chapter. We could factor the fourth-order, but thi would require a numerical algorithm that i time-conuming and not alway accurate. There i another directed procedure that can be ued.

76 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 67 If we factor the lowpa approximation quadratic into two complex conjugate factor before making the ubtitution of 3.9, the reult after the ubtitution and implification i two quadratic equation. However, each of thee quadratic would have a complex coefficient that would mean they could not be implemented directly. However, if thee two quadratic are again factored, we will find two et of complex conjugate pair within the et of four factor. Thee complex conjugate pair could then be combined to produce two quadratic that have all real coefficient. Perhap an eay example i in order. Conider the tranfer function hown in 3.7 that ha already been factored: H S 3.7 S S S j S j Now if we aume that ω o and BW, we can ubtitute S / and implify to produce the following: H 3.8 [ j ] [ j ] The root of the firt quadratic can be determined to be j ± j j0.59, a, j and the two root of the econd quadratic pair up with the firt j0.59, b 3,4 j The reulting tranfer function can then be written a 3.30 by combining the complex conjugate root from each quadratic: H Thi algorithm for finding the two quadratic in the bandpa approximation from the ingle quadratic in the lowpa function will be ued a the tandard method in thi ection. Unfortunately, it i very difficult to define the final bandpa coefficient in term of only the initial lowpa coefficient becaue of

77 68 Practical Analog and Digital Filter Deign the complexity of expreion. However, if we ue a few intermediate variable, the proce hould be able to be demontrated without too much confuion. We tart with the general expreion for the normalied lowpa econd-order factor hown in 3.3 in normal and factored form. The A 0 and B 0 coefficient have been omitted for clarity ince they will be aumed to be in thi cae, and p and repreent the complex pole and ero, repectively. An aterik indicate the complex conjugate value. * * BW S o p S p S S S B S B S A S A S H ω 3.3 After making the indicated ubtitution and implifying, we have * * o o o o p BW p BW BW BW H ω ω ω ω 3.3 Each one of the quadratic factor in 3.3 can now be factored into firtorder factor, a indicated in Note that the contant from the quadratic are labeled with an a and b, while the complex conjugate ue c and d. The denominator ue the ame deignation. d c b a d c b a p p p p H 3.33 Now, by matching the complex conjugate pair, we can recontruct two quadratic with real coefficient in both the numerator and denominator: b b b b a a a a H 3.34 The reult hown in 3.34 are valid for the invere Chebyhev and elliptic approximation function that ue ero on the jω axi. However, for the Butterworth and Chebyhev approximation function, the reult will be omewhat different. Equation 3.35 how the tarting point for thi development. After ubtitution and implification, 3.36 reult. Then following the ame baic tep a in the previou derivation, 3.37 eventually emerge.

78 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 69 H S B A S B S A p S p * S o ω BW 3.35 A BW H 3.36 * BW p ω BW p ω o o A BW H 3.37 b b b b Now, ome example illutrating the bandpa deign proce are in order. Example 3.5 Unnormalied Butterworth Bandpa Filter Problem: Determine the tranfer function for a Butterworth bandpa filter to atify the following pecification: a pa.0 db, a top db, f pa 300 H, f pa 3,000 H, f top 50 H, f top 9,000 H Solution: Uing the material of Section., the important value for thi example and the normalied tranfer function are lited below. In thi cae, f top mut be changed to 00 H to provide ymmetry. The function i hown with quadratic in factored form, a indicated by the upercript. Ω r 3.3 n.59 3rd order 4 5 ω o 5,960.8 rad/ec BW 6,965 rad/ec H B,3 S S.56 S ± j.0848 After making the ubtitution of 3.9 and factoring again, the following equation emerge: ,965 H B,6 7, ± j ± j9,836 After implification, the following tranfer function reult:

79 70 Practical Analog and Digital Filter Deign H B,6, , , Example 3.6 Unnormalied Invere Chebyhev Bandpa Filter Problem: Determine the tranfer function for an invere Chebyhev bandpa filter to atify the following pecification: a pa 0.5 db, a top 33 db, f pa 00 H, f pa 00 H, f top 50 H, f top 400 H Solution: Uing the material of Section.4, the important value for thi example and the normalied tranfer function are lited below. The tranfer function i hown with quadratic in factored form, a indicated by the upercript. Ω r 3.5 n.88 3rd order ω o rad/ec BW,99. rad/ec S ± j.5470 H I,3 S S S ± j After making the ubtitution of 3.9 and factoring again, the following equation emerge: 0.464,036 ± j80. ± j,89 H I,6 5, ± j ± j,390 H I,6 After implification, the following tranfer function reult: 0.464,036, We can ue WFilter to deign the invere Chebyhev bandpa filter of Example 3.6. The coefficient for thi deign are hown in Figure 3.6 with the magnitude repone hown in Figure 3.7. Notice that two of the numerator coefficient are quite mall approximately 0 6 or maller and hould be interpreted a ero ince thee quadratic repreent complex ero located on the jω-axi. 6

80 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 7 Invere Chebyhev Bandpa Filter Selectivity: Bandpa Approximation: Inv. Chebyhev Implementation: Analog Paband gain db: -0.5 Stopband gain db: PB freq-lower H: 00.0 PB freq-upper H: 00.0 SB freq-lower H: 50.0 SB freq-upper H: Filter Length/Order: 06 Overall Filter Gain: E-0 Numerator Coefficient QD [S^ S ] E E E E E E06 Denominator Coefficient QD [S^ S ] E E E E E E06 Figure 3.6 Filter coefficient for Example 3.6 from WFilter. Figure 3.7 Filter magnitude repone for Example 3.6.

81 7 Practical Analog and Digital Filter Deign 3.4 UNNORMALIZED BANDSTOP APPROXIMATION FUNCTIONS We will find that the unnormaliation of the lowpa normalied function into a bandtop approximation i very imilar to the bandpa cae. The firt tep in the procedure i to determine the order required from the lowpa approximation baed on the bandtop pecification. The value of Ω r to ue in the bandtop cae i hown in 3.38, which i the reciprocal of the bandpa cae. We notice again that Ω r will be greater than : Ω r ω ω pa top ω ω pa top f f pa top f f pa top 3.38 A in the bandpa cae, 3.4 mut be atified in order to get an accurate value of Ω r, except in thi cae either ω pa mut be increaed or ω pa mut be decreaed to achieve equality. After finding the order, we can unnormalie the lowpa function into a bandtop function uing the ubtitution given in 3.39: S S BW 3.39 ω o A before, all approximation except the invere Chebyhev will define ωo ω pa ω pa 3.40 while for the invere Chebyhev cae BW ωpa ω pa 3.4 ωo ω top ω top 3.4 BW ωtop ω top 3.43 The reultant bandtop approximation function will be twice the order of the normalied lowpa function jut a in the bandpa cae. The bandtop filter i in effect implementing both a lowpa and highpa filter and therefore require twice the order.

82 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter Handling a Firt-Order Factor Equation 3.44 how how a firt-order factor i unnormalied into a econdorder factor uing the ubtitution of 3.39: ] [ ] [ B BW B A BW A B S B A S A S H o o BW S o ω ω ω 3.44 Equation 3.45 how the reult after implification followed by the obervation that can be made for thi cae: 0 0 / / b b b a a a BW B B BW A A B A H o o ω ω 3.45 The gain contant i multiplied by A / B. The -term bandtop coefficient become a 0, b 0 The -term bandtop coefficient become a A / A BW, b B / B BW Contant term bandtop coefficient become a b o o ω ω, 3.4. Handling a Second-Order Factor In order to unnormalie a econd-order factor we experience the ame problem a in the bandpa cae. A direct ubtitution would give u a fourth-order tranfer function, which i not what we want. However, the methodology ued in the bandpa cae doe work in thi cae a well. The procedure i outlined below for the bandtop cae that ha a few difference due to a different ubtitution factor. Starting at the ame point a with the bandpa cae, 3.46 how the reult of the factoring of the initial quadratic: * * o BW S p S p S S S B S B S A S A S H ω 3.46 Equation 3.47 reult after the ubtitution and implification: ] / [ ] / [ ] / [ ] / [ * * * * o o o o p BW p BW BW BW p p H ω ω ω ω 3.47

83 74 Practical Analog and Digital Filter Deign The initial gain factor of 3.47 can be hown to be A / B. The quadratic factor can be factored into firt-order factor, a indicated in 3.48: d c b a d c b a p p p p B A H 3.48 We then recontruct two quadratic in the numerator and denominator by matching the complex conjugate pair: b b b b a a a a B A H 3.49 Thi reult i valid for the rational approximation function invere Chebyhev and elliptic, but for the all-pole approximation Butterworth and Chebyhev, we mut develop a lightly different verion. Equation 3.50 and 3.5 how the factoring and ubtitution of After the quadratic of 3.5 are factored and the matching complex conjugate term are combined, the final form i 3.5. * ω BW S p S p S A B S B S A H 3.50 ] / [ ] / [ * * o o o p BW p BW p p A H ω ω ω b b b b B A H o ω 3.5 Complete numerical example of the bandtop unnormaliation proce are given next.

84 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 75 Example 3.7 Unnormalied Chebyhev Bandtop Filter Problem: Determine the tranfer function for a Chebyhev bandtop filter to atify the following pecification: ω pa 3,000 rad/ec, ω pa 4,000 rad/ec, ω top 6,000 rad/ec, ω top,000 rad/ec, a pa.0 db, a top 35 db Solution: Uing the material of Section.3, the important value for thi example and the normalied tranfer function are lited below. The tranfer function i hown with quadratic in factored form a hown by the upercript. Ω r 3.5 n.80 3rd order ω o rad/ec BW,000 rad/ec H C,3 S S S ± j After making the ubtitution of 3.39 and factoring again, the following equation emerge, which can be implified into the final reult: H C,6 7 4, ± j,965 4,63 ± j3,370 H C,6 4, , , Example 3.8 Unnormalied Elliptic Bandtop Filter Problem: Determine the tranfer function for an elliptic bandtop filter to atify the following pecification: a pa 0.3 db, a top 50 db, f pa 50 H, f pa 7 H, f top 58 H, f top 6 H Solution: Uing the material of Section.5, the important value for thi example and the normalied tranfer function are lited below. In thi cae, f pa

85 76 Practical Analog and Digital Filter Deign mut be changed to 7.9 H to provide ymmetry. The tranfer function i hown with quadratic in factored form a hown by the upercript. Ω r 3.3 n.75 3rd order ω o rad/ec BW rad/ec H ,3 S ± j S E S S ± j After making the ubtitution of 3.39 and factoring again, the following equation emerge: 4,960 ± j387.9 ± j366.0 H I, , ± j ± j438.4 After implification, the following tranfer function reult: H E,6 4, ,964 50, ,585 33, ,704 We can alo ue WFilter to deign the bandtop elliptic filter of Example 3.8. The reult of thi filter deign are hown in Figure 3.8 and 3.9 that how the coefficient and magnitude repone, repectively. Again, a in the bandpa cae, a couple of the numerator coefficient are very mall and can be conidered ero. 3.5 ANALOG FREQUENCY RESPONSE Up to thi point we have developed the neceary foundation to deign a variety of analog filter. We have calculated the coefficient and are ready to implement the filter in hardware. But before we addre the implementation iue in the next chapter, we need to check our deign by determining the frequency repone of the filter and comparing it to our deign pecification. We will dicu the calculation of the frequency repone of our filter and alo view the C code for the frequency repone calculation Mathematic for Frequency Repone Calculation The filter approximation function, which we have jut determined by the calculation of the unnormalied coefficient, repreent a tranfer function of a linear ytem in the -domain. In order to determine the frequency repone of the tranfer function, we mut ubtitute jω for each of the -variable in that tranfer

86 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 77 function. For example, 3.53 how a tranfer function with one quadratic factor, while 3.54 how the frequency repone for that tranfer function: Elliptic Bandtop Filter Selectivity: Bandtop Approximation: Elliptic Implementation: Analog Paband gain db: -0.3 Stopband gain db: PB freq-lower H: 50.0 PB freq-upper H: 7.9 SB freq-lower H: 58.0 SB freq-upper H: 6.0 Filter Length/Order: 06 Overall Filter Gain: E00 Numerator Coefficient QD [S^ S ] E E E E E E05 Denominator Coefficient QD [S^ S ] E E E E E E05 Figure 3.8 Filter coefficient for Example 3.8 from WFilter. Figure 3.9 Filter magnitude repone for Example 3.8.

87 78 Practical Analog and Digital Filter Deign b b b a a a H o o 3.53 b j b j b a j a j a j H H o o j ω ω ω ω ω ω 3.54 After implification, the frequency repone Hjω i hown a a frequency dependent complex number in Thi complex number can be repreented in either rectangular form or polar form. However, when we deal with a frequency repone, the polar form i the more natural form becaue the tandard frequency repone i compoed of both a magnitude and phae repone portion. Equation 3.56 how the reult of converting 3.55 into polar form: ω ω ω ω ω b j b b a j a a j H o o 3.55 tan tan b b a a P M P M j H ω 3.56 where ω ω a a a M o a ω ω b b b M o b / ω ω o a a a a P / ω ω o b b b b P Of coure, if the original tranfer function ha multiple quadratic term, a our approximation function do, the total frequency repone i dependent on all of the quadratic. The total magnitude reult will be the product of the individual magnitude and the total phae reult will be the um of the individual phae a hown in 3.57, where q repreent the number of quadratic factor:

88 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 79 t q a q b M M a b q a q b tan H jω 3.57 tan P a P The total frequency repone H t jω can then be decribed a hown in 3.58, where the total magnitude i the numerator magnitude divided by the denominator magnitude, and the total phae angle i the denominator phae ubtracted from the numerator phae: where t M t t b H jω Φ 3.58 M t q a M a q b M b Φ t q a tan P a q b tan P b Example 3.9 Frequency Repone of a Highpa Filter Problem: Determine the frequency repone both magnitude and phae at the paband edge frequency of,000 H and the topband edge frequency of 800 H for the Chebyhev highpa filter deigned in Example 3.4. Determine if the gain pecification of a pa.5 db and a top 40 db are met. The tranfer function i hown below: H C,4 3, , Solution: We firt make the ubtitution of jω into the tranfer function to obtain the frequency repone Hjω. Then after collecting the real and imaginary term and arranging them, the following equation for the frequency repone reult: H C, ω jω 8 8 [ ω j3,50.ω] [ ω j9,703ω] 4 8

89 80 Practical Analog and Digital Filter Deign Thi frequency repone equation can firt be ued to determine the frequency repone at the topband frequency of 800 H H C,4 j,600π j j H C, j,600π H C, 4 π 3 j, Thi indicate a gain of db at the topband frequency, which exceed the pecification, and a phae hift of 9.9 or In the cae of the paband frequency of,000 H, imilar calculation can be made a hown below: H C,4 j4,000π j j H C, j4,000π H C, 4 j4,000π Thi indicate a gain of.50 db at the topband frequency, which meet the pecification, and a phae hift of 5.5 or C Code for Frequency Repone Calculation We are now ready to develop the C code for determining the frequency repone of an analog filter. In order to properly determine the frequency repone, we need to know the tarting and topping frequencie for our calculation. We alo need to know whether to pace the frequencie in a linear or logarithmic fahion, and whether to calculate the magnitude in decibel or not. Thi, a well a other, information i tored in a frequency repone tructure called Rep_Param. All of the function that actually perform the frequency repone calculation are contained in the F_RESPON.C module that ha a header file of F_RESPON.H in which Rep_Param i defined.

90 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 8 The primary function for the calculation of the analog frequency repone i Calc_Analog_Rep, which i hown in Liting 3.. The et of frequencie ued to evaluate the filter have already been calculated and tored in RP->freq. /* Calc_Analog_Rep - calc repone for analog filt Prototype: int Calc_Analog_RepFilt_Param *FP, Rep_Param *RP; Return: error value Argument: FP - ptr to truct holding filter param RP - ptr to truct holding repon param */ int Calc_Analog_RepFilt_Param *FP,Rep_Param *RP { int c,f,q; /* loop counter */ double raddeg, /* rad to deg converion */ omega,omega, /* radian freq and quare */ rea,img; /* real and imag part */ } raddeg 80.0 / PI; /* et raddeg */ /* Loop through each of the frequencie */ forf 0 ;f < RP->tot_pt; f { /* Initialie magna and angle */ RP->magna[f] FP->gain; RP->angle[f] 0.0; /* Pre calc omega and omega quared */ omega PI * RP->freq[f]; omega omega * omega; /* Loop through coef for each quadratic */ forq 0 ;q < FP->order/; q { /* c i coef index 3 * quad index */ c q * 3; /* Numerator value */ rea FP->acoef[c] - FP->acoef[c] * omega; img FP->acoef[c] * omega; RP->magna[f] * qrtrea*rea img*img; RP->angle[f] atanimg,rea; /* Denominator value */ rea FP->bcoef[c] - FP->bcoef[c] * omega; img FP->bcoef[c] * omega; RP->magna[f] / qrtrea*rea img*img; RP->angle[f] - atanimg,rea; } /* Convert to degree */ RP->angle[f] * raddeg; } /* Convert magnitude repone to db if indicated */ ifrp->mag_axi LOG { forf 0 ;f < RP->tot_pt; f { /* Handle very mall number */ ifrp->magna[f] < ZERO { RP->magna[f] ZERO;} RP->magna[f] 0 * log0rp->magna[f]; } } return ERR_NONE; Liting 3. Calc_Analog_Rep function.

91 8 Practical Analog and Digital Filter Deign After calculating the contant raddeg for converting radian to degree, the primary work of the function i performed within two neted for loop. The outer loop control the frequency at which the repone i being calculated, while the inner loop tep through the number of quadratic in the approximation function. A we tart the calculation for a new frequency, the magnitude value RP->magna[f] i initialied to the overall gain value of the filter, while the phae value RP->angle[f] i et to 0. We then convert to radian frequencie and make the calculation of the radian frequency quared outide the quadratic loop. That ave time by not repeatedly making thoe calculation inide the loop where there i no change in their value. Once we reach the inner quadratic loop, which i controlled by the variable q, we define a value c that i baed on q to help acce the individual coefficient of each quadratic. We firt handle the numerator portion of the quadratic by determining the real and imaginary part of the complex number. Then the total magnitude i multiplied by the magnitude of the complex number, and the total angle i incremented by the angle of the complex number. A imilar proce i performed for the denominator portion of the quadratic except that the total magnitude i divided by the denominator magnitude, and the denominator phae i ubtracted from the total phae. Thi inner loop proce i repeated for all of the quadratic term, and then the phae value i converted to degree outide the quadratic loop. If the magnitude of the repone wa pecified to be in decibel, each of the magnitude value i converted to decibel before leaving the function. Since the logarithm of ero i undefined, an artificial value ZERO i defined in F_RESPON.H o that no math error will be produced by the compiler if value become too mall. Since we are uing type double to decribe the magnitude value, a value of E-30 wa choen for ZERO that i till within the limit of expreion for double. Thi value will produce a gain value of 600 db, which i well beyond the normal level of gain we expect in filter deign, o our definition of ZERO hould have no effect on the normal operation of the program. 3.6 SAVING THE FILTER PARAMETERS Once a filter ha been deigned, WFilter can ave it. The aved file can then be ued by other oftware program to identify the value of the filter gain, coefficient, and other characteritic of the filter, or the filter can be reloaded into WFilter for continued work. The tructure of thi WFilter binary data file i therefore included below. A binary file ha a number of advantage over a text file in thi ituation. Firt, the binary file will be eaier to read if the data i needed by another program. There i a very good chance that the filter deigner will want to tranfer the filter coefficient that have been determined by WFilter to another program for teting

92 Analog Lowpa, Highpa, Bandpa, and Bandtop Filter 83 or implementation. Second, the coefficient and data can be tored with more accuracy than they can be diplayed. In order to better undertand the binary file tructure, the format of the file i hown below. The firt 4 byte in the file will be an acronym for Analog and Digital Filter Deign. The next byte i a w to indicate that the file wa created by WFilter. The next 3 byte are character indicating the implementation, approximation, and electivity type. The next 40 byte are dedicated to the text decription for the filter. The next 8 byte are eparated into 6 byte of reerved pace to allow for future indicator, and byte ued to tore the order of the filter. The filter order i placed into the binary buffer in uch a manner that it could be read a an integer if deired. The PC format for dik torage dictate that the low-order byte i written before the high-order byte for an integer. Other machine may ue other method, but will be conitent between read and write operation. Next, 0 variable of ie double are tored, which include the ampling frequency, the gain and frequencie in the order indicated in the liting, and the gain of the filter. Finally, the acoef and bcoef variable are written a type double in the order that they were tored by the program. Header 8 byte Contain the identification ADFDw followed by three character indicating the implementation, approximation, and electivity type, repectively. The implementation option and value are: 0 - analog, - digital FIR and - digital IIR. The approximation option and value for analog and digital IIR filter are: 0 - Butterworth, - Chebyhev, - invere Chebyhev, and 3 - elliptic. The approximation or window option and value for digital FIR filter are: 4 - rectangular, 5 - Barlett, 6 - Blackman, 7 - Hamming, 8 - von Hann, 9 - Kaier, and 0 - Park-McClellan. Dicuion of the digital approximation will be given later in the text. The electivity option and value are: 0 - lowpa, - highpa, - bandpa, and 3 - bandtop. Decription 40 byte Contain the text decription of the filter and i filled by null at the end of the decription to make exactly 40 character. Reerved 6 byte Reerved for future ue. Order byte The order can be read a an integer.

93 84 Practical Analog and Digital Filter Deign Specification 0 double Contain the ampling frequency in hert, followed by the gain and frequencie from the pecification, and finally the overall filter gain. The gain are pecified in decibel and are in the order of a pa, a pa, a top, and a top. The frequencie are pecified in hert and are in the order of f pa, f pa, f top, and f top. A coefficient variable The acoef written a double. B coefficient variable The bcoef written a double. 3.7 CONCLUSION We have now completed the deign of a number of analog approximation type and are able to calculate the frequency repone and ave the filter parameter for future ue. In the next chapter we ll ee how to implement thee function a active filter. For thoe intereted in the C code ued to unnormalie the filter tranfer function, pleae turn to Appendix E.

94 Chapter 4 Analog Filter Implementation Uing Active Filter In thi chapter, we will dicu the implementation of the analog approximation function that we developed and verified in previou chapter. There are everal method that could be ued to allow the ucceful implementation of an analog filter. Unfortunately, an entire book could be devoted to thi topic and everal have, o we will concentrate on active filter. Uing active filter to implement the tranfer function i a very popular method today becaue of the natural correpondence between the analog circuit and the mathematical function. We will not dicu the derivation of the tranfer function for active filter becaue the development of uch circuit analyi technique i beyond the cope of thi text. However, a number of uitable reference are given in the analog active filter text of Appendix A for thoe who are intereted in the derivation. Intead, the circuit topology and tranfer function for everal common active filter will be preented before determining the component value for each circuit. We will develop implementation procedure for each of the filter electivitie dicued in previou chapter a well a dicu other option for implementation and ome of the important implementation iue. 4. IMPLEMENTATION PROCEDURES FOR ANALOG FILTERS There are many choice when it come to implementing our continuou-time analog filter. For example, we could decribe our ingle-input and ingle-output ytem by mean of tate variable and ue a tate-pace approach to the problem. Thi method ha the advantage of being very general and it put the problem in a convenient mathematical form that allow manipulation in term of matrix algebra. However, the development of thi theory i beyond the cope of thi text, but everal reference in Appendix A provide inight to thi method. When conidering the method of implementation, two key factor of frequency range and the power handling capability of the filter alo come into 85

95 86 Practical Analog and Digital Filter Deign quetion. Generally peaking, high power and high frequency dictate that paive filter be ued. Active filter with op-amp have a maximum frequency range and power range where they can be ued uccefully. Section 4.7 dicue the frequency iue in more detail. Paive filter are alo a bit more of a challenge to deign becaue they do not exhibit the near ideal qualitie of input and output impedance that op-amp have. Another choice for filter implementation i the tranconductance-c Gm-C filter that extend the effective frequency range beyond that of the typical active filter. Finally, witched-capacitor SC filter, like the Gm-C filter, ue MOSFET technology and witching ignal to implement analog filter. In that way the SC filter ue technology that bridge the gap between continuou-time and dicretetime ytem. However, it i not poible to treat the complete field of analog filter deign in one chapter. Intead, we will concentrate on a more traditional approach to implementing our tranfer function uing a ingle form of active filter. The Sallen-Key filter, which will be dicued in more detail in the following ection, ha the advantage of implementing a econd-order factor with a ingle op-amp tage. There are many other topologie circuit configuration that could be choen, but the Sallen-Key i a tried and true configuration. It i important to ee one method of implementing our continuou-time tranfer function before beginning the dicuion of dicrete-time ytem. Each of the active filter dicued will be compoed of everal tage of electronic circuitry coniting of a ingle operational amplifier op-amp and a number of electronic component called reitor R and capacitor C. The fact that active filter can implement complex pole without the ue of inductor L i a key point in their favor. Inductor have the diadvantage of being large, heavy, cotly, and generator of puriou magnetic field. Therefore, being able to implement an active filter with component that can be miniaturied i a big advantage. Each of thee tage of electronic filtering will have a tranfer function that characterie the relationhip of the output voltage to the input voltage, a indicated in 4.. More pecifically, each quadratic factor of the tranfer function will have the form a hown in 4., where each A and B in the tranfer function will be a function of the R and C ued in the circuit. The ubcript c i ued to indicate that thee tranfer function are decribing the circuit repone. H V V c o i 4. H c B A o o A A B B 4.

96 Analog Filter Implementation Uing Active Filter 87 We alo have the approximation function that we derived to meet a pecific et of frequency and attenuation characteritic. The general form of each quadratic factor in the approximation function i hown in 4.3, where the ubcript a i ued to deignate thi quadratic factor a an approximation function. The a and b ued a coefficient have already been determined and are numerical contant. ao H a b o a a b b 4.3 The implementation proce then become a matter of equating the two tranfer function factor a hown below. Each A and B of the circuit tranfer function are equated to the repective a and b of the approximation function and reult in everal equation which mut be olved for appropriate R and C value. H H c a 4.4 We will ee thi common procedure ued throughout the next four ection a we determine the component value needed to implement each of the active filter. 4. LOWPASS ACTIVE FILTERS USING OP-AMPS There are a number of active filter topologie circuit configuration that could be ued to implement a lowpa filter. We will limit ourelve to the popular Sallen- Key filter hown in Figure 4. with a tranfer function a decribed in 4.5. A indicated by the tranfer function, thi active filter tage can implement one econd-order factor of a lowpa filter function. Thi form i very convenient ince it naturally implement the quadratic factor that we have been uing for the decription of the approximation function. Of coure, everal of thee circuit tage in cacade can be ued to implement higher-order function, and with the addition of a ingle firt-order tage, odd-order filter can be implemented a well. Figure 4. Sallen-Key lowpa active filter tage.

97 88 Practical Analog and Digital Filter Deign K / R R C C H, L c [ / RC / RC K / RC ] / RRCC 4.5 where K R B / RA 4.6 In comparion to the tranfer function of 4.5, 4.7 how the general form of an all-pole lowpa approximation function uch a the Butterworth and Chebyhev function. Invere Chebyhev and elliptic filter approximation will ue a different active filter to implement them ince they require ero in the complex plane. The numerator value a in 4.7 will alway be equal to b, and G will have a value of unity except for the even-order Chebyhev cae. G a H, L a b b 4.7 If we equate 4.5 and 4.7 a indicated in the previou ection, we would generate one equation for b and one equation for b or a. However, we have five unknown R, R, C, C, and K in our circuit. Since there are more unknown than equation, we cannot uniquely determine the value of the component required for the active filter. Thi allow u to elect value for three of the component. For example, we could elect the value of R, R, and C if we wanted or the value of C, C, and K. Another method that we will ue i to let R R and C C, which effectively eliminate two of the unknown. In addition, we will pick a common value for the capacitor ince they have far fewer available value than reitor. Thi method of picking the R and C value ha the advantage of reducing the number of different component value needed to implement the active filter. The diadvantage of thi method i that the value of K, which repreent the gain for the active filter, will not be unity. However, we will find that thi problem can be eaily olved. If we elect common value for the primary reitor and capacitor, the tranfer function for the active filter then become / R C H, L K c 4.8 [3 K / RC] / R C By conidering the denominator of 4.7 and 4.8, we can determine the two relationhip a hown below: b R C 4.9

98 Analog Filter Implementation Uing Active Filter 89 b 3 K RC 4.0 Since we have already picked the value of C, we can olve for the reitor value needed to implement the filter. The reult are R / b C 4. and then uing 4.6 R B b K 3 b / b / R b A / Uually, R A will be picked a ome convenient value and R B will then be calculated. The only adjutment remaining i to equate the numerator term of the two tranfer function. Notice that in thi cae, there exit a gain of K at ω 0, while the approximation function ha a gain of G. The value of G will alway be le than or equal to one, while the value K will alway be greater than or equal to one. Thu, it i alway neceary to reduce the gain of the active filter to match the gain of the approximation function. The amount of thi gain adjutment factor i GA K tot / G tot 4.4 where K tot and G tot repreent the product of all the K and G in the total circuit and approximation function, repectively. Thi gain adjutment factor can be implemented by a imple voltage divider at the output of the active filter tage. There are two condition placed on thi voltage divider. The invere of the voltage divider ratio mut match the gain adjutment factor, and the equivalent reitance of the voltage divider a een by the output load mut equal the required filter output reitance. Therefore, auming an output reitance R out, and a voltage divider network made up of R x and R y, R R R / R R out x y x y 4.5 GA R R / R x y y 4.6

99 90 Practical Analog and Digital Filter Deign which mean that R x GA R out 4.7 R y GA Rout / GA 4.8 The circuit of Figure 4. how one tage of the new configuration with the voltage divider output. If the input ignal level i very high, we might chooe to ue the voltage divider on the firt tage of the filter in order to reduce ditortion in the filter. Figure 4. Active filter with voltage divider output. Before we conider how to implement an odd-order approximation function, we need to conider whether the gain adjutment technique i appropriate for all application. In many cae, amplification i a required part of the filtering ytem, and therefore the difference in gain can be factored into the overall gain requirement. For example, if the overall ytem gain required i 60 db, and the filter i producing a gain of 0 db in the paband, a more efficient olution would be to deign the remaining amplifier to provide 40 db of gain. Thi deign would be more power efficient, ue fewer component, and have better dynamic range. However, the preceding technique can be ued if an exact gain i required from the filter. If an odd-order approximation factor i to be implemented, an odd-order tage a hown in Figure 4.3 can be ued a the firt tage of the active filter. Thi imple RC filter i followed by a buffer amp o that the output impedance of the RC combination will not affect the input to the next active filter tage. However, if an op-amp i going to be required to implement thi firt-order factor, we might conider adding a few more component and implementing a econdorder tage intead. In many cae, additional attenuation in the topband would be welcome, and the additional cot i light.

100 Analog Filter Implementation Uing Active Filter 9 Figure 4.3 Firt-order lowpa filter with buffer amp. The tranfer function for the firt-order tage i given in 4.9. Thi tranfer function mut match a firt-order approximation function a given in 4.0: / RC H c 4.9 / RC G a H a b 4.0 Again, the value of a and b will be identical and G will have a value of. Then uing the value of C that ha already been picked, R / b C 4. Example 4. illutrate how to ue the information preented in thi ection to deign an active lowpa filter. Example 4. Butterworth Lowpa Active Filter Deign Problem: Determine the reitor and capacitor value to implement a Butterworth lowpa active filter to meet the following pecification: a pa db, a top 50 db, f pa 000 H, and f top 4000 H Solution: Firt, we find that a fifth-order filter i required. The reulting unnormalied approximation function can then be determined to be H a 7,9. 7, , , The three factor in the denominator can now be matched to three active filter tage. By picking C 0.0 µf and R A 0 kω, the remaining value for each tage can be calculated from and 4.. The firt-order tage doe not require an R B value. 6

101 9 Practical Analog and Digital Filter Deign m R m K m R Bm kω 3.90 kω kω 3.90 kω kω In order to achieve a gain of exactly at ω 0, we can ue a voltage divider at the output. Firt, we determine K tot K tot K m 3.99 m Thi value along with the fact that G tot ha a value of allow u to determine that GA The following reitor divider value can then be determined auming a required output impedance of 0 kω. The gain adjutment could be factored into the overall gain of the ytem intead of uing the voltage divider. R x 3.9 kω, R y 4.36 kω The reulting active filter i hown in Figure 4.4. We will generate the C code for the determination of thee component value in a later ection of thi chapter. Figure 4.4 Butterworth lowpa active filter for Example HIGHPASS ACTIVE FILTERS USING OP-AMPS We will alo ue a Sallen-Key circuit configuration for implementing a highpa filter. The circuit for implementing a econd-order factor i hown in Figure 4.5, with the tranfer function for the tage hown in 4.. We can ee that thi highpa configuration i the ame a the lowpa cae except that the primary R and C have changed poition, although R A and R B remain in their original poition.

102 Analog Filter Implementation Uing Active Filter 93 Figure 4.5 Sallen-Key highpa active filter tage. K H, H c [ / RC / RC K / RC ] / R RCC 4. where again K R B / RA 4.3 We can ue the ame procedure in electing the component value a we ued in the lowpa cae by letting R R and C C. The reult i hown in 4.4, where we ee that the denominator i identical to the lowpa cae in 4.8: K H, H c [3 K / RC] / R C 4.4 Thi equation can then be matched to the quadratic factor from the approximation function that have the form hown in 4.5 G H, H a b b 4.5 When the equation for the approximation function i compared to the equation for the active filter tage, we ee that the relationhip between term are identical to thoe of the lowpa cae. Therefore, if we pick the ame value of capacitor, the reitor value will be identical to thoe of the lowpa cae, a hown below: R / b C 4.6

103 94 Practical Analog and Digital Filter Deign R B b / R b A / 4.7 The adjutment of gain for the highpa cae i handled in a imilar manner to the lowpa cae. A 4.4 indicate, the K value of each tage can be determined by allowing the frequency to approach infinity, a oppoed to ero in the lowpa cae. K tot can then be eaily determined, and with the approximation function gain, the gain adjutment factor GA can be determined a hown previouly in 4.4. A reitive voltage divider i ued at the output of the lat tage of the active filter. If neceary, a buffer amplifier can be ued after thi voltage divider if the impedance of the network being driven by the filter i too mall. If an odd-order highpa approximation factor i to be implemented, an active filter tage a hown in Figure 4.6 can be ued a the firt tage of the active filter. The only difference between thi tage and the lowpa firt-order tage i the interchange of R and C value. Figure 4.6 Firt-order highpa filter with buffer amp. The tranfer function for thi tage i given in 4.8, while the approximation function for a firt-order highpa factor i hown in 4.9: H c / RC 4.8 G H a b 4.9 A in the econd-order cae, the reitor value will be the ame a the lowpa value auming that the ame value of capacitor i picked. R / b C 4.30 Example 4. Chebyhev Highpa Active Filter Deign Problem: Determine the reitor and capacitor value to implement a Chebyhev highpa active filter to meet the following pecification:

104 Analog Filter Implementation Uing Active Filter 95 a pa 0.5 db, a top 30 db, f pa 000 H, and f top 400 H Solution: A fourth-order tranfer function a hown below i required. Since thi i an even-order Chebyhev, there i an adjutment factor of included in the numerator. H a, , The two quadratic term can be matched to two active filter tage by again picking C 0.0 µf and R A 0 kω. The other circuit value can be calculated a hown below: m R m K m R Bm kω kω 9.50 kω kω In order to achieve a gain of exactly at ω, we can ue a voltage divider at the output. Firt, we determine the gain adjutment factor for the filter that in thi cae include not only the K m factor for each quadratic, but alo the approximation function gain of : GA K m / m Figure 4.7 Chebyhev highpa active filter for Example 4.. Auming an equivalent reitance of 0 kω, the reitor divider value can be determined with the reulting filter hown in Figure 4.7. The gain adjutment could be factored into the overall gain of the ytem intead of uing the voltage divider. R x k Ω, R. 89 kω y

105 96 Practical Analog and Digital Filter Deign 4.4 BANDPASS ACTIVE FILTERS USING OP-AMPS Figure 4.8 how a Sallen-Key active filter tage that implement a econd-order bandpa tranfer function. The tranfer function for thi bandpa tage i given in 4.3. Figure 4.8 Sallen-Key bandpa active filter tage. K / R C H, P c K R RC R3C R3C R C R R R R C C where again K R B / RA 4.3 We can implify thi function by letting R R R 3 and C C. Thi implified function i given in 4.33: K / RC H, c L [4 K / RC] / R C 4.33 Thi bandpa tranfer function can now be matched to the general form of the approximation factor, a hown in 4.34: a H, H a b b 4.34 After matching equivalent denominator term, the following equation emerge,

106 Analog Filter Implementation Uing Active Filter 97 b 4 K RC 4.35 b R C 4.36 which lead to R b C 4.37 K 4 b b 4.38 R B R A 3 b b 4.39 After thee calculation are made, the overall gain of the active filter mut be determined. Thi i a more difficult tak than for the lowpa and highpa cae ince the gain adjutment mut be determined at the center frequency of the paband ω o. If we refer again to 4.33 and 4.34, we ee that they will have identical denominator coefficient ince we have jut derived the equation to guarantee that. However, the numerator differ by the contant that are preent. The gain adjutment factor for each tage i then the ratio of the two numerator contant, a hown in The total gain adjutment i then the product of thee tage gain adjutment: GA K m / a m RmCm m 4.40 Once the total gain adjutment ha been determined, a voltage divider tage at the output of the active filter can be ued for compenation. Example 4.3 Butterworth Bandpa Active Filter Deign Problem: Determine the reitor and capacitor value to implement a Butterworth bandpa active filter to meet the following pecification: a pa.5 db, a top 8 db, f pa,000 H, f pa,000 H, f top 500 H, and f top 4,000 H

107 98 Practical Analog and Digital Filter Deign Solution: A third-order equivalent lowpa filter i needed, which indicate that a ixth-order bandpa function will reult a hown below: H a 7, , , By picking C 0.0 µf and R A 0 kω, the remaining value can be determined by matching the three quadratic term: m R m K m R Bm GA m kω kω kω kω kω kω 4.48 The combined gain produced by the active filter tage at ω ω o i determined to be.783, which can be compenated by a voltage divider at the output of the filter. If the output reitance i to be 0 kω, the voltage divider reitor value are given below. Note that in thi cae, if a voltage divider were ued, a gain of over over 40 db would be acrificed. It would be better to include thi in the ytem gain. R x 8 kω, R y 0.5 kω The reulting bandpa filter i hown in Figure 4.9. Figure 4.9 Butterworth bandpa active filter for Example BANDSTOP ACTIVE FILTERS USING OP-AMPS Figure 4.0 how a twin-tee bandtop active filter tage that can implement a variety of econd-order function. The admittance labeled Y can repreent a conductance G, or a uceptance C, or can have ero value not be preent at all.

108 Analog Filter Implementation Uing Active Filter 99 Figure 4.0 Twin-tee bandtop active filter tage. The general form of the tranfer function for thi filter i given in 4.4: K R C H c, S 4 K RY RC R RY C 4.4 where again K R B / RA 4.4 Equation 4.43 rewrite thi equation in term of the pole frequency ω p and the ero frequency ω : H c, S K ω ω / Q ω p p 4.43 The tranfer function of 4.43 mut be matched to the general form of a bandtop approximation function, a hown in 4.44: G a H, S a b b 4.44 Depending on the value of Y elected, ω may be greater than, equal to, or le than ω p. Thi will affect the matching of the repective term in 4.43 and The repone for the tranfer function will alo change, a indicated in Figure 4.. Let look at how the tranfer function change for the three cae.

109 00 Practical Analog and Digital Filter Deign Figure 4. Bandtop filter repone. Firt, we conider the cae where no Y element i preent Y 0, in which cae the tranfer function can be implified a hown in Note that thi function ha the condition that ω ω p a b, which will produce a bandtop repone a hown in Figure 4.a. Notice that the repone ha the condition that the upper and lower paband have equal gain. K R C H, S 0 c 4 K RC R C 4.45 The election of component to implement thi type of repone i relatively eay a we match the term of 4.44 and By firt picking a value of C, the reult are R a C K b b 4.47 R B R A 4 b b 4.48

110 Analog Filter Implementation Uing Active Filter 0 Next, in the cae where Y G o /R o, the reulting tranfer function i given in Note that thi function ha ω < ω p a < b, which will produce a bandtop repone a hown in Figure 4.b. Thi i ometime referred to a a highpa notch filter becaue the gain of the upper paband i larger than that of the lower paband., / / 4 C R R R R RC R R K C R K H o o o S c 4.49 The election of component to implement thi type of repone i again determined by matching term and by firt picking a value of C; the reult are C a R 4.50 [ ] / a b R R o 4.5 a a b a b K 4.5 a a b a b R R A B 4.53 Finally, in the cae where Y C o, the reulting tranfer function i given in Note that thi function ha ω > ω p a > b, which will produce a bandtop repone a hown in Figure 4.c. Thi i ometime referred to a a lowpa notch filter. 4, o o o o S c C C C R C C C RC C C K C R C C C K H 4.54 The election of component to implement thi type of repone i again determined by matching term and by firt picking a value of C; the reult are

111 0 Practical Analog and Digital Filter Deign R a C 4.55 [ a / ] C o C b 4.56 K a b b a b 4.57 R B R A a b b a b 4.58 After thee calculation are made, the overall gain of the active filter can be determined by evaluating the tranfer function at ω 0 or ω. If the gain of the circuit i to be determined at ω 0, then the value of K for that tage i ued except for the highpa notch tage. In that cae, an additional multiplication factor of R o / R o R hould be included a een from If the gain i to be determined at an infinite frequency, then the lowpa notch tage will have a gain that mut be increaed by a value of C / C C o, a indicated by Thee value will be the ame and can be included in the circuit uing a voltage divider. Example 4.4 Chebyhev Bandtop Active Filter Deign Problem: Determine the reitor and capacitor value to implement a Chebyhev bandtop active filter to meet the following pecification: a pa db, a top 40 db, f pa H, f pa,500 H, f top H, and f top,00 H Solution: A third-order lowpa equivalent function i required, which indicate that a ixth-order unnormalied bandtop approximation function will be neceary, a hown below: H a 0, , By picking C 0.0 µf and R A 0 kω, the remaining value can be calculated by matching term. Note that there are three denominator quadratic with three different value of contant term. One of thee value i larger than the numerator contant term, one i equal to the numerator contant term, and one i maller than the numerator contant term. Thi indicate that one of the tage will

112 Analog Filter Implementation Uing Active Filter 03 have an R o value, one will have no Y element, and one will have a C o value, repectively. m R m K m R Bm Y m kω kω 5.9 kω kω C o nf 5.9 kω kω R o 6.33 kω The combined gain produced by the active filter tage at ω 0 or at infinity i 3.74, which include the product of the three K value and either the capacitor or reitor ratio of The voltage divider reitor value can be calculated accordingly. The reulting bandtop filter i hown in Figure 4.. R x 374. k Ω, R 4.60 kω y Figure 4. Chebyhev bandtop active filter for Example IMPLEMENTING COMPLEX ZEROS WITH ACTIVE FILTERS Up to thi point in the chapter, we have not dicued the implementation of rational function uch a the invere Chebyhev and elliptic approximation. In previou chapter, we dicovered that the primary difference between all-pole and rational approximation function wa that the rational function required complex ero on the jω axi in the -plane. The general form of a rational function quadratic factor i hown below. If the a coefficient i ero a it i for ero on the jω axi, the quadratic factor i identical to the form of a bandtop function derived for the all-pole repone in the lat ection. G a H, a S b a 4.59 b

113 04 Practical Analog and Digital Filter Deign Therefore, we have already developed an active filter form to implement the invere Chebyhev and elliptic approximation. It i the twin-tee filter preented in the previou ection. We can ue that form for any of the electivitie lowpa, highpa, bandpa, or bandtop when deigning invere Chebyhev or elliptic filter. However, there are a few pecial concern that mut be conidered when implementing filter approximation function with complex ero. If a lowpa or highpa approximation function ha an odd-order, the firt-order factor hould till be implemented by the appropriate firt-order tage dicued previouly. In addition, for the cae of a bandpa approximation, if the function wa derived from an odd-order lowpa function, then the quadratic factor aociated with the firt-order factor hould be implemented by a Sallen-Key bandpa active filter ection. The other quadratic factor of the bandpa function and the quadratic factor of the lowpa and highpa function are then implemented by the twintee notch filter. Of coure, all tage of a bandtop filter of any approximation ue the twin-tee configuration. Two example will now be ued to demontrate the procedure of implementing invere Chebyhev and elliptic approximation. Example 4.5 Invere Chebyhev Lowpa Active Filter Deign Problem: Determine the reitor and capacitor value to implement an invere Chebyhev lowpa active filter to meet the following pecification: a pa db, a top 60 db, f pa 00 H, and f top 300 H Solution: In thi cae, a fifth-order filter will be ued. We can determine the required approximation function to be H a , The two quadratic term mut be matched to two twin-tee active filter tage while the firt-order factor can be implemented by a imple RC tage. By again picking C 0.0 µf and R A 0 kω, the remaining value can be calculated. Note that in thi lowpa cae, both twin-tee ection employ a capacitor a the additional admittance element. m R m K m R Bm Y m kω kω kω C o 6.0 nf 3.8 kω kω C o nf We determine the gain adjutment factor by finding K tot, a hown below.

114 Analog Filter Implementation Uing Active Filter 05 Ktot K m. 943 m If the deired output reitance i 0 kω, the following value reult for the voltage divider with the final filter hown in Figure 4.3. R x 9. 4 k Ω, R kω y Figure 4.3 Invere Chebyhev active lowpa filter for Example 4.5. Example 4.6 Elliptic Bandpa Active Filter Deign Problem: Determine the reitor and capacitor value to implement an elliptic bandpa active filter to meet the following pecification: a pa db, a top 60 db, f pa 50 H, f pa 400 H, f top 00 H, and f top,000 H Solution: The order of the equivalent lowpa filter i 3, which indicate that a ixth-order bandpa approximation function will be neceary. The tranfer function i hown below: H a Thee three quadratic term mut be matched to three active filter tage. The tage related to the firt-order factor in the normalied LP filter i implemented by the tandard Sallen-Key bandpa filter. The other two tage are implemented uing the twin-tee filter. By picking C 0.0 µf and R A 0 kω, the remaining value can be calculated a hown below. One of the twin-tee tage will have a R o 8.86 kω and the other will have C o nf. 6

115 06 Practical Analog and Digital Filter Deign m R m K m R Bm Y m kω kω 4.3 kω kω C o nf 79. kω kω R o 8.86 kω The combined gain produced by the active filter tage at ω 0 i and that can be compenated by a voltage divider after the lat tage. The voltage divider reitor value are hown below and are calculated to provide an output impedance of 0 kω. The reulting bandtop filter i hown in Figure 4.4. R x k Ω, R.9 kω y Figure 4.4 Elliptic bandpa active filter for Example ANALOG FILTER IMPLEMENTATION ISSUES In the previou ection, we determined component value neceary to implement our analog filter deign in the form of active filter. Thee active filter make ue of electronic component that can be manufactured only to a finite accuracy. The component are not perfect when they are firt manufactured and can change value becaue of aging or expoure to heat, chemical, or humidity. Therefore, it i important to elect the bet type of component for our purpoe active filter implementation. Although we can buy preciion component that reit change, the cot of uch component can be expenive. It i mot cot effective to pecify preciion component only for thoe poition that actually require it. We can determine which component are in critical poition by performing a enitivity analyi Component Selection Each active filter tage i made up of a combination of reitor, capacitor, and op-amp. There are important iue in the election of each of thee component.

116 Analog Filter Implementation Uing Active Filter 07 We tart with a dicuion of the active device in our deign and then dicu capacitor and reitor in turn. The op-amp i the amplifying device in our deign and the repone of the filter i baed on the aumption that the op-amp i ideal. We aume that the input impedance i infinite actually M 00 MΩ depending on device, the output impedance i ero actually 00,000 Ω, and that the op-amp can amplify frequencie up to infinity actually the bandlimit i uually M 0 MH. Thi later characteritic i pecified by the op-amp gain-bandwidth product GBP. Thi number provide a reference that can be ued to determine the open loop gain of the op-amp at any frequency or vice vera. For example, the GBP of a 74 opamp i 0 6, which indicate that thi amplifier ha an open loop gain of,000 at a frequency of,000 H. Alternatively, we could ue thi GBP to predict that an upper frequency limit of 0,000 H wa available with an open loop gain of 50. The important point to remember, however, i that the tranfer function of the active filter were derived auming that the gain of the op-amp ued were very large for all frequencie of interet in the deign. Therefore, whether or not the active filter i a lowpa, highpa, bandpa, or bandtop filter, the open loop gain of the op-amp mut be large for all frequencie of interet. Thee frequencie of interet include not only the paband, but alo the topband. Luckily, there are many option other than 74 when it come to pecifying the active device to be ued. Capacitor repreent the reactive element in our active filter becaue they have a reactance that change with frequency unlike reitor. There are many type of capacitor manufactured today including electrolytic, ceramic, poly, film, and other. Each capacitor type ha a place and i manufactured to erve a pecific purpoe in the electronic world. For example, electrolytic capacitor are generally ued in power application where large value up to 0,000 uf are important and variation in value are not the mot important criterion for election. They are the farthet from ideal of any of the capacitor type and hould not be ued in active filter deign. Ceramic capacitor generally have very mall value in the pf range and are ued mot often in application operating in the megahert range. Generally, active filter will not be operating at that frequency becaue of the limitation of the op-amp. The mot commonly ued capacitor for active filter are referred to a poly capacitor. There are a number of type that fall into thi category polytyrene, polypropylene, polycarbonate, and polyeter, where the different name indicate the dielectric ued in their contruction. There are tradeoff with regard to tolerance, cot, and characteritic, but in general you will find thee type effective in active filter deign. In the cae of reitor, there are a variety of type, including carbon compoition, carbon film, metal film, wire-wound, and other. Wire-wound reitor are rarely ued except in power application, and carbon compoition reitor generate exceive amount of noie. Therefore, in our application, either metal film or carbon film reitor are uually ued. You will find carbon film device ued for 5% tolerance value meaning that the value of the reitor could be ±5% of it nominal value. The metal film device will have a lower temperature

117 08 Practical Analog and Digital Filter Deign coefficient meaning that it will diplay le variation with change in temperature and i generally manufactured to % tolerance. Value are typically available from 0 Ω to 0 MΩ. Becaue of the nature of the active device ued op-amp it i bet to keep the reitor value ued in a filter between kω and 00 kω, if poible, and certainly between 00 Ω and MΩ. Otherwie, the aumption about the impedance of the op-amp being ideal are no longer valid and the repone of the filter may not be a expected. Hopefully, thi brief dicuion will get you tarted in the implementation of your active filter. For further information, conult the reference given in the analog filter deign ection of Appendix A Senitivity Analyi After electing the bet component for the active filter, it i important to identify which of thee component ha the mot effect on the overall performance of the filter. Since no component i perfect, and they all will change with age, temperature, and other influence, thee effect on the filter repone can be minimied by electing the mot critical component to have the lowet tolerance to change. We can determine the mot critical component in a deign by performing a enitivity analyi. A enitivity analyi i the proce of finding out how any or all of the characteritic of a filter are affected by each and every component that make up the filter. For example, the enitivity of a function F with repect to x i defined in Note that enitivity not only conider the change in F a a function of x, but alo the nominal value of F and x. Therefore, the enitivity conider the per unit change of the function with repect to the per unit change of the parameter. Uing the definition of 4.60, other common enitivity relationhip can be determined a hown in The value c i conidered a contant and G i another function of x. S F x [ ln F ] [ ln x ] x F 4.60 F x cx S x 4.6 S / F x S F x 4.6 FG x F x S S S G x 4.63

118 Analog Filter Implementation Uing Active Filter 09 S F / G x S F x S G x 4.64 F S c x c S F x 4.65 F x S c F x S c 4.66 In each of the preceding ection, a tranfer function for an active filter wa given in term of the reitor and capacitor value ued to make up the circuit. In general, thoe function can be pecified in term of the pole and ero frequencie and quality factor Q a hown in 4.67: ω Q ω H K 4.67 ω Q ω p p p If we conider the lowpa active filter of Section 4., which ha a tranfer function a indicated in 4.68, we can eaily match term to identify the pole frequency and Q in term of the component value a hown in 4.69 and 4.70: K / R R C C H, L c [ / RC / RC K / RC ] / R RCC 4.68 ω p / R R C C 4.69 Q p R C / R R C C R C K R C 4.70 The enitivity of either one of the parameter lited above to any one of the reitor or capacitor value can now be determined. For example, S ω p R

119 0 Practical Analog and Digital Filter Deign which indicate that for every.0% increae in R there i a 0.5% decreae in ω p. Likewie, we find that S R C Qp 0.5 Q R p RC 4.7 which for equal reitor and capacitor value become Q R S p 0. 5 Q p 4.73 Equation 4.73 indicate that the enitivity of Q p with repect to R can be quite high ince Q value can reach 50 to 00. Therefore, the election of R and C value for the active filter play an important part in the overall enitivity of the circuit. We do not have pace for a full treatment of enitivity analyi in thi text. However, reference in Appendix A provide further detail on enitivity and on method of electing component value that yield low enitivitie. The text by Daryanani provide a particularly good preentation. In fact, that text preent a different choice for the component value for a Sallen-Key active filter a lited below. By making thoe election, it can be hown by ubtitution into 4.70 that Q p i no longer a function of R at all and therefore would have a enitivity of ero with repect to change in reitance value: K, R R R C Q p, C R ω R Q ω p p p A enitivity analyi provide u with valuable information about the component value ued in the circuit. With that information, we can determine which component are critical in controlling variation in key filter parameter. However, it i alo very important to perform a wort-cae analyi on the circuit. Thi analyi of the circuit would ue the enitivitie that have already been determined to et each component to the extreme limit of it tolerance in order to ee the effect on the overall circuit performance. For example, all component with negative enitivitie would be et to their lower tolerance limit while all component with poitive enitivitie would be et to their upper limit. The circuit would then be analyed to ee if it till met the pecification. Next, all component value would be et to the oppoite limit and the tet would be repeated. If a circuit paed thi tet, it hould perform up to pecification with

120 Analog Filter Implementation Uing Active Filter the randomly choen value ued when it i aembled. An example of a wortcae analyi uing PSpice i given in Section 4.8. Another type of tatitical tet that i le rigorou than a wort-cae tet, but probably more typical of what will happen in real life, i the Monte Carlo imulation. In thi tet, component value are elected randomly within their tolerance range and the circuit i teted to ee if it meet the required pecification. In mot oftware package, the value can be characteried a having a Gauian or uniform ditribution. A number of Monte Carlo tet are uually run to imulate the variation of component value that will be een in the normal aembly proce. 4.8 USING WFILTER IN ANALOG FILTER IMPLEMENTATION In order to ee how WFilter help in analog filter implementation, we generate the component value and PSpice data file for the problem given in Example 4.5. After we enter the filter pecification and deign the filter, we can pecify the common component value and frequency pecification in the Circuit Specification dialog box hown in Figure 4.5. Thi dialog box i diplayed by electing Option and then Generate Spice File from the menu bar. Figure 4.5 Circuit pecification dialog box. We have entered a common capacitor value of 0. µf and common reitor value of 0 kω. In addition, we have pecified the frequency analyi range to be from 0 H to kh. After preing the Show File button, the PSpice text file hown in Liting 4. i diplayed. Notice that the firt tage i firt-order with an R B value of one ohm mot circuit analyi tool do not accept ero ohm, while the other two tage decribe twin-tee notch filter. The original calculated value are hown in the liting and hould be ued in a tet analyi of the circuit to determine if the pecification have been met. If the pecification are not met with thee ideal value, either the op-amp model i not adequate or an error ha been encountered in the deign tep.

121 Practical Analog and Digital Filter Deign Example 4.5 and PSpice Example * Specify input ource: V 0 AC 0 * Stage Number Practical Value R.55E04.5E04 C 0.000E-07.00E-07 Rb 3.000E00.00E00 X 3 OPAMP * Stage Number C.000E-07.00E-07 C 4.000E-07.00E-07 C E-07.00E-07 R E E03 R E E03 R3 3.53E03.49E03 Ra E04.00E04 Rb E04.94E04 Co E-07.70E-07 X OPAMP * Stage Number 3 C E-07.00E-07 C E-07.00E-07 C E-07.00E-07 R E E03 R E E03 R E03.54E03 Ra E04.00E04 Rb E E04 Co E E-07 X OPAMP * Voltage divider ection Rx E05.3E05 Ry E04.05E04 * Sub-circuit model for op-amp.subckt OPAMP 6 Ri.000E08 E E03 Rx E03 Cx E-09 E E03 Ro E00.ENDS * Analyi mode.ac DEC E0.000E03.PROBE.END Liting 4. Circuit analyi data file for Example 4.5. The next tep in the teting of the active filter i to replace the ideal component with practical value. For thi exercie, we will ue % reitor and % capacitor value. The elected value are hown in italic and parenthee in the liting. A wort-cae analyi can then be run on the circuit that involve adding tolerance information for the component value. You need acce to the PSpice program to make thi run. During the wort-cae analyi, enitivitie for each component are determined, and a the final tep, each component i et to it wort-cae extreme. Figure 4.6 how both the wort-cae and nominal repone.

122 Analog Filter Implementation Uing Active Filter 3 If the two frequency repone were carefully compared, we would ee that there i a.5 db bump in the paband, and we loe over db in the topband attenuation. Thee change hould repreent the wort that can happen due to the unfortunate election of the wort poible combination of component. A wort-cae analyi wa alo run with 5% reitor value and 0% capacitor value and the bump increaed to 5 db. A Monte Carlo analyi can alo be run on the circuit to indicate the more typical extreme that might be encountered. Depending on the nature of the application, we can live with the reulting variation, elect even more precie expenive component, or redeign the filter to more tringent pecification than actually deired. Thi redeigned filter would then be able to vary to ome degree while till atifying the real pecification. However, thi filter may alo require a higher order, which will add cot to the project. Figure 4.6 Frequency repone for Example CONCLUSION We have reached the end of the firt part of thi text. We were able to deign a variety of analog filter, view their frequency repone, and implement them in an active filter form. Of coure, we have left a good deal of material uncovered. There are other filter type that could have been dicued. There are other feature that could have been included in the frequency repone calculation and diplay. Moreover, there are other implementation technique available for analog filter. However, it i now time to move into the realm of digital filter. We will

123 4 Practical Analog and Digital Filter Deign ee that our work in the area of analog filter will prove valuable, ince one form of a digital filter ue much of what we have learned o far. For thoe who are intereted in eeing the code ued to generate the PSpice circuit file, pleae turn to Appendix F.

124 Chapter 5 Introduction to Dicrete-Time Sytem Although mot naturally occurring ignal are of the analog variety continuouamplitude and continuou-time variation, we are finding that converion of thee ignal to a digital form dicrete-time and dicrete-amplitude variation provide many advantage. For example, digital ignal can be tored on computer floppy or hard dik. They can be compreed to ave pace, converted to other format, or tranmitted in combination with other ignal. Digital form of ignal are truly becoming the tandard in everyday ue a compact dic CD for audio and multimedia application can attet. Therefore, the remainder of thi text i devoted to the application of filtering technique to digital ignal. The material in thi chapter hould provide a review of the baic principle of dicrete-time ytem that are neceary to undertand the material preented in the remainder of the text. In the firt ection of thi chapter we will dicu the proce of converting analog ignal into a digital form. Next, we will develop method of dealing with dicrete-time ignal in both the time domain and frequency domain. We will alo learn how to find the frequency repone of a dicrete-time ytem a well a how to play digitied waveform on a computer equipped with a ound card. 5. ANALOG-TO-DIGITAL CONVERSION A indicated in the introduction, mot of the ignal that we deal with every day are known a analog ignal. Thi type of ignal ha a continuou variation in both time and amplitude, a hown in Figure 5.a. In order to convert thi analog ignal to a digital ignal with dicrete-time and dicrete-amplitude, a hown in Figure 5.b, everal tep mut be performed. Firt, the frequency pectrum of the analog ignal mut be trictly bandlimited. Second, the ignal mut be ampled at the proper ampling rate. Third, the ampled value mut be quantied to an acceptable level of accuracy. When it i time to convert the digital ignal back to analog form, there are a number of method that can be ued, but one imple method require only two tep. The firt 5

125 6 Practical Analog and Digital Filter Deign tep i to output the digital value of the ignal and hold it for the duration of the ample period. The econd tep i to pa that ignal through a lowpa filter. In order to undertand the reaon why thee tep are neceary for analog and digital converion, we need to tudy the frequency pectrum of a ampled ignal and the requirement placed on the ampling rate. Figure 5. Comparion of analog and digital ignal. 5.. Frequency Spectrum and Sampling Rate When an analog ignal xt i ampled, a hown in Figure 5., the ample are uually taken at equal interval of time. Thi ampling period T i the invere of the ampling frequency f. The reulting digitied waveform x nt can be pecified with an argument indicating the ampling period T, a hown in 5.: x nt x t 5. t nt For example, if we had an analog ignal xt a pecified in 5., the ampled verion of the ignal x nt a hown in 5.3 would reult: x t 50 e 00t co00 t 5. 00nT x nt 50 e co00 nt 5.3 If we aume that the analog ignal i ampled at a frequency of,000 ample per econd, then we can calculate the value of x nt with T 0.00 econd. The value that reult can be tored a a equence of number, a hown

126 Introduction to Dicrete-Time Sytem 7 below. Thi i an important point: once an analog ignal ha been digitied, it i nothing more than a equence of number that can be tored, manipulated, tranmitted, or proceed in any way we ee fit. x nt {50.0, 44.3, 37.7, 30.6, 3.4,6.4,...}, n 0,, 5.4 Since the ampling period eldom change, dicrete-time equation uually drop the ampling period T from the expreion to produce an expreion uch a 5.5. The ampling period will not be needed again until the digitied waveform i converted back to analog form. x n 5 e 0n co00 n 5.5 Although it doen t appear that much ha changed in the repreentation of the ignal in the time domain, a great deal ha changed in the frequency domain. The frequency pectrum of a ignal i hown in Figure 5.a before ampling. If thi ignal were ampled at a frequency of f, the pectrum of the ampled ignal would be a hown in Figure 5.b. The original analog pectrum i replicated throughout the pectrum at interval of f although only one intance of that i hown. Becaue of thi replication, it i feaible that there will be corruption of the frequency component of the original ignal by component of the replicated ignal. Thi corruption i referred to a aliaing, and the offending frequencie are alia frequencie. Further detail of aliaing and the upcoming Nyquit criteria can be found in mot of the digital filter deign reference in Appendix A. Figure 5. Spectrum of ignal a before and b after ampling.

127 8 Practical Analog and Digital Filter Deign When digitiing a ignal, it i very important to capture mot, if not all, of the information preent in the original analog ignal without generating alia frequencie. For thi reaon, a good deal of tudy ha gone into the condition neceary to faithfully convert an analog ignal into a digital form. We can ee by cloely oberving Figure 5.b that if we are to eliminate the effect of aliaing, the ampling frequency mut be at leat twice a high a the highet frequency in the original ignal. Thi relationhip, a hown in 5.6, i known a the Nyquit criteria, and i a well-known requirement in ampling theory: f > f h 5.6 In order to guarantee that thi requirement i met at all time, it i normal procedure to band-limit the input ignal to one-half of the ampling frequency once the ampling frequency ha been et. Thi i a prudent meaure, ince frequencie beyond thoe which are normally expected can occaionally occur in all ytem. The band-limiting proce can be implemented by ending the analog ignal through an analog lowpa filter prior to ampling. What an excellent ue of our analog filter theory! 5.. Quantiation of Sample Once the analog ignal ha been ampled, it i a dicrete-time ignal ince value of the ignal exit only at particular moment of time, but the amplitude of the ignal i till continuou. Then, the next tep in the analog-to-digital converion ADC i to quantie the continuou-amplitude ignal to one of many dicrete value of amplitude. The number of poible value allowed for the amplitude i determined by the ie of the variable choen to tore the value. For example, if a ingle byte of memory 8 bit i choen to tore the information, then the amplitude can take on one of 8 or 56 different value. If the original ignal had a range of amplitude from volt to volt, then the difference between adjacent amplitude would be approximately volt. On the other hand, if two byte of memory 6 bit were ued to tore each ample, there would be 6 or 65,536 different value to repreent the ignal. With thi many value, the ± volt ignal would have adjacent amplitude eparated by only volt. Obviouly, the larger the variable ued to tore the ampled data, the more cloely we can approximate the analog ignal with the digital repreentation. In the previou dicuion it i aumed that uniform ampling wa ued where all level would be equally paced. There are alo technique that ue nonuniform pacing to place more level at lower level and wider pacing for larger ignal. However, the drawback of uing larger and larger variable i twofold. Firt, the torage requirement to tore the digitied waveform are proportional to the number of bit ued to quantie the ample. For example, uppoe we decide to

128 Introduction to Dicrete-Time Sytem 9 ample a peech ignal that contain ignal frequencie from 300 to 3,000 H at a frequency of 8,000 H which atifie Nyquit criteria. The waveform would need a file ie of 480,000 byte 480 kilobyte to tore one minute worth of data uing only byte per ample. On the other hand, if we tored one minute of tereo muic uing byte of data for each channel left and right, the file ie would need to be over 0 million byte 0 megabyte. Thi large file ie i neceary to accommodate a ampling rate of 44 kh, which i the normal rate ued for high-fidelity audio ignal with frequencie up to 0 kh. The econd drawback i the peed of converion from analog-to-digital form. Although ADC chip are very fat thee day, obtaining more accuracy require more time for converion. Eventually, a limit on accuracy will be reached becaue the converion cannot be made in the allotted ample interval. Thi limitation i more common when proceing video ignal that have bandwidth in the million of hert MH. It i important to note at thi point that theoretically the ampling of an analog waveform doe not normally produce any error. Thi aume that the ample clock doe not introduce error becaue of timing jitter. It i the quantiation of the ample that produce the error in a digital ytem. If the ample could be tored in their original continuou-amplitude form, they could be ued to regenerate the original ignal with no error auming the Nyquit criteria i met. The maximum amount of error introduced into the ytem by thi quantiation i equal to onehalf of the difference between amplitude level. A we can ee, electing a method for the digitiation of an analog ignal i a compromie between converion peed, waveform accuracy, and torage or tranmiion ie A Complete Analog-to-Digital-to-Analog Sytem Figure 5.3 how a block diagram of a complete ytem that firt convert an analog ignal to digital form for proceing, tranmiion, or torage. Then the converion i undone by converting the digital ignal back to analog form at another time and/or place uing a digital-to-analog converter DAC. A hown in Figure 5.b, the proce of ampling a ignal produce replica of the original analog pectrum at interval of the ampling frequency. In order to recover the original analog ignal we imply have to eliminate the frequencie higher than f /. Thi filtering i accomplihed by a high-order lowpa filter. A good example of uch a complete procedure i the proceing of audio ignal for a muic CD. The original ound of the muic are upplied by intrument or voice and are then recorded on tape in analog form. At ome later time, thee analog ignal are digitied and encoded on the compact dic. We can then buy thi CD and take it home and play it on our tereo ytem where the muical data i firt converted from digital to analog form and then reproduced for u. In thi example, the data i proceed, tored, and reproduced at a later time and different place.

129 0 Practical Analog and Digital Filter Deign Figure 5.3 Complete analog-to-digital-to-analog ytem. 5. LINEAR DIFFERENCE EQUATIONS AND CONVOLUTION In our tudy of dicrete-time ytem, we need to be able to decribe them in a number of different way. In thi ection we will learn how to decribe a dicretetime ytem by uing a difference equation and the ytem impule repone. The impule repone of a ytem i imply it repone to the dicrete impule function δn, a defined in 5.7. Thi function i the dicrete-time equivalent to the Dirac delta function δt ued in continuou-time ytem theory. The impule function i a very ueful function becaue any input ignal equence can be decribed by umming weighed and delayed verion of the impule function. Likewie, a dicrete-time ytem repone can be decribed by combining the repone to the input equence., for n 0 δ n 0, for n In addition, we will ue the unit tep function un in many of our expreion, o it definition i hown in 5.8. Thi function i the equivalent of the continuou-time tep function ut:, for n 0 u n 0, for n < Jut a ut can be defined a the integral of δt, un and δn have a relationhip built on the infinite ummation a decribed in 5.9:

130 Introduction to Dicrete-Time Sytem u n n 0 δ n Linear Difference Equation Continuou-time ytem often require the olution of one or more linear differential equation. In thi cae, value of the input and output ignal and their derivative are ued. The dicrete-time equivalent to thi analyi ue linear difference equation that make ue of pat and preent value of the input and pat value of the output. Note that intead of uing derivative, we are uing pat value of the ignal. One claic example of a dicrete-time ytem that can be eaily decribed by a difference equation i the bank account balance. Let yn reflect the balance in a aving account where xn dollar are depoited at the beginning of each month. We can aume that the account earn interet at a monthly percentage rate of I. If we let T, the ample period of the ytem, be one month, then the difference equation hown in 5.0 reflect the balance in the account at the beginning of each month: y n y n I /00 y n x n 5.0 If we aume that we depoit $00 each month and the interet i % per month, we can replace xn with 00un in 5.0 to produce the following reult: y n.0 y n 00 u n 5. Table 5. how the balance of the account for ix month, auming that we jut opened the account and the balance wa ero. Table 5. Balance in Saving Account Month Balance 0 $00.00 $0.00 $ $ $ $65.0 Although manual technique for the olution of thi difference equation are acceptable for ix month time, other method will need to be employed for

131 Practical Analog and Digital Filter Deign longer period of time. Let ee if we can determine a general formula for the balance of thi account. Starting with the firt month we find that y y.0 y y.0 y or in general y n 00 n k 0.0 k 5.5 Although thi expreion i compact, it till would require the calculation of the um of n term in order to determine the value. What we really need i a cloed form olution. Of coure I wouldn t have mentioned uch a thing if one didn t exit. We can define what i referred to a a finite geometric um, a hown below: FGS n k 0 a k 5.6 Then, with ome ingeniou mathematic, we can define a difference that cancel mot of the term: FGS a FGS n k 0 a k a n k 0 a k a n 5.7 Finally, we can determine the value of the FGS, a hown below. The value of FGS when a i determined directly from 5.6: a n FGS, for a a 5.8 n, for a

132 Introduction to Dicrete-Time Sytem 3 We can now write the equation for the balance of our aving account in a cloed form, a hown below. Thi expreion doe not need the calculation of n term in order for u to evaluate it. n.0 y n We can alo define the value of the infinite geometric um, a hown below: IGS k 0 a k 5.0 By imply allowing n in 5.8 to approach infinity, we can ee that IGS can be pecified a, for a < IGS a undefined otherwie 5. One way to completely define a dicrete-time ytem i by uing it difference equation. In general, the difference equation decribing the output for a dicretetime ytem can be written a M y n ak x n k b k 0 N k k y n k 5. We would have complete knowledge of the ytem if we know the coefficient a k and b k. A indicated in 5., the output yn i a function of pat and preent value of the input xn and pat value of the output. A ytem uch a thi i a recurive ytem. A ytem that ha it output decribed only by pat and preent value of the input i a nonrecurive ytem. We will ee in the chapter to come that thee definition effectively divide the type of digital filter to be deigned into two group a well. Notice that we have defined the output of our ytem in term of only pat and preent value of the input. Such a ytem i referred to a a caual ytem. Any real-time ytem, of coure, mut be caual ince we cannot determine the output of a ytem baed on input or output value we have not yet een. However, ytem that are not real-time can be noncaual. For example, any ytem that can draw it input from tored data can determine the output of the ytem at time n by

133 4 Practical Analog and Digital Filter Deign uing input value at n m. Thee future value are known ince they already have been tored. 5.. Impule Repone and Convolution Another way to completely decribe a dicrete ytem i to pecify the impule repone hn of the ytem. The impule repone of a ytem can be determined from the difference equation by ubtituting the impule function δn for the input xn and determining the output yn. Example 5. Determination of Impule Repone Problem: Aume that a dicrete-time ytem i decribed by the difference equation hown below. Determine the firt five value of the impule repone, and then formulate an analytic expreion for the impule repone. y n b y n x n Solution: Firt, the equation i modified to reflect the fact that the output will be the impule repone hn if the input i δn. h n b h n δ n Next, the et of the firt five value of the impule repone are determined uing Table 5.. Table 5. Reult of Impule Repone n δn hn hn b 0 b b 3 0 b 4 0 b 3 b 3 b 4 From thee reult we can ee that there i a general form to the impule repone, a hown below: n h n b u n When the impule repone of a ytem i known, the complete characteritic of the ytem are known. The reaction of the ytem to any other input can then be

134 Introduction to Dicrete-Time Sytem 5 determined by uing convolution imilar to the operation in continuou ytem. The output of the ytem can be defined a in 5.3 where the indicate convolution, not multiplication. In that expreion, we ee that the output of the ytem yn i determined by computing a um of product of the impule repone coefficient hn and pat value of the input xn k. Convolution ha the commutative property o the order of the function in the convolution definition i not important. From a practical tandpoint however, the impler function i typically pecified in the time-hifted format. Thi i the predominant method ued to implement an FIR filter, which i dicued in detail in Section 8.3. In addition, a number of the text lited in the digital filter deign ection of Appendix A cover dicrete-time convolution. k y n h n x n h k x n k 5.3 Example 5. Sytem Repone by Convolution Problem: Determine the output of the ytem decribed in Example 5. if the input i the ignal hown below: n x n a u n Solution: Since we already have the impule repone of the ytem, we can ue convolution to determine the output of the ytem. The equation for the output of the ytem i k y n x n h n x k h n k or y n n k nk n a u k b u n k b k k 0 a b k u n Note that the limit on the convolution ummation are adjuted by the function uk and un k. The tep function uk ha ero value for negative value of k and therefore the lower limit of the ummation i et to ero. The tep function un k will have ero value for all k value greater than n, and therefore the upper limit of the ummation i et to n. We can ue the form of a finite geometric um to implify the reult into a cloed form olution, a hown below:

135 6 Practical Analog and Digital Filter Deign for, for, a b b n a b a b a b n y n n n 5.3 DISCRETE-TIME SYSTEMS AND Z-TRANSFORMS It i alo important to be able to undertand a dicrete-time ytem characteritic in the frequency domain a well a the time domain. For linear ytem, the Laplace tranform can be ued to tranform time domain characteritic to the frequency domain. For dicrete-time ytem, we will ue the -tranform a defined in 5.4: 5.4 n n n x X n x } { The -tranform of a weighted impule function, for example, reult in a ingle term becaue the impule function ha only one nonero value. 5.5 A A n A n A n n 0 } { δ δ The -tranform of a weighted tep function can alo be determined uing the definition. In thi cae, the reult can be implified by uing the definition of the infinite geometric um. Some of the more common -tranform pair are hown in Table 5.3. } { 0 A A A n u A n u A n n n n 5.6 The -tranform alo ha a et of ueful propertie, a hown in Table 5.4. Firt and foremot i the property that the -tranform of the impule repone i the ytem tranfer function in the -domain. We ll ue that property in the next example. The econd property in Table 5.4 how that convolution in the time domain can be repreented a imple multiplication in the -domain. The third

136 Introduction to Dicrete-Time Sytem 7 property lited how that time delay of k unit of time can be repreented by multiplication by -k in the -domain. And finally, multiplication by n in the time domain can be repreented by differentiation in the -domain. For further dicuion of thee and other propertie of the -tranform or for a more comprehenive lit of -tranform pair, pleae refer to one of the reference text lited in Appendix A. Table 5.3 Common -Tranform Pair Time Domain Function Frequency Domain Function A δ n A A un A A A n un A a n u n A co Ω n u n A in Ω n u n n A a co Ω n φ u n A A A a [ co Ω ] co Ω A in Ω co Ω [ co φ a co φ Ω ] a co Ω a Table 5.4 Common -Tranform Propertie Time Domain Function Frequency Domain Function h n H x k x n k X X k x n k k X n xn df d

137 8 Practical Analog and Digital Filter Deign Example 5.3 Determining the Tranfer Function Problem: Determine the tranfer function of the ytem decribed in Example 5., which ha an impule repone of n h n b u n Find the location of the pole and ero of the tranfer function a well a the difference equation of the ytem from the tranfer function. Solution: Uing the fourth entry in the table of -tranform pair, we can determine that the tranfer function of the ytem decribed i Y H b b X We ee that there i a ingle pole denominator root at b and a ingle ero numerator root at 0. By cro-multiplication, the following equation reult: Y b Y X By taking the invere -tranform of thi equation and applying the time hift property of the -tranform, we can determine the ame difference equation, a in Example 5.: y n b y n x n Another way that a dicrete-time ytem can be decribed i by drawing a ytem diagram to repreent a general difference equation. Figure 5.4 how the ytem diagram for 5.. In the figure, delay are repreented by - and multiplication by triangular ymbol. Of coure, if a nonrecurive filter wa being repreented, the lower half of the ytem diagram would be eliminated ince the output of uch a ytem doe not depend on pat value of the output. In thi ytem diagram, we ee that each time the ignal move through a delay element the output i delayed by one ample interval. Although the ytem diagram i correct and will produce the correct output relationhip, there i a more efficient decription of the ytem. Firt, if we tranform the general difference equation of 5., we have Y N b k k k X M k 0 a k k 5.7

138 Introduction to Dicrete-Time Sytem 9 Figure 5.4 Sytem diagram of general dicrete-time ytem. From thi decription, we can determine the tranfer function H to be N k k k M k k k b a X Y H We can repreent 5.8 in a lightly different way to allow for further development: N k k k M k k k b a X W W Y Thi repreentation lead to two eparate relationhip, a hown below: 5.30 M k k a k W Y N k k b k W X W

139 30 Practical Analog and Digital Filter Deign Thee two equation in the -domain can be written in their equivalent form in the time domain by recogniing that k in the -domain repreent a delay of k ample period in the time domain. y n M k 0 a k w n k 5.3 w n x n M b k k w n k 5.33 The reult of thi derivation i that the general form of a dicrete-time ytem diagram can be drawn with more efficient ue of the delay unit by defining wn in the diagram. Since thee delay unit mut be implemented in hardware or oftware, the fewer ued the better. Figure 5.5 how the preferred method of drawing the ytem diagram with fewer delay. Figure 5.5 Sytem diagram with fewer delay unit. 5.4 FREQUENCY RESPONSE OF DISCRETE-TIME SYSTEMS The frequency repone i one of the mot important characteritic of a dicretetime ytem. Although it doe not completely decribe the ytem a the difference equation, impule repone, or tranfer function doe it doe not convey the tranient behavior of the ytem, the frequency repone doe provide important information about the teady-tate behavior of the ytem. We can begin by conidering an analog inuoidal ignal and the ampled ignal uing a ampling period of T.

140 Introduction to Dicrete-Time Sytem 3 x t A co ω t 5.34 x nt A co ω nt A co Ω n 5.35 where we have defined Ω ω T π f T π f / f 5.36 Equation 5.36 provide u with a method of comparing the analog frequency f to the digital frequency Ω. The range of analog frequencie acceptable for a dicrete-time ytem doe not extend from ero to infinity a would be the cae in a normal analog ytem. We mut remember that the upper limit of acceptable analog frequencie in dicrete-time ytem i governed by the Nyquit criteria, and therefore the range i defined a hown below. Note that a ubcript of d i appended to the frequency variable to indicate we are talking about an equivalent analog frequency within a dicrete-time ytem. 0 f d < f / 5.37 Combining thi condition with 5.36 reult in the following range of digital frequencie 0 Ω < π 5.38 Although a ine or coine function i uually ued to determine the frequency repone of a hardware ytem, both of thee function can be decribed by complex exponential, a hown below: e co Ω n j Ω n e jωn 5.39 e in Ω n j Ω n e j jωn 5.40 In fact, all periodic function can be repreented by thee exponential and even contant can be repreented a exponential with ero frequency. Therefore, when determining the frequency repone of a dicrete ytem, it i common to conider the driving function a the complex exponential, a hown below:

141 3 Practical Analog and Digital Filter Deign x n e jωn 5.4 The output of a dicrete-time ytem can then be determined by convolving thi input ignal with the ytem impule repone. The output i then k jω nk jωn y n h k e e h k e k jωk 5.4 Or, we can rewrite the reult a y n x n h k e k jωk x n H e jω 5.43 where He jω i defined a the frequency repone of the ytem. If we compare the definition of the frequency repone, a hown in 5.44, and the definition of the tranfer function for a ytem, a hown in 5.45, we ee a triking imilarity: jω k H e h k e jωk 5.44 k H h k k 5.45 We can take advantage of thi convenient imilarity by defining the frequency repone of a ytem in term of the tranfer function by imply allowing to be replaced by e jω. That i, j Ω H jω e H e 5.46 Example 5.4 Determining the Frequency Repone Problem: Determine the frequency repone of the ytem decribed in Example 5.3, which ha a tranfer function of

142 Introduction to Dicrete-Time Sytem 33 H Aume that b ha a value of 0.8 for thi ytem. Solution: The frequency repone can be found from the tranfer function by imply making the ubtitution of e jω : b H e jω H jω e e e co Ω j in Ω 0.8 co Ω 0.8 j in Ω jω jω H e jω.0 Ω co Ω 0.8 in Ω The value for the frequency repone can then be calculated by allowing the frequency Ω to range from 0 to π, a hown in Table 5.5. Note that the complex exponential e jω can be converted to a complex number in the rectangular form of coω j inω uing Euler relationhip or converted to polar form a Ω. Table 5.5 Frequency Repone Frequency Magnitude Phae deg π/ π/ π/ π Example 5.4 how that the frequency repone of a ytem i nothing more than a complex valued function of frequency. At any particular frequency, the complex value of the function can be determined and converted to polar form, a hown below: j Ω H e M Ω Φ Ω 5.47 In thi expreion, MΩ repreent the adjutment in magnitude that a ignal will experience a it pae through the ytem, and ΦΩ repreent the adjutment in phae that the input ignal will experience. For intance, if a digital ignal

143 34 Practical Analog and Digital Filter Deign π n x n 0co wa applied to the ytem of Example 5.4, the output ignal could be determined by multiplying the magnitude of the input by the magnitude of the frequency repone at Ω π/, and by hifting the phae of the input by the phae of the frequency repone at Ω π/. The reult could be written a [ π 30 ] y n co n or [ π 8. ] y n 5.6 co n Uing a digital frequency of Ω π/ may not be comfortable for analog filter deigner who are ued to working with much larger frequencie. Therefore it i important to note that thi digital frequency doe relate to ome analog frequency through the formula expreed in That equation i retated here in term of the equivalent analog frequency f d. We ee that thi frequency i a function of both the digital frequency and the ampling frequency for the ytem, a dicued earlier: f Ω π 5.5 d f Therefore, if we are dealing with a ytem with a ampling frequency of 0,000 ample/econd, it may be more natural to think of the input ignal above a being an analog ignal of,500 H that ha been converted to a digital frequency: π / f d 0,000,500 H 5.5 π Working with dicrete-time ytem will require u to be able to ue all the material dicued thu far in thi chapter. Some problem will be better expreed in the time domain, while other will be eaier to work with in the frequency domain. Some ytem analyi or deign will be eaier uing the ytem impule repone, while other will require the ue of the ytem tranfer function. A filter deigner, we will definitely need to determine the frequency repone of our ytem, and if we are to implement thee filter, a ytem diagram will be handy. So before we leave thi ection, let work an example that ue all the facet of dicrete ytem dicued o far.

144 Introduction to Dicrete-Time Sytem 35 Example 5.5 Complete Dicrete-Time Sytem Example Problem: Conider the difference equation for a dicrete-time ytem hown below. Determine the impule repone, tranfer function, and frequency repone of the ytem. y n.0 y n.8 y n 0.68 y n 3.0 x n 3.0 x n 3.0 x n.0 x n 3 Alo, find the location of the pole and ero for the ytem a well a draw the ytem diagram. Finally, determine the output of the ytem if the input i the analog ignal xt hown below. Aume that the ampling frequency i 0,000 ample per econd. x t 0 5 coπ,000t 60 0 inπ 8,000t 30 Solution: We begin the olution of the problem by tranforming the difference equation to determine the tranfer function for the ytem uch that Y Y.8 X 3.0 Y 0.68 X Y.0 X X or Y X H After we convert H to poitive power of, we factor the tranfer function in order to determine the pole and ero location. From the expreion, we ee that there are three ero at.0 and three pole at 0.8 and 0.6 ± j0.7:.0 H The frequency repone can now be eaily determined from the tranfer function, a indicated below: H e jω e jω e 0.8 e jω jω.0 3. e jω 0.85

145 36 Practical Analog and Digital Filter Deign If we are to determine the repone of our ytem to the ampled analog ignal, we need to convert the critical analog frequencie to digital frequencie. The DC term i ero frequency in either cae, while the analog frequency of,000 H convert to a digital frequency of π/5, and the analog frequency of 8,000 H convert to a digital frequency of 4π/5. The magnitude and phae repone for thi He jω are hown in Table 5.6. Table 5.6 Frequency Repone Frequency Magnitude Phae deg π/ π/ π/ π/ π By applying the magnitude and phae adjutment indicated in Table 5.6 for frequencie of 0, π/5, and 4π/5, we can determine the output of the ytem a: y t coπ,000 t inπ 8,000 t 36 The impule repone of the ytem can be determined by finding the invere - tranform of the tranfer function. The mot commonly ued method for finding the invere tranform i by uing partial fraction expanion of H/ and then matching the reulting term to one in the tranform table. H After uing the tandard method for evaluation of coefficient, we find H then we write H a the um of three term H

146 Introduction to Dicrete-Time Sytem 37 The firt two term can be eaily invere tranformed by matching term in the -tranform table. However, the third term relate to a damped inuoid and require ome manipulation before it can be invere tranformed A co φ A a co φ Ω a co Ω a By comparing denominator term, we find that a and Ω 0.867, while the numerator term provide A.337 and φ With thee value, the tranfer function can be invere tranformed to h n.4706 δ n n n u n co0.867 n u n There wa a good deal of algebra and trigonometry required to find the impule repone. If we need only a few of the firt term of the impule repone, or if we want to verify the correctne of our work, there i a ueful method that can be applied. If we return to the original H function and perform long diviion on the fraction, we will obtain a erie of term a hown: H H By invere tranforming thi equence, we have hn repreented a a erie of delayed impule function. Thi will tell u explicitly what the value of the impule repone i for the firt few value of the equence. Thee value indeed check with thoe given by the general expreion above for hn: h n δ n 5.00 δ n.9 δ n 5.0 δ n PLAYING DIGITIZED WAVEFORMS ON A COMPUTER SYSTEM In order to get the full benefit of the work we will be doing in the remainder of thi text, a computer ound card hould be available. Certainly, the C code in thi text for the deign and implementation of analog and digital filter i the primary incentive for obtaining a copy of thi text, but without a ound card to play the ound file that we will proce in the next few chapter, an important experience

147 38 Practical Analog and Digital Filter Deign will be mied. We will be uing everal ound file to illutrate the effect produced by the digital filter which we will be deigning. Thee ound file have been included on the oftware dic with thi text in the \C_CODE\SOUND directory. In addition to ound file format, there are other variation that mut be conidered when playing ound file. Firt, the ampling frequency mut be conidered. The tandard ampling frequency for tudio-quality audio ignal i 44,00 H. Thi frequency i high enough to allow audio frequencie in the 0,000 H range to be included in the ignal information. Thee frequencie repreent the upper limit in the human hearing range. However, not all application require thi level of frequency repone. Therefore, ampling rate of,050 and,05 H are alo common. Thee lower frequencie provide attractive alternative for ignal without high frequency component or ignal including only peech. The ound card automatically include an antialiaing filter et to the correct frequency baed on the ampling rate. Mot ound card alo include the option of electing the quantiation to be ued when the ignal i ampled. Either 8-bit byte or 6-bit byte reolution can be elected. Other option are common for indutrial application. Table 5.7 provide a look at the ie of ound file a a function of ampling rate, number of channel, and quantiation method. Table 5.7 Comparion of Sound File Sie for Minute of Recording Quantiation Channel Sample Rate File Sie 8 bit Mono,05 H 0.66 MB 8 bit Mono,050 H.33 MB 8 bit Mono 44,00 H.646 MB 8 bit Stereo,05 H.33 MB 8 bit Stereo,050 H.646 MB 8 bit Stereo 44,00 H 5.9 MB 6 bit Mono,05 H.33 MB 6 bit Mono,050 H.646 MB 6 bit Mono 44,00 H MB 6 bit Stereo,05 H.646 MB 6 bit Stereo,050 H MB 6 bit Stereo 44,00 H 0.58 MB Obviouly, the ie of audio file can grow very large! That i why it i important to elect the ampling rate, number of channel, and quantiation method carefully to provide the level of accuracy appropriate to the project. Of coure today there are many option for the compreion of thi data, but there i till a direct correlation between file ie and ampling option. There are two different file included with the oftware dic. The firt file, SPEECH, i a monaural file that ue a ampling rate of,05 ample per econd with 8 bit per ample. The econd election, MUSIC, i alo a monaural ignal recorded by

148 Introduction to Dicrete-Time Sytem 39 ampling at,050 ample per econd with 6 bit per ample. Since mot ound card will alo record ignal, other tet ignal can be captured and teted on the computer ytem a deired. At thi point, it i time to check out the ound card on the computer by playing the ound file mentioned above. It i recommended that the ound file be copied to the hard dik for fater acce. We ll be uing them a input ample to be deigned in the next two chapter. 5.6 CONCLUSION We have reached the end of our review of dicrete-time ytem. In thi chapter, we found that the complete characteritic of a dicrete-time ytem could be determined by knowing the ytem difference equation, impule repone, tranfer function, or ytem diagram. We learned way to determine any one of thee decription from any of the other. In addition, we learned how to find the frequency repone of a ytem by direct ubtitution into the ytem tranfer function. We will ue the material preented in thi chapter to deign and implement digital filter in the next two chapter. The remainder of thi text will be preented in a manner emphaiing application rather than theory, but if the need arie, we can ue the material in thi chapter to better undertand any problem that we might encounter.

149 40 Practical Analog and Digital Filter Deign

150 Chapter 6 Infinite Impule Repone Digital Filter Deign There are a variety of method that can be ued to deign digital filter a we will ee in thi chapter and the next. One commonly ued method i to ue the analog filter approximation function that have already been developed and imply tranlate them in a way that will make them uable for dicrete-time ytem. Thi method, which will be tudied in thi chapter, make ue of the large backlog of filter deign theory and table of tranfer function that are readily available. Mot of the filter deigned uing thi method will be recurive in nature. That i, the output of the filter will depend on previou value of the output a well a pat and current value of the input. Thee type of filter can theoretically have impule repone that continue forever and therefore are commonly referred to a infinite impule repone IIR filter. Another method of deigning dicrete-time filter will be dicued in the next chapter. That method doe not depend on analog filter theory, but rather ue the frequency repone of the deired filter to directly determine the digital filter coefficient. The method generally yield nonrecurive filter that have output depending only on pat and current value of the input. Thee type of filter generally have an impule repone containing only a finite number of value and thu are commonly called finite impule repone FIR filter. A we are about to ee, both the IIR and FIR deign method will differ from the analog filter deign technique tudied in the firt part of the text. A more complete comparion of IIR and FIR filter will be given in Section 8.. In the firt three ection of thi chapter, we will invetigate different method of tranlating an analog filter characteritic into thoe of a digital filter. A we will ee, there i no perfect digital equivalent to an analog filter at all frequencie; however, we can develop filter that cloely match the important filter characteritic. In the final ection of thi chapter, we will develop the C code neceary to evaluate the frequency repone characteritic of IIR digital filter. 4

151 4 Practical Analog and Digital Filter Deign 6. IMPULSE RESPONSE INVARIANT DESIGN The impule repone invariant deign method or impule invariant tranformation i baed on creating a digital filter with an impule repone that i a ampled verion of the impule repone of the analog filter. We firt tart with an analog filter tranfer function H, and by uing the invere Laplace tranform, we determine the ytem continuou impule repone ht. We next ample that repone to determine the ytem dicrete-time impule repone hnt. We then take the -tranform of thi ampled impule repone to find the dicrete-time tranfer function H. A an illutration, conider the following example. Example 6. Impule Repone Invariant Tranformation Problem: Aume that we wih to convert the following continuou-time tranfer function to a dicrete-time tranfer function uing the impule invariant tranformation method: H 5 Solution: We firt ue baic partial fraction expanion technique to write the tranfer function in a form uitable for invere tranformation: 4 4 H 5 Then recogniing the Laplace tranform pair L A H A e a we can eaily find the impule repone a h t 4 e t 4 e at 5t u t h t u t If we then ample thi impule repone at interval of T, we will have the dicrete-time impule repone. Effectively, we imply replace every t with nt to denote the nth ample at interval of T: h nt 4 e nt 4 e 5nT u nt

152 Infinite Impule Repone Digital Filter Deign 43 Thi expreion can be rewritten in a form that more clearly indicate the exponential relationhip of n: ] 4 [4 5 nt u e e nt h n T n T Now we ue the -tranform table a developed in Chapter 6 to find the tranfer function in the -domain: e e H T T And, finally, we can combine the term over a common denominator to produce the final reult, which can be implified once a value of the ampling period T i choen: e e e e H T T T T Although Example 6. clearly indicate the tep required to tranlate an analog tranfer function to a digital tranfer function, we can kip ome of the tep by recogniing the common relationhip between H and H. A can be verified in the example, for every term in the analog tranfer function of the form hown in 6., there i a term created in the digital tranfer function of the form hown in 6.: a H 6. e H at 6. Thi matching technique can alo be applied to quadratic term that have complex root, where each factor i imply treated individually. For example, if we have a quadratic of the form 6.3, the reulting dicrete-time equivalent could then be written and implified a hown in 6.3 to 6.6: β α β α β α β α β j j j j j j H / / 6.3

153 44 Practical Analog and Digital Filter Deign / / e j e j H T j T j β α β α 6.4 / e e e e j H T j T j T j T j β α β α β α β α 6.5 co in e T e T e H T T T α α α β β 6.6 Example 6. Butterworth Impule Invariant Filter Deign Problem: Determine the impule invariant digital filter for a econd-order Butterworth approximation function, a hown below. Notice that H i normalied and therefore ha a paband edge frequency of rad/ec or /π H. Determine the difference that reult from chooing ampling period of T.0 ec and T 0. ec..44 H Solution: We can firt factor the analog tranfer function and ue partial fraction expanion to determine j j j j H The digital tranfer function can then be determined by uing the reult indicated in 6.3 to 6.6: co0.707 in e T e T e H T T T We can now make the ubtitution of the different ampling period in the general form to find the two ditinct tranfer function: H T

154 Infinite Impule Repone Digital Filter Deign 45 H T It i intereting to compare the two tranfer function of Example 6.. We notice firt that the gain and pole poition are different olely from the election of the ampling period or frequency. We can alo get a quick indication of the magnitude of thee tranfer function by determining the repone at ero frequency. We can do that eaily letting e j0 : H e j0 T H e j0 T With thi quick check, we ee that the repone at ero frequency eem to be proportional to /T. Although uing only two value of ampling frequency hardly make a cae, it i true in general that the magnitude i proportional to /T. For thi reaon, mot impule invariant deign cale the tranfer function by an amount equal to the ampling period. A we can ee, if that caling were ued in the previou example, the repone at ero frequency would be very cloe to unity. The complete frequency repone for both tranformation are hown in Figure 6. with the T caling factor applied. The repone are notably different a we would expect ince the two tranfer function have different gain and pole location. It i important to notice how thi variation in tranfer function form and frequency repone i due olely to the value of ampling period or ampling frequency that ha been elected. In order to ee why thi election produce the variation, we mut remind ourelve of the relationhip between the digital and equivalent analog frequencie. A decribed in Section 6.4, the digital frequency Ω extend from 0 to π where π i analogou to the analog frequency of f / a dictated by the Nyquit criteria. Each point on the frequency axi can be referenced in term of Ω, which extend from 0 to π, or in term of f d, which extend from 0 to f /. Thi relationhip can be written in either of the two form hown in 6.7 and 6.8: Ω π f / 6.7 d f f d f Ω π 6.8

155 46 Practical Analog and Digital Filter Deign.4 Mag. T.0 frequency range H T 0. frequency range H Frequency π, 0.5, 5.0 Figure 6. Frequency repone for Example 6.. Now we are able to ee more clearly why the repone are o different. Although the frequency axi extend from 0 to π, it repreent different analog frequencie for the two repone. In the cae of the T ec repone f H, the digital frequency range extend from 0 to 0.5 H, and the paband edge frequency of 0.59 H i clearly viible at a point approximately one-third of the way along the frequency axi. However, in the cae of the T 0. econd repone f 0 H, the digital frequency range i actually from 0 to 5 H. Therefore, the break frequency of 0.59 H occur at a point much cloer to the ero frequency point. Clearly then from thi example it i important to pick the ampling frequency for an impule invariant deign carefully. The frequency range of the input ignal mut be conidered a well a the deired overall repone. In general, the impule invariant deign method i bet for matching low-frequency ytem repone. 6. STEP RESPONSE INVARIANT DESIGN Another common method of converting an analog tranfer function to the digital domain i to match the tep repone of both ytem. The tep repone invariant deign procedure i much the ame a the impule invariant deign, except that we mut determine the tep repone of the analog tranfer function before it i ampled and -tranformed. We can determine the analog ytem tep repone imply by multiplying H by the tranform of the tep input, which i /. In 6.9 we defined the ytem tep repone a G:

156 Infinite Impule Repone Digital Filter Deign 47 G H 6.9 Once we have determined G, we can find the time domain repone to the tep input gt by uing the invere Laplace tranform: g t L { G } 6.0 Then, the dicrete-time tep repone can be determined by ampling the continuou-time verion: g nt g t t nt 6. Next, the dicrete-time ytem repone to the tep input can be determined by uing the -tranform: G Z { g nt } H 6. A hown in 6., G i the product of the dicrete-time tranfer function H and the -tranform of the tep input. Therefore, in order to find H, we imply multiply G by, a hown: H G 6.3 A we review thi procedure, we can ee that the primary tep are the ame a for the impule invariant tranformation, except that we have added one tep at the beginning and one tep at the end. The new initial tep require that we divide the analog tranfer function by, and the new final tep require that we multiply the digital tranfer function by. Example 6.3 Step Repone Invariant Tranformation Problem: Aume that we wih to convert the continuou-time tranfer function of Example 6. to a dicrete-time tranfer function, but thi time we want to ue the tep repone invariant tranformation method. H 5

157 48 Practical Analog and Digital Filter Deign Solution: We need to determine the ytem repone to a tep input by multiplying H by the Laplace tranform of the tep input / G We can then eaily find the time domain repone to the tep input by finding the invere Laplace tranform of G a t u e e t g t t If we ample thi repone at interval of T, we will have the dicrete-time repone, a hown below: ] [. 5 nt u e e nt g n T n T Then, uing the -tranform table in Chapter 5, we can find the -tranform of gnt a e e G T T And by combining the term over a common denominator, we find that e e e e e e e G T T T T T T T where G repreent the output of the ytem to a tep input. In order to determine the tranfer function of the ytem, we mut remove the effect of the tep input / e e e e e e e H T T T T T T T Although the reult of the previou example look quite involved, all of the exponential term will become contant once the ampling period for the ytem i elected. We can alo ue the tep invariant deign method on the Butterworth filter of Example 6..

158 Infinite Impule Repone Digital Filter Deign 49 Example 6.4 Butterworth Step Invariant Filter Deign Problem: Determine the tep invariant digital filter for a econd-order normalied Butterworth approximation function, a hown below. Determine the difference that reult for ampling period of T.0 ec and T 0. ec. H.44 Solution: Again, we firt determine the output of the analog ytem to an input tep function and then ue partial fraction expanion to determine the individual term. 0.5 j j0.5 G j j0.707 The tep repone can then be determined by finding the invere Laplace tranform of G, a indicated below: g t j0.5 e j0.707 t 0.5 j0.5 e j0.707 t Then, after ampling at interval of T, the dicrete-time tep repone i determined to be g nt j0.5 e j0.707 nt 0.5 j0.5 e j0.707 nt The dicrete-time repone to the tep input can then be determined by uing the -tranform. G e 0.5 j j0.707 T e 0.5 j j0.707 T Now, by combining thee term over a common denominator and performing a coniderable amount of complex algebra, we have the ytem repone to a tep input:.44t e 0.707T e [in0.707t co0.707 T ] G 0.707T.44T [ e co0.707t e e [ e 0.707T 0.707T [in0.707 T co0.707 T ] co0.707 T e.44t ] ]

159 50 Practical Analog and Digital Filter Deign The dicrete-time tranfer function H can now be determined by removing the factor relating to the tep input, and we can make the ubtitution of the different ampling period in the general form to find the two ditinct tranfer function: e H [ e e.44t 0.707T 0.707T [ e [in0.707t co0.707t ] e co0.707t 0.707T 0.707T e [in0.707t co0.707t] co0.707t.44t e ].44T ] H T H T Note that the pole location are the ame a for the impule invariant deign but that the ero location have changed. We can compare the frequency repone of thee two dicrete-time filter a hown in Figure T.0 frequency range H Mag. T 0. frequency range H Frequency π, 0.5, 5.0 Figure 6. Frequency repone for Example 6.4. A we can ee, there i ignificant difference between the two implementation, but the difference are again a reult of the frequency axi having two different cale. In the tep invariant deign method, there i no need

160 Infinite Impule Repone Digital Filter Deign 5 to cale the magnitude a wa the cae for the impule invariant deign method. By comparing thi frequency repone to that of Figure 6., we ee a ignificant difference. The reaon for the difference i the different criteria placed on the deign. In the previou ection, the emphai wa placed on matching an impule like input ignal, while in thi ection the aim wa to match a tep like input ignal. A indicated in the figure, the different criteria produce filter with quite different frequency repone. A in the previou ection, thi method of IIR filter deign i bet uited to match low-frequency ytem repone. 6.3 BILINEAR TRANSFORM DESIGN Both the impule invariant and tep invariant deign method provide good approximation for lowpa and ome bandpa analog filter repone. However, they cannot provide good matching of high-frequency repone, which make it impoible to ue them for highpa or bandtop filter deign. In fact, they do not provide the bet method for matching analog filter repone when a good match i required throughout a wide range of frequencie. In addition, without careful election of the ampling frequency and trict band-limiting of the input ignal, ditortion from aliaing can occur. Therefore, in thi ection we will dicu the bilinear tranformation that endeavor to make a reaonable match over the entire filter frequency range. Of coure, that provide a challenge ince the analog frequency range extend from ero to infinity and the digital frequency range extend only from ero to π. However, a tranformation from the analog -domain to the digital -domain ha been developed a decribed in more detail in the technical reference provided at the end of the text. In thi method, the relationhip between the and complex variable can be decribed by the following equation, where T i the ampling period: 6.4 T To better undertand thi relationhip, we can repreent the complex variable in the exponential form R e jω R e T R e jω jω R coω T R coω j R in Ω j R in Ω 6.5 Thi repreentation can be written in rectangular form a [ R co Ω j R in Ω] [ R co Ω j R in Ω] 6.6 T [ R co Ω j R in Ω] [ R co Ω j R in Ω]

161 5 Practical Analog and Digital Filter Deign and finally implified to T σ jω T R R j RcoΩ R RinΩ RcoΩ 6.7 By referring to 6.7 and oberving the -plane and -plane in Figure 6.3, we can ee that there are three ditinct region in the -domain that relate to three ditinct region in the -domain. In the firt cae, any point in the -domain that lie outide of the unit circle R > i aociated with a point in the right-half plane RHP of the -plane σ > 0. In the econd cae, a point in the -domain located inide the unit circle R < i aociated with a point in the left-half plane LHP of the -domain σ < 0. Finally, a point on the unit circle R i aociated with a point in the -plane that lie on the jω axi σ 0. In fact, in thi lat cae, the poitive jω axi relate to the top half of the unit circle a the angle travel from 0 to π, while the negative jω axi relate to the bottom half of the unit circle with angle from 0 to π. ω j Outide RHP σ Inide R LHP -plane -plane Figure 6.3 Comparion of -plane and -plane uing bilinear tranform. Although there doe exit a one-to-one relationhip between the poitive jω axi and the upper part of the unit circle, it i a nonlinear one. If we look more cloely at the imaginary portion of 6.7 when R and therefore σ 0, we ee that in ω T co Ω Ω Ω tan T 6.8 or, in term of the -domain frequency variable,

162 Infinite Impule Repone Digital Filter Deign 53 Ω tan ω T 6.9 Equation 6.8 and 6.9 are important to the bilinear tranformation proce becaue they are neceary to determine the proper mapping between the analog and digital domain. Thi mapping of analog frequencie to digital frequencie i fairly linear for low frequencie, but become very nonlinear a higher frequencie are mapped. Thi mapping of frequencie i often referred to a warping to decribe how the higher frequencie are warped into their proper place on the unit circle. The reaon that thi warping i o important i that although we will pecify the frequency characteritic of the digital filter by digital frequencie, the filter will be derived from an analog filter tranfer function. Therefore, it i neceary to properly determine the analog frequencie to ue in the analog deign by warping the pecified digital frequencie a hown in Example 6.5. After determining the frequencie neceary for the analog filter deign, the filter can be deigned uing the proce decribed earlier in thi text. Once the analog tranfer function ha been determined, we can ue the bilinear tranform ubtitution given in 6.4. Since we will be developing code to implement thi tranformation proce, it i important to carefully decribe thi ubtitution. In the cae of a firt-order factor, the tranformation proce begin with 6.0. Example 6.5 Determining Analog and Digital Critical Frequencie Problem: Aume we wih to deign a lowpa digital filter with ampling frequency of 0 kh baed upon a Butterworth analog filter. The required characteritic of the digital filter are a pa db, a top 0 db, f pa kh, and f top 5 kh What parameter hould we ue to deign the analog filter upon which our digital filter will be baed? Solution: We firt recognie that the digital frequency axi can be labeled in two different way, a dicued earlier. Then uing 6.7, we can determine π,000 Ω p 0. π 0,000 π 5,000 Ω 0. 5π 0,000

163 54 Practical Analog and Digital Filter Deign Once thee frequencie have been determined they can be warped uing 6.8 to produce the equivalent analog frequencie neceary for the analog filter deign. ec rad/ 6,335.4,008.3 tan Ω π ω p p T rad/ec 40,000 6,366. tan Ω π ω T Note the light warping of the lower paband edge frequency from,000 to,008 H and the more ignificant warping of the higher topband edge frequency from 5,000 to 6,366 H. The attenuation of the filter do not change; therefore, we have enough information to proceed with the deign of the analog filter, which will be the ubject of the next example. B T B A T A B B A A H T 6.0 In thi equation, uppercae A and B repreent the coefficient of the analog filter function. After implification, 6. and 6. reult with a new et of coefficient where /T ha been replaced with f. In thee equation, lowercae a and b repreent the digital filter coefficient that will be ued, and G repreent the gain adjutment for thi firt-order term: b b a a G D D N N D N H 6. where B f B D B f B D A f A N A f A N

164 Infinite Impule Repone Digital Filter Deign 55 In the cae of the quadratic term that are ued to decribe our coefficient, the tranformation proce i hown in 6.3 to 6.5. Again, G repreent the gain adjutment neceary for each of the quadratic factor for the filter. 0 0 B T B T B A T A T A H b b b a a a G D D D D N N N N D N H 6.4 where B f B f B D B f B D B f B f B D A f A f A N A f A N A f A f A N Example 6.6 Butterworth Bilinear Tranform Filter Deign Problem: Determine the digital filter to meet the pecification given in Example 6.5 uing the bilinear tranformation. Solution: By entering the attenuation and the prewarped analog frequencie in WFilter for analog filter deign, we determine the following analog tranfer function: H

165 56 Practical Analog and Digital Filter Deign Then, by uing the bilinear ubtitution for, we can determine the tranfer function in the digital domain T T H The tranfer function can be implified by uing 6.3 to 6.5 to produce H The frequency repone of the digital filter deigned in Example 6.6 can be determined in the manner dicued in the previou chapter and i hown in Figure 6.4. Mag Frequency, 0 kh π Figure 6.4 Frequency repone for Example 6.6. For a general quadratic factor of the form hown below: 0 0 b b b a a a H 6.6 the frequency repone can be determined by letting e jω a hown: Ω Ω Ω Ω Ω 0 0 j j j j j e b e b b e a e a a e H 6.7

166 Infinite Impule Repone Digital Filter Deign 57 The numerator and denominator factor can then be converted. H e j Ω [ a0 [ b 0 a co b co Ω a coω] j [ a in Ω a inω] Ω b coω] j [ b in Ω b inω] 6.8 We ee in Figure 6.4 that the pecification have been met at,000 H the db gain 0.895, and at 5,000 H the 0 db gain 0.. Example 6.7 Chebyhev Bilinear Tranform Filter Deign Problem: Ue WFilter to completely deign a Chebyhev digital IIR filter and diplay the magnitude repone. The pecification for thi filter are a pa db, a top 60 db, f pa 0 kh, f top 0 kh, and f amp 50 kh Solution: We can upply thee value to WFilter and WFilter will calculate the magnitude repone of the filter, a hown in Figure 6.5. The digital IIR coefficient and the pole and ero location are hown in Figure 6.6. In Figure 6.5 we ee the effect of ampling on the frequency repone. In particular, we ee the lowpa repone replicated in mirror image form at the ampling frequency of 50 kh. In addition, we ee the lower half of the reflection at twice the ampling frequency of 00 kh. If we had choen a larger-frequency cale, we would ee thee replication reproduced at all multiple of the ampling frequency. Of coure, in the typical dicrete-time ytem, the antialiaing filter will be et to one-half of the ampling frequency 5 kh in thi cae, and the uer would not ee the effect of the higher-frequency component. Figure 6.5 Magnitude repone from WFilter.

167 58 Practical Analog and Digital Filter Deign Example Chebyhev Lowpa Filter Selectivity: Lowpa Approximation: Chebyhev Implementation: IIR digital Paband gain db: -.0 Stopband gain db: Paband freq H: Stopband freq H: Sampling freq H: Filter Length/Order: 04 Overall Filter Gain: E-0 Numerator Coefficient QD [ ^- ^- ] E E E E00 Denominator Coefficient QD [ ^- ^- ] E E E E-0 Zero QD [ Real ] [ Imag ] E E E E E E E E00 Pole QD [ Real ] [ Imag ] E E E E E E E E-0 Figure 6.6 Deign value from WFilter. 6.4 C CODE FOR IIR FREQUENCY RESPONSE CALCULATION To verify that all requirement have been met, we mut calculate the frequency repone of our filter. In thi cae, the Calc_DigIIR_Rep function hown in Liting 6. would be called to perform the frequency repone calculation. Computation are made in the ame manner a in Calc_Analog_Rep except the real and imaginary value are calculated uing 6.8.

168 Infinite Impule Repone Digital Filter Deign 59 /* Calc_DigIIR_Rep - calc repone for IIR filter Prototype: int Calc_DigIIR_RepFilt_Param *FP, Rep_Param *RP; Return: error value Argument: FP - ptr to truct holding filter param RP - ptr to truct holding repon param */ int Calc_DigIIR_RepFilt_Param *FP,Rep_Param *RP { int c,f,q; /* loop counter */ double raddeg, /* rad to deg converion */ omega,omega, /* radian freq and quare */ rea,img; /* real and imag part */ } raddeg 80.0 / PI; /* et raddeg */ /* Loop through each of the frequencie */ forf 0 ;f < RP->tot_pt; f { /* Initialie magna and angle */ RP->magna[f] FP->gain; RP->angle[f] 0.0; /* Pre calc omega and omega quared */ omega PI * RP->freq[f] / FP->famp; omega * omega; /* Loop through coef for each quadratic */ forq 0 ;q < FP->order/; q { /* c i coef index 3 * quad index */ c q * 3; /* Numerator value */ rea FP->acoef[c] FP->acoef[c]*coomega FP->acoef[c]*coomega; img -FP->acoef[c]*inomega - FP->acoef[c]*inomega; RP->magna[f] * qrtrea*rea img*img; RP->angle[f] atanimg,rea; /* Denominator value */ rea FP->bcoef[c] FP->bcoef[c]*coomega FP->bcoef[c]*coomega; img -FP->bcoef[c]*inomega - FP->bcoef[c]*inomega; RP->magna[f] / qrtrea*rea img*img; RP->angle[f] - atanimg,rea; } /* Convert to degree */ RP->angle[f] * raddeg; } /* Convert magnitude repone to db if indicated */ ifrp->mag_axi LOG { forf 0 ;f < RP->tot_pt; f { /* Handle very mall number */ ifrp->magna[f] < ZERO { RP->magna[f] ZERO;} RP->magna[f] 0 * log0rp->magna[f]; } } return ERR_NONE; Liting 6. Calc_DigIIR_Rep function.

169 60 Practical Analog and Digital Filter Deign 6.5 CONCLUSION In thi chapter we invetigated three different method of generating digital IIR filter from analog tranfer function. In each cae we found that there i no perfect match to the original analog function, primarily becaue there i a trict limit on the frequency range of a digital filter. However, the bilinear tranform method doe provide good overall repone characteritic, and for that reaon it wa choen to be implemented in C code. Detail of thi code are provided in Appendix G. The frequency repone characteritic of the IIR filter were alo conidered, and the calculation of the repone wa implemented in C code. Finally, we ued WFilter to deign an IIR filter and diplay the complete magnitude repone including the multiple replication of the original repone. The implementation of IIR filter i dicued in Chapter 8.

170 Chapter 7 Finite Impule Repone Digital Filter Deign In the lat chapter, we conidered the deign of digital filter baed on the approximation method for analog filter. We invetigated a number of way that the tranfer function in the analog domain could be converted to tranfer function in the digital domain. In thi chapter, we will develop method that deal with the digital filter a a unique filter type, not baed on analog filter approximation method. The focu of thi chapter will be on finite impule repone FIR filter that have only a finite number of term in their impule repone. Thee filter have a number of advantage over the IIR filter type. An FIR filter i alway table, realiable, and provide a linear phae repone under pecific condition. Thee characteritic make FIR filter attractive to many filter deigner. However, the major diadvantage of FIR filter i that the number of coefficient needed to implement a pecific filter i often much larger than for IIR deign. A more complete comparion of IIR and FIR filter i given in Section 8.. We will begin thi chapter with a tandard method of deigning FIR digital filter uing the Fourier erie decription of the deired frequency repone. Thi method will then be modified and improved by uing a windowing technique to improve the hape of the repone. In addition, the Park-McClellan optimiation technique will be dicued a a technique of reducing the length of the reultant FIR filter. Finally, the C code for determining the frequency repone of FIR filter will be developed. 7. USING FOURIER SERIES IN FILTER DESIGN There are a number of method that could be ued to deign FIR filter. We will invetigate one of the mot popular in thi ection. Other method are decribed in the reference lited in Appendix A for digital filter deign. 6

171 6 Practical Analog and Digital Filter Deign 7.. Frequency Repone and Impule Repone Coefficient In the proce of filter deign, the deigner begin with the frequency repone characteritic. The critical band edge frequencie and the gain within each band are determined to meet certain pecification. We have found that the frequency repone for digital filter i actually periodic in the frequency domain with a period of the ampling frequency. For example, a typical lowpa filter pecification i hown in Figure 7., which clearly indicate the periodic nature of the frequency repone. Since thi repone i periodic, it can be decribed by a Fourier erie of the form hown in 7.. In thi formulation, the complex frequency exponential i allowed to take on all poible frequency value. jω k H e h k e jkω 7. Figure 7. Periodic digital frequency repone. The coefficient within the ummation are the impule repone coefficient that decribe the digital FIR filter. The procedure for determining the impule repone coefficient from the frequency repone i traightforward and provided in the digital filter deign reference text lited in Appendix A. The final reult of the derivation i hown in 7.. A indicated by the limit of the integral, the integration mut include only one full period of the frequency repone. Ω π o jω jnω h n Ω, 0, ±, ±, H e e d n π Ω π o 7. We will not be able to implement an infinite number of coefficient a 7. indicate. The number of coefficient we retain i a compromie between how well we want our deign to approximate the ideal, and how many coefficient can be retained becaue of time delay, implementation cot, or other contraint. We can aume that the indice are limited to the range M n M, which limit the number of coefficient retained to N M. By making thi election, we are in effect etting all other coefficient to ero. Figure 7. how the effect of

172 Finite Impule Repone Digital Filter Deign 63 limiting the number of coefficient by graphing the frequency repone uing a finite number of coefficient. The frequency repone can be determined by uing a modified form of 7., a hown in 7.3: jω M H e h n e nm jnω 7.3 A we increae the number of coefficient in the FIR filter approximation, we can ee that a ripple concentrate near the paband edge frequency. Thi ripple cannot be eliminated, even by increaing the number of impule repone coefficient; it imply concentrate at the tranition. Thi effect i known a Gibb phenomenon and reult whenever a dicontinuity i modeled with a erie. However, a we will ee in the next ection, there are method we can ue to reduce thi effect. Figure 7. Approximated repone to lowpa filter. Figure 7. alo how a more common method of pecifying paband and topband gain for FIR filter. The error within the paband and topband are pecified a δ p and δ, repectively. A we can ee, the frequency repone i allowed to fluctuate both poitively and negatively within thee error limit. We can tranlate thee pecification into the decibel gain pecification with which we are familiar by uing 7.4 and 7.5. Alternatively, we can convert our decibel gain into thee error value uing 7.6 and 7.7. a pa 0log δ p 7.4 a top 0log δ 7.5

173 64 Practical Analog and Digital Filter Deign δ 0 p 0.05apa 7.6 δ atop 7.7 A indicated earlier, the phae repone of an FIR filter can be a linear function of frequency under certain condition. For example, if we aume that frequency repone within the paband of an FIR filter i a hown in 7.8, we are pecifying that the gain mut be unity, while the phae angle change linearly with frequency: H paband e jω e jτω τω 7.8 The neceary condition that allow for thi linear phae hift or contant group delay are that the impule repone coefficient be either ymmetric or antiymmetric and that τ take on the value in 7.9 where N i the number of coefficient or the length of the filter. The filter coefficient are ymmetric if they atify 7.0 and antiymmetric if they atify 7.. τ N 7.9 h n h n 7.0 h n h n 7. Perhap it i time to ay a few word about the difference between filter length and filter order. Analog and digital IIR filter ue the order of the filter a a meaure of the filter ie. The order refer to the highet-order term in the polynomial equation ued to decribe the filter. On the other hand, digital FIR filter typically ue the number of impule repone coefficient required to decribe it a it ie. Thi i probably becaue mot FIR filter are implemented uing convolution where the number of coefficient directly affect the length of the proceing. Once the FIR coefficient are ubtituted into a difference equation a little later in thi ection, we will ee that the length of an FIR filter will imply be one larger than it order.

174 7.. Characteritic of FIR Filter Finite Impule Repone Digital Filter Deign 65 When we conider ymmetric and antiymmetric coefficient combined with even and odd filter length, four different type of FIR filter can be deigned. Each of the four type ha unique characteritic that can be decribed briefly a follow. Type FIR filter. The type FIR filter, which have ymmetric coefficient and odd length, alo have a frequency repone that ha even ymmetry about both Ω 0 and Ω π. Thi even ymmetry allow the frequency repone to take on any value at thee two critical frequencie, and thu lowpa, highpa, bandpa, and bandtop filter can be implemented uing thi FIR type. Type FIR filter. The type FIR filter, which have ymmetric coefficient and even length, have a frequency repone that i even about Ω 0 and odd about Ω π. Thi condition dictate that the repone at Ω π be ero and thu type FIR filter are not recommended for highpa or bandtop filter. Type 3 FIR filter. The type 3 FIR filter, which have antiymmetric coefficient and odd length, have a frequency repone that ha odd ymmetry at both Ω 0 and Ω π. Becaue of the odd ymmetry, the frequency repone of thi filter type mut be ero at both of thee two critical frequencie. Thu, thi filter type i not recommended for lowpa, highpa, or bandtop filter. However, thi type of filter doe provide a 90 phae hift of the output ignal with repect to the input and therefore can be ued to implement a differentiator or Hilbert tranformer. Thi type of filter ha other characteritic that make it the bet choice for Hilbert tranformation, while the differentiator i uually implemented uing a type 4 filter. Type 4 FIR filter. The type 4 FIR filter, which have antiymmetric coefficient and even length, have a frequency repone that ha odd ymmetry about Ω 0 and even ymmetry about Ω π. The odd ymmetry condition make thi type of filter a poor choice to implement either lowpa or bandtop filter. But, jut a in the type 3 cae, thi filter provide a 90 phae hift that make it able to implement differentiator and Hilbert tranformer. Thi type of filter ha better characteritic in mot cae for implementing a differentiator than type 3, but the type 3 filter ha ome advantage over thi filter type for implementing the Hilbert tranform. Since the type FIR filter can be ued to implement any of the filter we need to deign, we will dicu only that type of filter from thi point forward in thi text. Further information concerning the other filter type can be found in a number of the digital filter deign reference lited in Appendix A. The filter coefficient derived from 7. will not produce a caual filter. Thi mean that the ytem could not be implemented in real time. We can verify thi if we conider the output of a dicrete-time ytem produced by the convolution of the input ignal with the impule repone coefficient a hown in 7.. Notice that the output yn become only a function of the input xn and doe not include any pat value of the output a in the IIR filter cae.

175 66 Practical Analog and Digital Filter Deign M y n h k x n k km 7. A we ee, uing the impule repone coefficient directly will reult in yn being determined by future value of the input. For example, when k M, the ummation include a term xn M that refer to an input value M ampling period ahead of yn reference time. The problem can be handled by hifting all coefficient value to the right on the time axi o that only poitive value of n produce coefficient, a hown in Figure 7.3. The diadvantage of thi action i to increae the time delay between ytem input and output by M ampling period. Figure 7.3 a Noncaual and b caual coefficient. The caual coefficient can be determined from the noncaual coefficient by making the following index adjutment. A the noncaual coefficient indice take on value from M to M, the caual coefficient indice will take on value from 0 to M, a hown in 7.3: h n M h n, n 0, ±,, ± M caual noncaual Ideal FIR Impule Repone Coefficient We can now determine the ideal coefficient for variou filter type by uing the integral formula of 7.. In each cae, figure depicting ideal lowpa, highpa,

176 Finite Impule Repone Digital Filter Deign 67 bandpa, and bandtop filter along with equation for determining the coefficient baed on the parameter of the particular filter are given. The frequency repone in the paband of each filter i a defined in 7.8 and allow u to determine caual coefficient directly. We will be auming that the deired paband magnitude repone i, while the topband repone i 0. We will be uing δ p and δ or a pa and a top later to help determine the required length of the filter. In the firt cae, Figure 7.4 illutrate the lowpa filter pecification with the reulting derivation of the lowpa filter coefficient hown in 7.4 and 7.5. The highpa, bandpa, and bandtop filter cae are portrayed repectively in Figure 7.5 to 7.7 with the appropriate derivation in 7.6 to 7.. In each cae, τ M a determined from 7.9. Example 7. Determining Ideal Coefficient for an FIR Filter Problem: Determine the ideal impule repone coefficient for a lowpa filter of length to atify the following pecification: ω pa π3,000 rad/ec, ω top π4,000 rad/ec, and f 0 kh Solution: We firt need to determine Ω c, the cutoff frequency for the ideal filter. Thi frequency can be et in the middle of the tranition band and converted to a digital frequency: Ω c pa ω top ω / f.0996 rad/ec Uing thi value along with τ 0 in 7.5, we can determine the following ideal caual coefficient: h h9 h h8 h h7 h h6 h h5 h h4 h h3 h h h h h h0 h

177 68 Practical Analog and Digital Filter Deign Figure 7.4 Lowpa filter pecification. M n d e n h c c n j LP, 0,,, Ω Ω Ω Ω τ π 7.4 [ ] M n n n n n n h c c LP, 0,, for, / for, in Ω Ω τ π τ π τ τ 7.5 Figure 7.5 Highpa filter pecification. M n d e d e n h c c n j n j HP, 0,, Ω Ω Ω Ω Ω Ω π τ π τ π 7.6 [ ] [ ] M n n n n n n n h c c HP, 0,, for, / - for, in in Ω Ω τ π π τ π τ τ π τ 7.7

178 Finite Impule Repone Digital Filter Deign 69 Figure 7.6 Bandpa filter pecification. M n d e d e n h c c c c n j n j BP, 0,, Ω Ω Ω Ω Ω Ω Ω Ω τ τ π 7.8 [ ] [ ] M n n n n n n n h c c c BP, 0,, for, / for, in in c Ω Ω Ω Ω τ π τ π τ τ τ 7.9 Figure 7.7 Bandtop filter pecification. M n d e d e d e n h c c c c n j n j n j BS, 0,, Ω Ω Ω Ω Ω Ω Ω Ω Ω Ω π τ τ π τ π 7.0 [ ] [ ] [ ] M n n n n n n n n h c c c BS, 0,, for, / for, in in in c Ω Ω Ω Ω τ π π τ π τ τ τ π τ 7.

179 70 Practical Analog and Digital Filter Deign 7. WINDOWING TECHNIQUES TO IMPROVE DESIGN A indicated in the previou ection, we are not able to include the infinite number of coefficient neceary to implement an ideal filter. We will have to reduce the number of coefficient ued baed on the contraint of our deign. In the previou ection, we imply truncated all noncaual coefficient beyond the indice ±M and kept the ret. We will ue the noncaual decription of the filter coefficient for mathematical implicity at thi point. After the windowing proce ha been completed, we can hift the reulting coefficient to produce a caual filter. Thi procedure can be compared to placing a window of width N M over all of the ideal coefficient, a hown in Figure 7.8. All of the coefficient within the window are retained and all coefficient outide of the window are dicarded. In effect we have produced a rectangular window function in which all window coefficient with indice within the range of the window have a value of and all other coefficient have a value of 0. The retained value of the filter coefficient would then be determined by performing a coefficient-by-coefficient multiplication of the ideal coefficient and the window coefficient, a indicated in 7.: h n hideal n w n, n 0, ±,, ± M 7. The rectangular window coefficient can be formally defined in 7.3. However, the abrupt truncation of the filter coefficient ha an advere effect on the reulting filter frequency repone. Therefore, a number of other window function have been propoed which moothly reduce the coefficient to ero. For example, a imple triangular window alo called the Bartlett window a hown in Figure 7.9 would mooth the truncation proce. An expreion for thee window coefficient i given in 7.4, where M N /. Figure 7.8 Window election of coefficient. w rect n wrect n, n 0,,, M 7.3

180 Finite Impule Repone Digital Filter Deign 7 M n M n M n w n w, 0,,, bart bart 7.4 Many window function have been baed on the raied coine function including the von Hann, Hamming, and Blackman window. Graph of thoe window are alo hown in Figure 7.9 with the method of coefficient calculation for each window function provided in 7.5 to 7.7. Figure 7.9 Bartlett, Blackman, Hamming, and von Hann window. M n M n M n w n w, 0,,, co 0.5 hann hann π 7.5 M n M n M n w n w, 0,,, co hamm hamm π 7.6 M n n w n w M n M M n M n w, 0,,, and co 0.08 co blck blck blck π π 7.7 A more time wa pent trying to improve the window function ued in FIR filter deign, it became apparent for a fixed length of filter that there wa a trade-

181 7 Practical Analog and Digital Filter Deign off between tranition band roll-off and attenuation in the topband. One of the window function that developed becaue of thi fact wa the Kaier window function, a hown in Figure 7.0. The expreion for the window coefficient a given in 7.8 i baed on the modified Beel function of the firt kind I o. The value β generally range from 3 to 9 and can be ued to control the trade-off between the tranition band and topband characteritic. Figure 7.0 Kaier window with variou β value. w kai n w kai n 0,,, M n I o β n M I o β, 7.8 A reaonable etimate of β in the equation above ha been determined empirically by Kaier, a hown in 7.9: 00. A 8. 7, 0. β A 0.0, 4 for A > A, for A 50 for A < 7.9 In 7.9, the variable A repreent the larger of the band error δ p or δ expreed a attenuation, a hown in 7.30:

182 Finite Impule Repone Digital Filter Deign 73 A 0log[min δ p, δ ] 7.30 In addition, Kaier developed empirical etimate of the filter length required to atify a given et of filter pecification, a indicated in 7.3. It hould be emphaied here that FIR filter deign i not a precie a IIR deign. The truncation/modification of coefficient reult in repone that may or may not meet the requirement. Therefore, the N value of 7.3 i jut an etimate and the filter repone mut be checked carefully to determine if all requirement are met. If they are not, the value on N hould be adjuted uually up, but ometime decreaing N can reult in a better filter. A 7.95, for A > N.85 Ω 5.794, for A < Ω 7.3 In 7.3, Ω repreent the normalied radian tranition band for lowpa and highpa filter and the maller of the two normalied tranition band in the cae of bandpa and bandtop filter. Ω ω / 7.3 top ω pa f Once the deired window function ha been elected and the adjutment made to the ideal coefficient, the caual coefficient can be determined a indicated in the previou ection. Example 7. Determining Hamming Coefficient for an FIR Filter Problem: Determine the coefficient for a lowpa filter uing a Hamming window of length to atify the pecification hown below: ω pa π3,000 rad/ec, ω top π4,000 rad/ec, and f 0 kh Solution: The ideal coefficient have been determined in Example 7.. We can ue 7.4 to determine the noncaual Hamming window coefficient a hown. After multiplication and hifting the coefficient by 0 ampling period, the caual windowed coefficient reult. Figure 7. how the frequency repone for both Example 7. and 7.. The rectangular window produce a filter that emphaie tranition band roll-off over ripple in the topband. On the other hand, the filter produced by uing Hamming coefficient ha no noticeable ripple, but doe not have a rapid roll-off in the tranition band.

183 74 Practical Analog and Digital Filter Deign w w w w w 0.95 w 3 w w 4 w w 5 w w 6 w w 7 w w 8 w w 9 w w 0 w h h 9 h h 8 h h 7 h h 6 h h 5 h h 4 h h 3 h h h h h h 0 h Figure 7. Magnitude repone for Example 7. and 7.. Example 7.3 Determining Kaier Coefficient for an FIR Filter Problem: Determine the impule repone coefficient for a bandpa filter uing a Kaier window to atify the following pecification: f pa 4 kh, f pa 5 kh, f top kh, f top 8 kh, a pa 0.5 db, a top a top 50 db, and f amp 0 kh Solution: The olution to thi problem begin with the determination of the paband and topband error δ p and δ by uing 7.6 and 7.7.

184 Finite Impule Repone Digital Filter Deign 75 δ p δ We can then ue 7.9, 7.30, and 7.3 to find A 50, β , and Ω, where Ω π 4,000,000 0,000 lower rad/ec Ω π 8,000 5,000 0,000 upper rad/ec Equation 7.3 can then be ued to etimate the mallet odd filter length a N 3. Equation 7.7 can be ued to determine the ideal filter coefficient after finding the value of τ 5 and calculating Ω c and Ω c, a hown below. Ω π,000 4,000 0,000 c rad/ec Ω π 5,000 8,000 0,000 c rad/ec The Kaier window coefficient can be determined by uing 7.8. The final coefficient can be calculated by multiplying the ideal coefficient by the repective window coefficient and hifting all coefficient indice by a value of M 5. Rather than perform all of the numerical calculation by hand, we can ue WFilter to finih the deign of thi filter. One addition to the deign proce for FIR filter i the indication of the filter length and an option to change the length if deired. Since the determination of filter length i not an exact calculation, thi option allow the uer to increae or decreae the length a neceary to atify the deign. Figure 7. how the FIR Etimated Length dialog box, which include an etimate of the filter length and the value of β.

185 76 Practical Analog and Digital Filter Deign Figure 7. FIR Etimated Length dialog box. Figure 7.3 how the coefficient creen with the final filter coefficient diplayed. They are diplayed in caual form, and are ymmetric about the center value. The magnitude repone of the filter i hown in Figure 7.4 and verifie that the pecification have been atified. FIR Bandpa with Kaier Window Selectivity: Bandpa Approximation: Kaier Implementation: FIR digital Paband gain db: -0.5 Stopband gain db: PB freq-lower H: PB freq-upper H: SB freq-lower H: SB freq-upper H: Sampling freq H: Filter Length/Order: 3 Overall Filter Gain: E00 Coefficient N [ N 0 N ] E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E-03 Figure 7.3 Coefficient value for Example 7.3.

186 Finite Impule Repone Digital Filter Deign PARKS-MCCLELLAN OPTIMIZATION PROCEDURE A we can ee in Figure 7.4 for the filter uing the Kaier window, the topband ha ripple that generally decreae. In fact, if the paband characteritic were magnified, we would ee ripple there a well. Both the paband and topband ripple error tend to be larger near the tranition band and then taper off a the repone move away from the band edge. Thi type of repone i not optimum. An optimum filter would have ripple in the paband and topband with a contant maximum magnitude. The error would till be preent but would be ditributed equally throughout the band. Figure 7.4 Magnitude repone for Example 7.3. In thi ection, we dicu a method for deigning FIR filter with thi characteritic. The Park-McClellan algorithm, a it i generally known, wa firt preented over 0 year ago. Although the baic procedure ha remained the ame, a number of implementation technique have changed. A detailed decription of the Park-McClellan PM algorithm i beyond the cope of thi text, but a general overview of the procedure i appropriate. In addition, a review of the commented filter deign code a introduced in the next ection provide further implementation detail. Several of the text lited in the digital filter deign ection of Appendix A provide more detailed decription of the PM algorithm, with the text by Antoniou providing a particularly detailed decription Decription of the Problem A primary component of the PM algorithm i a technique called the Reme exchange algorithm. But before we can ue the power of the Reme algorithm to optimie our FIR filter coefficient, we mut redefine our problem in uch a way

187 78 Practical Analog and Digital Filter Deign that the olution require the minimiation of an error function. To that end, we firt define the frequency repone of an odd-order FIR filter with ymmetrical coefficient hn, a hown in 7.33: jω N n 0 jωn M jωm H e h n e e c m co mω m where M N / and h M, for m 0, c m h M - m, for m,,, M 7.34 We can then define the ummation component of 7.33 a M C ω c m co mω m which i ued to formulate the error function that will be the object of the minimiation. A hown in 7.36, the error function can be decribed in term of the deired frequency repone e jωm Dω, the actual frequency repone e jωm Cω, and a weighting function Wω that can be ued to adjut the amount of error in each filter band: [ D ω C ] E ω W ω ω 7.36 The deired frequency repone function Dω i uually defined a being within the paband of the filter and 0 within the topband, although other value can be aigned. The weighting function Wω can be defined equivalently throughout the filter band, or it can be aigned a value of within the paband and 0 within the topband if a maller error value δ i deired in the topband. Thi reult occur becaue the minimiation algorithm will produce equal amount of error throughout the defined frequency range, and ince the topband error ha been artificially increaed by 0, the actual error will be 0 time maller. The optimum error function will produce variation within the paband and topband imilar to thoe hown in Figure 7. except that all ripple will be of the ame magnitude. The actual error function will alternate between poitive and negative δ value becaue of the ummation of coine function. If we pick a et of frequencie x M at which the extreme of the error occur, 7.36 can be written a

188 Finite Impule Repone Digital Filter Deign 79 E ω W ω i i [ D ω C ω ] for i 0,,, x i i δ, i 7.37 Equation 7.37 can be expanded into a matrix equation by conidering thee x frequencie, which are typically called extremal and play a crucial role in the optimiation proce. coω 0 coω coω x co Mω 0 co Mω co Mω x W ω0 c0 c W ω c M x δ W ωx D D D ω0 ω ωx 7.38 In 7.38, ω 0 ω x repreent the extremal frequencie and δ i the error. With thi expreion the filter deign problem ha been et into a form that can be manipulated by the Reme exchange algorithm The Reme Exchange Algorithm The Reme exchange algorithm i a powerful procedure that ue iteration technique to olve a variety of minimax problem. A minimax problem i one in which the bet olution i the one that minimie the maximum error that can occur. Before initiating the proce, a et of dicrete frequency point i defined for the paband and topband of the filter. Tranition band are excluded. Thi dene grid of frequencie i ued to repreent the continuou frequency pectrum. Extremal frequencie will then be located at particular grid frequencie a determined by the algorithm. The baic tep of the method a it i applied to our filter deign problem are hown below. Reme Exchange Algorithm I. Make an initial gue a to the location of x extremal frequencie, including an extremal at each band edge. II. Uing the extremal frequencie, etimate the actual frequency repone by uing the Lagrange interpolation formula. III. Locate the point in the frequency repone where maximum occur and determine the error at thoe point. IV. Ignore all new extremal beyond the number initially et in I.

189 80 Practical Analog and Digital Filter Deign V. If the difference between the maximum and minimum error at the remaining extremal i mall enough, continue to VI. Otherwie return to II uing the retained extremal. VI. Etimate the final frequency repone and determine the cm value from it. Then determine the impule repone coefficient. Each tep in the procedure can be implemented in a variety of way. Thee variation can produce difference in the peed of executing the algorithm, but uually little difference in accuracy i noticed. The implet method of implementing tep I i to aign the x extremal frequencie uch that they are equally paced throughout the band of interet. Extremal are uually placed at all band edge that are adjacent to tranition band. The initial band and final band may not have extremal located at their terminal edge. The barycentric form of the Lagrange interpolation formula a decribed in the mathematical reference in Appendix A i then ued to determine the frequency repone on the dene grid of frequencie. Thi method i much more efficient and accurate than the alternative method of finding the cm value in 7.37 by matrix inverion. Once the frequency repone ha been determined, the true extrema can be located and the error at thee location calculated. Variou method can be ued to locate the extrema, uually differing in peed and complexity. Thee new frequency point will be ued a the new extrema in the next iteration. It i not unuual to find more extrema in the frequency repone than will be needed to characterie the final frequency repone. Therefore, ome mean i neceary to reduce the number of retained frequencie to x. Again, there are variation on thi procedure, but the general conenu i to retain the extremal that produce the larget error. In tep V, we check the difference between the larget and mallet error produced at the retained extremal. By uing thi value a a progre indicator, we can et ome threhold to indicate when the procedure ha produced the required level of optimiation. If the difference between the minimum and maximum error have not been reduced enough, the algorithm continue from tep II. When the optimiation procedure ha reached the deired threhold, the extremal frequencie can be ued to determine the cm value in 7.37 and therefore the impule repone coefficient hn from Uing the Park-McClellan Algorithm The general algorithm ha great flexibility in deigning any of the four type of FIR filter dicued earlier. The code that i included with thi text will deign lowpa, highpa, bandpa, and bandtop type filter with an odd number of ymmetrical coefficient. The code i written o that other filter type can be implemented by adding to the program tructure. In order to ue the general algorithm, we mut firt convert our filter pecification into thoe needed by the algorithm. Thi amount to converting gain requirement for decibel to abolute error and ome redefinition of frequencie.

190 Finite Impule Repone Digital Filter Deign 8 A in the Kaier window cae, an empirical formulation of the required length of an FIR filter deigned uing the PM algorithm ha been developed, a hown in Although omewhat extenive in it preentation, it doe provide an accurate etimate of the required length. K N K f f 7.39 where K [ logδ [ logδ p p logδ logδ p p 0.476] logδ 0.478] 7.40 K 0.544logδ logδ.0 p 7.4 f f fpa / top f 7.4 Example 7.4 Determining Park-McClellan Coefficient for FIR Filter Problem: Determine the impule repone coefficient for a bandpa filter uing the ame pecification a in Example 7.3 a indicated below, except ue the Park-McClellan algorithm for coefficient determination. f pa 4 kh, f pa 5 kh, f top kh, f top 8 kh, a pa 0.5 db, a top a top 50 db, and f amp 0 kh Solution: We will ue the WFilter program for thi example. The ame input parameter a in the previou example are pecified, except the approximation type ha been changed to Park-McClellan. Uing the pecified parameter, the firt deign attempt reulted in an etimated length of 9, which produced a filter with paband edge gain of 0.54 db and topband edge gain of db. Thee value are certainly very cloe to the deign pecification and might be acceptable in many deign. However, for comparion purpoe, the filter wa redeigned uing a filter length of and produced paband gain of 0.3 db and topband gain of db. The reulting coefficient and frequency repone curve are hown in Figure 7.5 and 7.6. We hould notice the equal ripple in the topband for the PM filter and the fact that it i implemented in one-third fewer coefficient than the Kaier filter. A a comparion to IIR filter, a ixth-order elliptic or an eighth-order Butterworth

191 8 Practical Analog and Digital Filter Deign filter would be required to atify the ame pecification, but without linear phae. FIR Bandpa uing Park-McClellan Procedure Selectivity: Bandpa Approximation: Park-McClellan Implementation: FIR digital Paband gain db: -0.5 Stopband gain db: PB freq-lower H: PB freq-upper H: SB freq-lower H: SB freq-upper H: Sampling freq H: Filter Length/Order: Overall Filter Gain: E00 Coefficient N [ N 0 N ] E E E E E E E E E E E E E E E E E E E E E-0 Figure 7.5 Coefficient value for Example 7.4. Figure 7.6 Magnitude repone for Example 7.4.

192 Finite Impule Repone Digital Filter Deign Limitation of the Park-McClellan Algorithm The Park-McClellan algorithm i certainly an attractive FIR filter deign method, but it doe have certain limitation in comparion to window-baed deign method. The Kaier window deign i baically a one-pa ytem, although ome variation of filter length may be neceary to attain the deired pecification a i alo the cae for the Park-McClellan procedure. The computational intenity of the PM method i far greater than for any of the window method, but computational power i alo more readily available than it wa 0 year ago. Probably the bigget problem with the PM algorithm i that it doe not alway lead to a olution. In ome cae, the iteration equence will not converge, which make it neceary to place an upper limit on the number of iteration allowed. The algorithm can be modified to allow the frequency grid to be made more dene and to initiate the algorithm again if thi happen. Nonethele, there will be occurrence when the problem tatement will need to be redefined in order to attain convergence. For example, if the two topband of a bandpa filter are not of approximately equal ie, one can be artificially reduced to help the convergence proce. Occaionally, the error contraint on the filter mut be adjuted to allow more freedom in the optimiation proce. Even if the proce converge, the frequency repone of the reulting filter mut be checked carefully. Since no requirement are placed on the frequency within the tranition band, trange reult can ometime occur. 7.4 C CODE FOR FIR FREQUENCY RESPONSE CALCULATION Our lat tak i to determine the frequency repone of the filter. A determined in Chapter 5, the frequency repone of a digital filter can be determined from the tranfer function, a hown in 7.43: j Ω H jω H e e 7.43 For a caual FIR filter, the tranfer function can be decribed in 7.44, which then lead to the decription for the frequency repone hown in 7.45: H N k 0 h k k 7.44 H e jω N k 0 h k e jkω 7.45

193 84 Practical Analog and Digital Filter Deign Equation 7.45 can alo be expreed a a um of the real and imaginary portion of the exponential a in The Calc_DigFIR_Rep function implement 7.46 directly, a hown in Liting 7.. H e jω N k 0 h k co kω j N k 0 h k in kω 7.46 /* Calc_DigFIR_Rep - calc repone for FIR filter Prototype: int Calc_DigFIR_RepFilt_Param *FP, Rep_Param *RP; Return: error value Argument: FP - ptr to truct holding filter param RP - ptr to truct holding repon param */ int Calc_DigFIR_RepFilt_Param *FP,Rep_Param *RP { int f,i; /* loop counter */ double raddeg, /* rad to deg converion */ omega,i_omega,/* radian freq and incrmnt */ mag, /* magnitude of freq rep */ rea,img; /* real and imag part */ raddeg 80.0 / PI; /* et raddeg */ /* Loop through each of the frequencie */ forf 0 ;f < RP->tot_pt; f { /* Initialie magna and angle */ RP->magna[f] FP->gain; RP->angle[f] 0.0; /* Pre calc adjuted omega, rea and img */ omega PI * RP->freq[f] / FP->famp; rea 0.0; img 0.0; /* Loop through all the coef */ fori 0 ;i < FP->order; i { i_omega i * omega; rea FP->acoef[i] * coi_omega; img FP->acoef[i] * ini_omega; } /* Calc final reult and conv to degree */ mag qrtrea*rea img*img; RP->magna[f] * mag; /* Guard againt atan0,0 */ ifmag > 0 { RP->angle[f] atanimg,rea;} RP->angle[f] * raddeg; } /* Convert magnitude repone to db if indicated */ ifrp->mag_axi LOG { forf 0 ;f < RP->tot_pt; f { /* Handle very mall number */ ifrp->magna[f] < ZERO { RP->magna[f] ZERO;} RP->magna[f] 0 * log0rp->magna[f]; } } return ERR_NONE; } Liting 7. Calc_DigFIR_Rep function.

194 Finite Impule Repone Digital Filter Deign 85 The magnitude variable i initialied to the value of the gain contant, and the angle variable i et to ero. Then, the repone at each frequency i determined by evaluating the effect of each filter coefficient. The angle i converted to degree, and after all calculation have been made, the magnitude i converted to decibel if the uer requeted that format. 7.5 CONCLUSION By completing thi chapter, we have completed the material on digital filter deign. We invetigated two of the mot popular method of FIR filter deign: the Fourier erie method uing window function and the Park-McClellan optimiation method. We can alo determine and diplay the magnitude and phae repone of the FIR filter we deign. In the next chapter we will invetigate the implementation of both the FIR and IIR digital filter we have deigned. For thoe intereted in the C code for FIR filter deign, pleae refer to Appendix H.

195 86 Practical Analog and Digital Filter Deign

196 Chapter 8 Digital Filter Implementation Uing C In the previou three chapter we dicued the nature of digital filter deign. We are now ready to dicu the implementation of thee digital filter. We begin thi chapter with a dicuion of everal important iue in digital filter election and implementation. Thee iue include the difference between real-time and nonreal-time implementation, a well a the effect of finite preciion repreentation of input ignal and filter coefficient. Then, we dicu the C code for implementing IIR and FIR filter. Efficient algorithm will be developed to increae the peed of execution. Each filter type will ue a different technique appropriate to the pecific filter repreentation. Finally, we conclude with a dicuion of the format for a popular ound file on the PC. We will conider how we can ue ound file to invetigate the characteritic of the filter we have deigned. 8. DIGITAL FILTER IMPLEMENTATION ISSUES The firt deciion to make when deigning a ytem with a digital filter i whether an IIR or FIR filter hould be ued. Some of the advantage and diadvantage of each type have been dicued in the previou two chapter, o we will ummarie thoe point here. Firt, and foremot, the correct filter type mut be determined by the requirement of the application. IIR recurive filter have the advantage of providing higher electivity for a particular order and a cloed form deign technique that doen t require iteration. The deign technique alo provide for the rather precie olution to the pecification of gain and edge frequencie. However, IIR filter alo have the diadvantage of nonlinear phae characteritic and poible intability due to poor implementation. FIR nonrecurive filter, on the other hand, can provide a linear phae repone contant group delay that i important for data tranmiion and high-quality audio ytem. Alo, they are alway table becaue they are implemented uing an all-ero tranfer function. Since no pole can fall outide the unit circle, the filter will alway be table. But 87

197 88 Practical Analog and Digital Filter Deign becaue of thi, the order of the filter i much higher than the IIR filter, which ha a comparable magnitude repone. Thi higher order lead to longer proceing time and larger memory requirement. In addition, FIR filter mut be deigned uing an iterative method ince the required filter length to atify a given filter pecification can only be etimated. Therefore, the filter deigner mut weigh the requirement placed on the digital filter. If great importance i placed on magnitude repone with much le importance on phae repone, then an IIR filter would eem the better choice. If phae repone i far more important than magnitude repone, then an FIR filter i in order. If both magnitude and phae repone eem to be of equal concern, then the proceing time contraint and memory requirement mut be conidered. The FIR filter, even when deigned uing the Park-McClellan method, will require more proceing time and more memory to implement, but alway will be table. If all ele fail, both an FIR and IIR filter with ome phae correction can be deigned to meet the pecification and they both can be teted to evaluate the reult. Once the choice of filter type ha been made, there are till a number of deciion to make. For example, i the ytem to operate in real-time or can it be a nonreal-time ytem? A real-time ytem i one in which input ample are provided to the digital filter and mut be proceed to provide an output ample before the next input ample arrive. Obviouly, thi put a very precie time contraint on the amount of proceing available to the ytem. The higher the ampling frequency, the le time i available for proceing. On the other hand, ome ytem are afforded the luxury of being able to operate in nonreal time. For example, ignal can be recorded on tape or other media and proceed at a later time. In thi type of ytem, extenive proceing can take place becaue there i no fixed time interval that mark the end of the proceing time. In nonreal-time application, high-preciion floating-point repreentation for the coefficient and ignal can uually be ued ince peed i not the critical factor. However, the majority of digital filter application will be real-time application. In thee application there will inevitably be a battle to obtain the highet accuracy, the fatet peed, and the lowet-cot ytem. One of the firt deciion to make i whether the ytem will be a fixed-point or a floating-point ytem. Thi deal not only with the input and output ignal tream, but alo the repreentation of the coefficient and intermediate reult within the proceing unit. 8.. Input and Output Signal Repreentation Fixed point ytem repreent a large market in today digital ignal proceing arena. Many analog-to-digital A/D converter are available to provide output in a fixed-point repreentation. Although many input and output digital ignal ue fixed-point repreentation, there are everal way in which the ame ignal can be interpreted. Mot people are familiar with the bae 0 ytem that human ue, but the digital computer of the world ue a binary or bae ytem. In that ytem,

198 Digital Filter Implementation Uing C 89 each digit repreent a multiplier of a power of jut a each digit in the decimal or bae 0 ytem repreent a multiplier of a power of 0. Let tart with an 8-bit binary number hown below: Thi binary number i equivalent to 5 0 only when we aume that the number i unigned repreent only poitive number. If we had conidered the binary number a igned, the leftmot would have indicated a negative ign, and the value would have been interpreted differently. Uing two complement arithmetic, we can determine the value of the number in 8. by firt negating every digit in the number and then adding one to the reult. That value i then conidered a negative value, a hown in 8.: We can even interpret the original binary number in a different way if we aume that the placement of the binary point equivalent to the decimal point i located at a poition other than to the right of the right-mot digit. For example, if we place the binary point in the middle of the eight binary digit, the number take on another value entirely. In the repreentation hown below, it i conidered an unigned number, but it could jut a well be conidered a igned number a decribed before There are advantage and diadvantage to each of the binary repreentation. The ue of igned number i required in mot digital filter, and the two complement repreentation provide eaier method for addition and ubtraction, but multiplication require pecial conideration. The igned fractional arithmetic illutrated in 8.3 provide great efficiency in multiplication even though addition and ubtraction do require ome pecial tep. By uing fractional notation, a mot commercial digital ignal proceing DSP chip do, we can guarantee that the reult of a multiplication will till be le than one and therefore caue no overflow. However, the addition of two fractional number can provide a reult larger than one and therefore mut be handled carefully. Technique for dealing with potential error in calculation are conidered further in Section Before we leave the area of input and output data repreentation completely, we mut conider the effect of the number of bit per ample on the ignal-to-noie ratio SNR of a digital ytem. It i hown in a number of the digital filter deign reference lited in Appendix A that the SNR for a digital ignal proceing

199 90 Practical Analog and Digital Filter Deign ytem will be directly proportional to the number of quantiation bit ued. To be pecific, the equation i SNR 6.0 B 0 log σ / A db x max In 8.4, B repreent the number of bit ued to repreent the magnitude of the digitied ignal, while σ x and A max repreent the input ignal tandard deviation and the quantier maximum input ignal. Uually, the input ignal amplitude i adjuted uch that σ x /A max i approximately /4. If thi condition i met, and we aume that the input ignal ha a Gauian ditribution which i a valid aumption for many ignal, then the quantier limit will be exceeded only 0.064% of the time. If a maller number i choen for the ratio, the dynamic range of the ytem would be acrificed. If a larger number i choen, the frequency of overflow would increae. Uing the value of /4 give SNR db 6.0 B. 8.5 An important realiation drawn from thi expreion i that the SNR can be improved by 6 db for every bit added to the quantied repreentation. For example, if a particular filtering application require a ignal-to-noie ratio of 80 db, then a D/A converter with at leat 4 bit of magnitude quantiation mut be available. 8.. Coefficient Repreentation When it come to the internal proceing of data for a digital filter ytem, there i more of an even mix between fixed-point and floating-point ytem. The market ha a variety of DSP microproceor chip from a number of manufacturer. Thee DSP ytem include a wide election of fixed-point and floating-point ytem. The fixed-point ytem generally provide higher proceing peed at lower cot than do the floating-point ytem. However, the floating-point ytem provide accuracy that many fixed-point ytem cannot achieve. The repreentation for the coefficient doe not have to be the ame a the repreentation elected for the input ignal. Even if both are fixed-point number, the coefficient repreentation can ue a higher preciion repreentation more bit. It i up to the digital filter deigner to determine the ytem characteritic uch that ufficient accuracy i achieved with adequate proceing peed at the lowet poible cot. The repreentation of the filter coefficient within the DSP ytem i of prime concern. Enough accuracy i required in the repreentation of the filter coefficient which determine the pole and ero location to guarantee that the pecification of the filter are met by the implementation. If the accuracy of the coefficient i compromied, the repone of the filter may be everely ditorted, and in ome cae, the tability of IIR filter can be jeopardied. FIR filter will alway be table becaue they are repreented by tranfer function with all ero.

200 Digital Filter Implementation Uing C 9 However, their frequency repone can till be affected by the lack of accuracy of their coefficient. A an example, we conider the cae of the Park-McClellan filter deigned in Example 7.4. The coefficient for that example have been truncated to igned 6-bit, -bit, and 8-bit number a hown in Table 8.. Table 8. Comparion of Original and Truncated Coefficient Coef Original 6-bit -bit 8-bit h h9, h h8, h h7, h h6, h h5, h h4, h h3, h h, h h, h h0, h Equation 8.6 how the procedure for determining the truncated value. The calculation within the Round function actually indicate the procedure of converting the floating-point coefficient to a igned fraction repreentation for ue in fixed-point proceor. The multiplication outide of the Round function convert the igned fraction back to a truncated decimal: B h n h0 h trunc n Round B h A we would expect, a the number of bit i reduced, the error in the coefficient increae. The frequency repone generated from the 6-bit coefficient wa virtually identical to the original repone. However, the repone due to the -bit and 8-bit coefficient were noticeably degraded, a hown in Figure 8.. In that figure, the paband repone wa virtually unchanged in all cae, but the topband characteritic did not match thoe of the original coefficient hown a 56.7 db. The -bit coefficient did produce a repone that atified the original deign pecification of 50 db. The 8-bit coefficient, however, caued the frequency repone to degenerate completely, providing a little a 3 db of attenuation. The reaon for thi degradation, of coure, i that the truncation ha moved the pole and ero location from their original poition.

201 9 Practical Analog and Digital Filter Deign Figure 8. FIR filter frequency repone uing truncated coefficient Retaining Accuracy and Stability There i no effective way to directly relate the accuracy of the coefficient to the degree of degradation of the frequency repone. At thi time, trial and error technique are all that can be offered when determining the neceary accuracy of coefficient. However, there are ome helpful practice that can be oberved when dealing with the implementation of thee coefficient to reduce the effect of truncation. The following uggetion relate to IIR filter unle tated otherwie ince they have ome unique problem due to their recurive nature. The fact that IIR filter are implemented uing feedback lead to pecial problem that the FIR filter doe not experience. Probably the mot important implementation rule when dealing with IIR filter i that it i much better to implement the filter a a cacade of quadratic factor a we have done than to combine the tranfer function into a quotient of high-order polynomial. Even ome experimentation ha been done with thi idea for FIR filter. Thi technique provide better control of the tability of the filter. By quantiing the coefficient that repreent the filter, we are actually pecifying a fixed number of poition within the unit circle where the pole can be located. The fewer bit ued for quantiation, the fewer the poition for the pole. In addition, thee pole location are not uniformly ditributed within the unit circle. However, by chooing different topologie for the implementation uch a a coupled form of quadratic, more uniformly ditributed pole location can be achieved. Alo, it ha been hown that thoe pole which either lie cloe to the unit circle or to each other are the mot critical to repreent properly, and therefore may need ome pecial implementation method. Another technique that can be ued to reduce error caued by computation uing finite accumulator i to pair pole and ero located near each other in the ame quadratic factor to reduce large fluctuation. In addition, ection with pole cloet to the unit circle can be

202 Digital Filter Implementation Uing C 93 moved to the end of the evaluation proce to help eliminate overflow. The digital filter deign reference in Appendix A provide further information on other tructure than the quadratic form, including thoe for repreenting pole located extremely cloe to the unit circle. Antoniou, Oppenheim/Shafer 975, and Proaki/Manolaki text provide valuable and detailed material. Several other point can be made when dicuing the coefficient and internal proceing of the filter calculation. In both FIR and IIR filter implementation, the final output value are tored in a regiter that gradually accumulate the value of the final output. Thi accumulator hould normally be allocated a many bit of repreentation a poible becaue it control the ultimate accuracy of the proceor. Overflow and underflow are potential problem for the accumulator ince it i hard to predict the exact nature of incoming ignal. Mot preent dedicated DSP chip provide ome form of caling that can be applied to the input o that temporary large variation can be accommodated without incurring a great deal of error. Thi caling bit can effectively be ued a a temporary additional bit of accuracy for accumulated value to prevent overflow. However, if overflow i inevitable, it i better to have a proceor that will imply aturate at it maximum level than to allow an overflow that can be interpreted a a wing from poitive to negative value. In recurive ytem that ue finite preciion repreentation, a troubleome problem called limit cycle ocillation can occur. There are actually two type of limit cycle: overflow and quantiation. Overflow limit cycle alo called largeignal limit cycle are due to the unmanaged overflow of the accumulator during proceing. Mot overflow limit cycle can be effectively eliminated by the proper ue of ignal caling at the input of the ytem and aturation arithmetic in the accumulator. Many DSP proceor include ome caling feature within the proceor unit that allow the input ignal to be reduced in ie. However, a reduction in the ie of the input ignal alo reduce the SNR of the ytem, although thi i uually better than the ditortion produced by an overflow. Another ueful feature on many DSP ytem today i the ue of aturation arithmetic within the proceing unit. Thi feature will aturate the value to it poitive or negative limit rather than overflow the accumulator. Again, thi will reult in ditortion, but uually le than the overflow would produce. Of coure, another way to help control overflow limit cycle i to increae the ie of the accumulator, if the proceing ytem allow the accumulator to be larger than the tandard coefficient torage ie. The quantiation limit cycle alo called mall-ignal limit cycle generally reult from the handling of quantiation within the ytem and are noticeable when the output hould be contant or ero. Thi problem i the reult of the input ignal change being le than the quantiation level. Two method have been developed to combat thi type of limit cycle. The firt, which may not be a practical alternative, i to increae the number of bit aigned to the repreentation of the ignal value in order to reduce the quantiation error. By reducing the quantiation error, the limit cycle can either be eliminated altogether, or reduced to a tolerable level. The econd method ugget that the product produced by

203 94 Practical Analog and Digital Filter Deign finite preciion multiplication be truncated, rather than rounded, a they are accumulated. Other, more detailed, analyi of limit cycle i included in the reference. 8. C CODE FOR IIR FILTER IMPLEMENTATION When dicuing the implementation of IIR filter, we aume that the filter i decribed by a et of quadratic coefficient of the form determined in Chapter 7. A we have een in the previou ection, a cacaded equence of quadratic tructure i the recommended method of implementation. The baic quadratic building block i hown in the ytem diagram of Figure 8.. Figure 8. Sytem diagram for a ingle quadratic factor. We can generate the tranfer function for thi ection by determining the expreion for the intermediate ignal wn and the output ignal yn. w n x n b w n b w n 8.7 y n w n a w n a w n 8.8 Thee equation can be -tranformed to give W X b W b W 8.9 Y W a W a W 8.0 Equation 8.9 and 8.0 can be rewritten and combined to determine the tranfer function for thi ection of the filter, a hown in 8.. Thi formulation matche the quadratic term we developed for IIR filter. We will be able to match

204 Digital Filter Implementation Uing C 95 equivalent term if we recognie two characteritic. Firt, the a o coefficient i alway one, and econd, the b coefficient in the ytem diagram will be the negative of their value in the tranfer function equation. Y a a H 8. X b b A an example, conider the fourth-order tranfer function for a Chebyhev highpa filter hown in 8.. Thi filter can be implemented by uing the ytem diagram hown in Figure 8.3. A we ee in the diagram, the input ignal i firt multiplied by the gain contant and i then proceed through two quadratic factor. The multiplication by the gain contant could occur at the end of the proce or be ditributed throughout the diagram a well. Notice the ign difference on the b coefficient between the tranfer function of 8. and the ytem diagram of Figure 8.3. Of coure, the coefficient will be repreented with higher preciion than indicated here. 0.0 H C Figure 8.3 Sytem diagram for fourth-order IIR filter.

205 96 Practical Analog and Digital Filter Deign After determining the ytem diagram for a filter, we can ue the diagram a a guide to implementing the filter. For every quadratic factor, we can calculate an intermediate ignal wn and an output ignal yn. Beide xn, wn, and yn, every quadratic ection alo require the value wn and wn a hown in Figure 8. to be retained. We can rewrite 8.7 and 8.8 a w x b 8.3 m b m where we have defined y w a 8.4 m a m m w n 8.5 m w n 8.6 The name m and m are picked to reflect the fact that thee value are the memory tate of the quadratic factor. Each quadratic tructure mut keep track of the previou value that have been preent in the tructure. The IIR filtering proce can be implemented by firt multiplying the input ignal by the gain and then implementing 8.3 to 8.6 for each of the quadratic. Then, before progreing to the evaluation of the next quadratic factor, the value of m and m are updated. A ection of code that will implement thi proce i hown in Liting 8.. In the liting, it i aumed that there are m and m array with ie equal to the number of quadratic, and that the a and b coefficient for the filter are tored in the uual manner. That i, the three coefficient a 0, a, and a for the firt quadratic are followed by the three coefficient for the econd quadratic, and o on. The ame organiation i aumed for the b coefficient. Note that the a 0 and b 0 coefficient are not ued ince they are aumed to be one. We have alo ubtituted the output variable o for the input variable x to let the output value accumulate through everal quadratic ection. o x * gain; forj 0; j < numb_quad ;j { jj j*3; w o - m[j] * b[jj] - m[j] * b[jj]; o w m[j] * a[jj] m[j] * a[jj]; m[j] m[j]; m[j] w; } Liting 8. Segment of code for IIR filter implementation.

206 Digital Filter Implementation Uing C 97 Although the algorithm in Liting 8. will make the correct computation, it could be low becaue of all of the index calculation that mut be made. Actually, compiler will differ in term of how much optimiation can be made with peed-critical code uch a we are dicuing. The peed of thi loop can uually be increaed by uing pointer to the coefficient and memory value. In order to take advantage of thi pointer efficiency we mut tore the filter coefficient in an orderly manner, which will allow them to be acceed equentially in the exact order that they are needed. We can define a new array C that will tore all of the needed coefficient a well a the filter gain contant. The firt element in the array will be the gain contant followed by the coefficient b, b, a, and a for each quadratic factor. The tructure of the C array then ha the following form: C[0] gain C[5] b quad C[] b quad C[6] b quad C[] b quad C[7] a quad C[3] a quad C[8] a quad C[4] a quad... In addition, an M array mut be created to tore the memory tate of the IIR filter. The ie of the array i equal to twice the number of quadratic factor with the m tate tored in the firt half of the array and the m tate in the lat half. Initially, all of the memory tate are et to ero unle we know ome predefined tate exit for the filter. Thu, the M array ha the following tructure where N i the number of quadratic: M[0] m quad M[N] m quad M[] m quad M[N ] m quad M[] m quad 3 M[N ] m quad Liting 8. how the Dig_IIR_Filter function ued in the DIGITAL program dicued later in thi chapter. All of the function dicued in thi chapter can be found in the \DIGITAL\DIGITAL.C module on the oftware dic that accompanie thi text. The function take a argument pointer to array of input value X, output value Y, memory tate M, and coefficient value C, a well a the number of quadratic factor and number of value in the input and output array. Notice that ince we will be progreing through the X, Y, C, and M array, we have defined indexing pointer x, y, c, and m, which can take on changing value. Never ue the array name itelf a an index or the addre of the array will be lot. The notation may look a little foreign o let take a look at the code on a line-by-line bai. The line number hown are to help with thi dicuion and are not part of the normal code. The proce of uing pointer i very efficient for computational purpoe becaue it fit the nature of the computer. However, it can be a bit confuing to follow. Therefore, in order to provide a more decriptive analyi of the IIR filter code, the code ha been annotated with the tatu of primary array and variable. For thi illutration, it i

207 98 Practical Analog and Digital Filter Deign aumed that there are two quadratic factor and ample value have been entered for the C and M array. At each tep of the proce, the particular value to which c, m, or m are pointing within the array are hown in bold. Only the firt time through the inner loop i illutrated, but we can ee from thi how the pointer progre through the array, and how the memory tate array i changed. In line and of Liting 8., the addree of the input and output array are tranferred to temporary variable x and y that can change without affecting the addree tored in X and Y. Then, line 4 begin a for loop to proce every value in the input array. Line 6 to 8 et up pointer to the memory tate and coefficient array. The m pointer i et to tart at the beginning of the M array where the m tate are tored, while the m pointer i et midway through the M array ince the m tate are tored in the econd half of the array. The initial value of the output, indicated by o, i calculated by multiplying the input value by the firt value in the coefficient array, which i the gain contant. /* Dig_IIR_Filter - filter input array uing IIR coef and mem value to generate output Prototype: void Dig_IIR_Filterint *X,int *Y, double *M,double *C,int numb_quad,int N; Return: error value. Argument: X - ptr to input array Y - ptr to output array M - ptr to memory array C - ptr to coef array numb_quad - number of quadratic N - number of value in array */ void Dig_IIR_Filterint *X,int *Y,double *M,double *C, int numb_quad,int N { int *x,*y, /* ptr to in/out array */ i,j; /* loop counter */ double *c,*m,*m, /* ptr to coef/memory array*/ w,o; /* intermed & output value */ /* Make copie of input and output pointer */ 0 x X; 0 y Y; x: 3,4,5,6,7,... y: 0,0,0,0,0, /* Start loop for number of data value */ 04 fori 0; i < N ;i 05 { /* Make copie of pointer and tart calc */ 06 m M; 07 m M numb_quad; 08 c C; C: 0.0,.0,-0.80,-.0,-.0,0.05,-0.0,-.0,-.0 M:.0,3.0,.0, o *x * *c; C: 0.0,.0,-0.80,-.0,-.0,0.05,-0.0,-.0,-.0 x: 3,4,5,6,7,... o: 0.60 Liting 8. Dig_IIR_Filter function.

208 Digital Filter Implementation Uing C 99 0 /* Start loop for number of quad factor */ forj 0; j < numb_quad ;j { w o - *m * *c; C: 0.0,.0,-0.80,-.0,-.0,0.05,-0.0,-.0,-.0 M:.0,3.0,.0,4.0 w: w - *m * *c; C: 0.0,.0,-0.80,-.0,-.0,0.05,-0.0,-.0,-.0 M:.0,3.0,.0,4.0 w:.0 4 o w *m * *c; C: 0.0,.0,-0.80,-.0,-.0,0.05,-0.0,-.0,-.0 M:.0,3.0,.0,4.0 o: o *m * *c; C: 0.0,.0,-0.80,-.0,-.0,0.05,-0.0,-.0,-.0 M:.0,3.0,.0,4.0 o: *m *m; M:.0,3.0,.0,4.0 7 *m w; M:.,3.0,.0,4.0 8 } 9 /* Convert output to int and tore */ 0 *y intceilo-0.5; y: -3,0,0,0,0,... } } Liting 8. Continued. Notice that the method ued to acce the gain contant i by uing the *c notation, which can be read a the value at which c i pointing. Since c ha jut been initialied to the tart of the C array, and ince the firt element in C i the gain contant, then c i pointing at the gain contant. The notation after c intruct the computer to increment the value of c by one after the equation ha been evaluated. Thi i referred to a pot-incrementing a oppoed to c, which i called preincrementing. At thi point, we are performing pointer arithmetic, which i a pecial type of arithmetic. Remember that the variable c and C contain a number that i an addre of where coefficient are tored in memory. When we increment a pointer we are incrementing an addre and therefore mut do o in a meaningful way. In thi cae, the coefficient are tored a double, which take up 8 byte of memory on a PC. It would be meaningle to increment the addre of an array containing double by byte, or, or anything but 8 byte. Therefore, when we tell the machine to increment c, it increment the number tored in c by 8. Thi i what i meant by pecial arithmetic. The compiler keep track of how to increment pointer variable baed

209 00 Practical Analog and Digital Filter Deign on how the variable are initially declared. For example, if the variable are double, the increment i 8; if they are int, the increment i. Now, returning to our dicuion of Liting 8., we next enter a for loop line ued to calculate the effect of each quadratic factor on the ultimate output value. Line 3 compute the value of w and increment the pointer in the C array a each value i ued. Line 4 5 then make the calculation repreenting the right half of Figure 8. to determine the output value. The pointer c i now pointing to the b coefficient for the next quadratic ection. Line 6 7 update the value of the memory tate and increment m and m to point to the memory tate of the next quadratic ection. The final tep in the determination of the output value i the converion of the floating-point value of o to the fixed point value of *y. The method ued in converting the floating point value to an integer value inure that both poitive and negative value will be rounded correctly. The pointer y i then incremented and the proce repeat for the next value in the input array. We hould note that by the end of the outer for loop, the c, m, and m pointer will be pointing to value that do not belong to them. That all right a long a we don t try to acce them. The next time an input value i filtered, line 6 8 will reet the pointer to the correct poition. One advantage of the algorithm we have jut developed i that it can be ued effectively for either real-time or nonreal-time application. The value x can be taken from either an input port of a DSP ytem, or from an array of value to be proceed a illutrated. Likewie, the value y can be fed to an output port of a DSP ytem or placed in an output array a we have done. We will ee a program for a complete filtering ytem in Section C CODE FOR FIR FILTER IMPLEMENTATION An FIR filter ha no feedback and thu it ytem diagram can be diplayed a hown in Figure 8.4. Thi configuration repreent a convolution involving N coefficient, a decribed by 8.7. Figure 8.4 Sytem diagram for general FIR filter implementation. y n g N k 0 x n k a k 8.7

210 Digital Filter Implementation Uing C Real-Time Implementation of FIR Filter Although the algorithm would appear to be very imple for uch an implementation, the fact that we require N value to tore the memory tate pat value of the input of the filter complicate the procedure omewhat. We will begin by dicuing the real-time implementation problem, and then later we will ee that ignificant time aving can be made with nonreal-time implementation. Firt, we can generate C code to implement 8.7. We will need to update each memory tate after each convolutional um, which we can do within the ame loop if we perform the convolution in revere order. The implet way to handle thi revere order i to revere the coefficient and memory tate in their repective array, a hown in 8.8 the coefficient array and 8.9 the memory tate array. Note that the gain contant i tored a the lat entry in the C array: C array : { a N, a N -,..., a, a0, gain} 8.8 M array :{ x- N, x- N -,..., x-, x0} 8.9 The egment of code given in Liting 8.3 how the baic implementation. We tart the proce by placing the current value of input x[0] into the lat poition of the memory array M. The initial value of the output o i calculated uing the initial value of the memory tate and the coefficient array. Then we enter the for loop to compute the ret of the convolution um. Each time through the loop, the memory tate are updated o that by the end of the loop all of the memory tate occupy the correct poition for the next input value. The final tep in the proce i to multiply the output value by the gain contant of the filter. m[n-] x; o a[0] * m[0]; fork ; k < N ;k { m[k-] m[k]; o a[k] * m[k]; } o * gain; Liting 8.3 Segment of code for FIR filter implementation. The code of Liting 8.3 will correctly compute the output value but the execution will be low becaue of the need for o many index calculation. Liting 8.4 how the Dig_FIR_Filt_RT function for implementing a real-time RT digital FIR filter that make ue of pointer to peed the proce. In thi cae, we will need an M array of a ie equal to the length of the filter N and a C array that i one larger N to accommodate the gain contant. Initially, the M array i

211 0 Practical Analog and Digital Filter Deign filled with ero unle we know the tate of the filter, and the C array i filled with the FIR coefficient in revere order. The final value of the C array i the filter gain contant. We will ue movable pointer within the M and C array. The m and m pointer are initially et to the tart of the array and then incremented toward the end. By uing two movable pointer, we can tranfer memory tate without any need for addre computation. The final tep in the proce before converting the output variable back to an integer i to multiply the accumulated value in o by the gain contant of the filter. Although for thi code, we obtain the value of input from an array, it could jut a well be coming from an input port on a DSP ytem. Likewie, the output value could be written to an output port intead of an array. /* Dig_FIR_Filt_RT - filter input array uing FIR coef ue real-time code Prototype: void Dig_FIR_Filt_RTint *X,int *Y, double *M,double *C,int numb_coef,int N; Return: error value. Argument: X - ptr to input array Y - ptr to output array M - ptr to memory array C - ptr to coef array numb_coef - number of coefficient N - number of value in array */ void Dig_FIR_Filt_RTint *X,int *Y,double *M,double *C,int numb_coef,int N { int *x,*y, /* ptr to in/out array */ i,j; /* loop counter */ double *c,*m,*m, /* ptr to coef/memory array */ o; /* output value */ } /* Make copie of input and output pointer */ x X; y Y; /* Start loop for number of data value */ fori 0; i < N ;i { /* Make copy of pointer and tart loop */ M[numb_coef-] *x; c C; m m M; o *m * *c; /* Ue convolution method for computation */ forj ; j < numb_coef ;j { *m *m; o *m * *c; } /* Multiply by gain, convert to int and tore */ o * *c; *y intceilo-0.5; } Liting 8.4 Dig_FIR_Filt_RT function.

212 Digital Filter Implementation Uing C 03 Thi implementation of the FIR filter i low becaue of the contant memory tate huffle. Note that mot ophiticated DSP proceor have handled thi huffle by implementing what i referred to a a circular buffer. A circular buffer i one in which the lat entry i magically connected to the firt entry. In other word, if a pointer that i pointing to the lat entry in the buffer i incremented, the proceor automatically adjut the pointer to point to the firt entry of the buffer. Thi help tremendouly, becaue with a circular buffer, no memory tate need to be moved. The newet input value i imply written into the circular buffer over the oldet memory tate. The tarting point of the convolution i then adjuted to the proper value and the proce continue in the normal manner. Although a circular buffer can be imulated on a PC, it require pecial coding beyond the cope of thi text. In the next ection we will dicu a much fater nonreal-time method that we can ue intead. We will leave the real-time circular buffer implementation to the DSP chip programmer ince DSP ytem are uually ued for thi type of work Nonreal-Time Implementation of FIR Filter The implementation of the FIR filter under nonreal-time condition can be made much more efficient becaue we will have available a many of the input value a we would like and that memory will hold. The input value not only repreent the input for the ytem, but alo the memory tate of the ytem. The need for the contant huffle of pat memory tate will be removed to a great degree a we will ee. To undertand the efficiency of the nonreal-time proce, it may be helpful to view the convolution proce graphically. Figure 8.5 how an array of input value and an array of coefficient value. We can viualie the convolution proce a the generation of the um of product a the coefficient lide pat the input value. In part a of Figure 8.5, we ee the initial poition of the convolution proce where x 0 i the firt input value to be proceed. If previou value of the input are not available then x through x N would be et to ero. After the convolution um of product i calculated, the value of y 0 can be determined. The array of coefficient can then be effectively moved one poition to the right and the convolution performed again for y. Thi procedure will continue until we reach the end of the input array, proceing the lat value of the array x L, a hown in part b. Note that ince we have a very large array of input value, we can perform many convolution um without huffling the pat value of input. However, there i uually a limit to how large an input array can be brought into memory. Therefore, we will eventually need to bring in a new array of L input value and tart the convolution again from the tart of the new array. But in order for the initial convolution um on thi new array to be correct, the value immediately preceding the x L value mut be available at the beginning of the input array, a hown in part c of the figure. Conequently, we will need to move the lat N value of the initial input array to the beginning on the array. Thi

213 04 Practical Analog and Digital Filter Deign movement proce will have to be accomplihed at the end of proceing each egment of the input array. If we make the input array buffer much larger than the length of the FIR filter, thi amount of proceing hould be inignificant. Figure 8.5 Graphical interpretation of convolution. Liting 8.5 how the Dig_FIR_Filt_NRT function for implementing the nonreal-time NRT form of the FIR filter. In thi function, the pointer to the input, output, and coefficient array are paed a argument a well a the number of coefficient and number of value to be proceed in the input array. Notice that a eparate array of memory tate i not neceary ince the input array alo repreent the memory tate. The function tart by aigning the addre of the firt input value to the pointer variable x, which will march through the array keeping track of the tarting point of the convolution. A temporary pointer to the proper output array value i alo initialied. The pointer to the coefficient array c i initialied within the firt for loop, which control the proceing of all input value. The convolution um i then calculated moving the x and c pointer progreively through the repective array accumulating product. After the ummation i complete, the next tep i to multiply the accumulation by the filter gain contant, which ha been tored at the lat entry in the C array. The proce i completed by converting the output floating-point value to a fixed-point value and reetting the tarting point in the x array to the correct poition for the calculation of the next output value. After all value in the input array have been proceed,

214 Digital Filter Implementation Uing C 05 the lat N value in the array are copied to the beginning of the X array for the proceing of the next input egment. A we will ee in the next ection, when input value are tored in the X array, they are not placed at the beginning of the array which would overwrite the memory tate of the filter, but rather placed at an advanced poition in the array baed on the length of the filter. /* Dig_FIR_Filt_NRT - filter input array uing FIR coef ue nonreal-time code Prototype: void Dig_FIR_Filt_NRTint *X,int *Y, double *C,int numb_coef,int N; Return: error value. Argument: X - ptr to input array Y - ptr to output array C - ptr to coef array numb_coef - number of coefficient N - number of value in array */ void Dig_FIR_Filt_NRTint *X,int *Y,double *C, int numb_coef,int N { int *x,*y, /* ptr to in/out array */ i,j; /* loop counter */ double *c, /* ptr to coefficient array */ o; /* output value */ } /* Make copie of input and output pointer */ x X; y Y; /* Start loop for number of data value */ fori 0; i < N ;i { /* Make copy of coef pointer and tart loop */ c C; o *x * *c; /* Ue convolution method for computation */ forj ; j < numb_coef ;j { o *x * *c;} /* Multiply by gain, convert to int and tore */ o * *c; *y intceilo-0.5; /* Reet the pointer in input data */ x - numb_coef - ; } /* Copy lat value to front of buffer */ memcpyx,&x[chunk_size],*numb_coef-; Liting 8.5 Dig_FIR_Filt_NRT function. 8.4 FILTERING SOUND FILES We have now developed everal way to implement the digital filter that we deigned in the previou chapter. It i now time to actually implement them and liten to the reult. Dedicated DSP proceor may not be available to u, but many of u do have ound card in our computer, o we can at leat implement

215 06 Practical Analog and Digital Filter Deign the nonreal-time verion of the filter. The manner in which thi will be accomplihed i the following. Two ound file have been included on the oftware dic included with thi text, and we can record other ound file uing our ound card. Thee ound file can be filtered uing WFilter, which ha been included with thi text. After filtering the ound file, we can compare the reult uing the ound card to play the original and filtered verion of the ound file. Pleae read the documentation for your ound card to determine how to record and play ound file. To get further information on ound file format and the C code ued in filtering the file, pleae refer to Appendix I. To demontrate the eae of filtering waveform, we ll deign a digital filter and ue it to filter one of the waveform on the oftware dic in our next example. Example 8. IIR Digital Filtering of Waveform Problem: Determine the effect on muic.wav available on the CD when it i filtered by a digital Butterworth IIR filter with the following characteritic: a pa 0.5 db, a top 60 db, f pa 800 H, and f top,600 H Solution: Firt, we deign the filter uing WFilter. Since we will be filtering a file ampled at,050 H, we ue that value a the ampling frequency. After deigning the filter, we can elect Filter Wave File from the Option menu. The following dialog box will be hown. Figure 8.6 Filter Wave File dialog box. We can identify the file to be filtered by typing directly into the dialog box or by uing the browe button to locate the file. After pecifying the input and output file name, imply pre the Filter button and the filtering action will take place. You will be able to tell when the filtering ha finihed by the play button being enabled. Now we can compare the two ound file by playing each file individually. Notice that the lowpa filter wa ucceful in eliminating the chime from the original verion.

216 Digital Filter Implementation Uing C 07 Other filter can be created and other ound file can be filtered. If you ue the peech.wav file on the accompanying dic be aware that it ha a ampling frequency of,05 H. It i alo captured a an 8-bit file. 8.5 CONCLUSION We have reached the end of thi chapter where the implementation of FIR and IIR filter ha been developed. We have developed a fully functional program to filter ound file, which can be mono or tereo, and 8-bit or 6-bit file. Other file format can be added to the program with minimum effort by writing function to read and write the file header and paing the required information to our function. Compreed file can be handled by implementing a decompreion function between the reading of the data and it filtering. Further information on ound file format and C code for filtering can be found in Appendix I.

217 08 Practical Analog and Digital Filter Deign

218 Chapter 9 Digital Filtering Uing the FFT At thi point we have dicued the deign and implementation of digital filter. In the proce we have invetigated the characteritic of the input and output ignal in both the time and frequency domain. It i time now to invetigate a more direct relationhip between the time domain and frequency domain for dicrete time ytem. We will begin by dicuing the dicrete time verion of the Fourier tranform. After the dicrete Fourier tranform DFT dicuion, we will learn about the more computational efficient verion called the fat Fourier tranform FFT. The C code for the FFT will be developed, and finally, we will take a look at one method of uing the FFT in linear filtering. 9. THE DISCRETE FOURIER TRANSFORM DFT The Dicrete Fourier Tranform DFT can be ued to compute the frequency content of any dicrete time ignal. Conider firt 9., where ω i periodic with a period of π. Remember that a radian frequency of π in the -plane i equivalent to the ampling frequency F in the -plane. In 9., xn repreent the time domain ignal, which ha an infinite number of ample. The pectrum that will reult from ampling an analog ignal will actually be many replica of the analog pectrum paced at multiple of the ampling frequency, a hown in Figure 5. in Chapter 5. We will be able to elect jut one of thee pectrum by uing a filter at the output of our dicrete time ytem. n X ω x n e jωn 9. We ee that although 9. correctly define the Fourier tranform for a dicrete time ignal, it i impoible to implement for two reaon. Firt, we will never be able to obtain all of the time domain ample, and econd, we will never be able to evaluate the equation at all value of the frequency variable ω. 09

219 0 Practical Analog and Digital Filter Deign Therefore, the firt adjutment we make to our trict definition i to modify 9. to reflect the fact that we will have only a finite number of ample of xn with which to work. Equation 9. how the definition when we aume that we have only N ample of the ignal data: X ω N n 0 x n e jωn 9. Truncating the ignal equence a in 9. i effectively applying a rectangular window to the time domain equence. Thi caue problem in the reulting frequency domain decription which can be leened by applying a different window uch a one ued in Chapter 7 dealing with FIR filter coefficient. The impact of uch a window will be dicued very oon. If we further aume that we ll only need to evaluate the frequency repone data at a finite number of equally paced frequencie from 0 π, we have the definition of the K-point DFT of an N-point ignal. N jω n k X ωk x n e, k 0,,, K- n 0 πk whereωk K 9.3 Example 9. Calculation of DFT with Rectangular Window Problem: Determine the DFT of an audio ignal containing three ditinct frequencie of F kh, F 3 kh, and F 3 4 kh. Aume that the ampling frequency i F 0 kh and that we make ue of either 0 or 40 ample of the waveform. Ue a rectangular window in other word, imply truncate the equence. Solution: Firt, we generate a waveform containing the three frequencie. x n inπ F n / F inπf n / F inπf n / F 3 Then, we calculate the DFT uing 9.3 letting K,000 point. Thi give u a near continuou frequency repone. The reult are hown in Figure 9.. Although not hown, if we had ued a large number of data point N,000, the DFT graph would have hown ix very ditinct pike in the frequency domain with far le clutter at other frequencie. There are ix major repone in the pectrum becaue the content from 0 kh to 0 kh i a mirror reflection of the

220 Digital Filtering Uing the FFT content from 0 H to 0 kh. We need only to concern ourelve with the firt half of the pectrum. A it i, we can ee that the three major pike in the firt half of the pectrum generally reflect the three frequencie of our waveform. A N increae, the poition will become more and more precie. However, we hould be concerned about the clutter at other frequencie and why it i reduced a N increae. Figure 9. DFT of three frequencie with rectangular window. The explanation of the numerou extraneou lobe contained in the DFT repone goe back to the time domain and our truncation of xn. By truncating the equence, we effectively multiplied two time domain function together, a hown in 9.4. The rectangular window function wn in our example will have 0 or 40 value of one and ero for all other value. x trun n x n w n 9.4

221 Practical Analog and Digital Filter Deign When two waveform are multiplied in the time domain, their frequency pectrum are convolved in the frequency domain. Although the frequency pectrum of the ignal will be three pike, the frequency pectrum of the rectangular window will be a inc function hown in Figure 9.. Notice all of the ide lobe produced. When convolved with the three pike repreenting the three ignal frequencie, thee ide lobe will create the extraneou ide lobe hown in Figure 9.. By contrat, when viewing the repone of the tranform of the Hamming window, we ee no annoying ide lobe, but a maller and wider main lobe. The reult of uing a Hamming window i hown in Example 9.. Figure 9. DFT of rectangular and Hamming window. Example 9. Calculation of DFT with Hamming Window Problem: Repeat Example 9., but ue a Hamming window on the truncated input equence. Solution: The input equence xn i formed the ame way a in Example 9., but the window function wn take on the following value: w n coπ n / N After calculating the DFT of the product xn wn, the reult are diplayed in Figure 9.3 with a number of intereting comparion to Figure 9.. Firt, we notice that the clutter of the ide lobe of Figure 9. ha been reduced to a great degree. However, we alo notice that for the 0-point ignal cae, there are no longer three, nearly equal pike in the firt half of the pectrum. Even in the 40-point cae, the three pike are no longer a clearly ditinct. Thee reult derive from the fact that the tranform of the Hamming window i approximately twice a wide a the main lobe of the rectangular window tranform. The reulting reolution of the tranform i therefore not a crip a in the rectangular cae.

222 Digital Filtering Uing the FFT 3 Figure 9.3 DFT of three frequency length with Hamming window. It can be hown that the frequency reolution f of the DFT i improved by increaing the number of time domain ample, a hown in 9.5. A N increae, the ability to ee maller frequency detail improve regardle of window type ued. The coefficient m w i a windowing factor that take on a value of for a rectangular window, approximately for a Hamming window, and other value for Kaier baed on the β value choen. See Orfanidi text for further detail. f m w f N m w T N 9.5 Example 9.3 Determine Reolution for DFT Sytem Problem: Determine the number of time domain ample needed to reolve the three frequencie of Example 9. and 9..

223 4 Practical Analog and Digital Filter Deign Solution: In each cae, the reolution f required i kh in order to clearly ee the three frequencie. In Example 9., m w will be, and for Example 9., we will ue a value of. Equation 9.3 can then be ued to determine that the number of time ample N needed would be 0 for Example 9. and 40 for Example 9.. Figure 9. and 9.3 eem to upport thee value. From the previou example we ee that we mut chooe N carefully to get the reolution required for our ytem. It eem obviou that the more time domain ample available, the clearer the picture of the frequency pectrum will be, and that i true. But once the minimum number of data ample i determined, i there any advantage to increaing the number of frequency point computed? It may not be clear at thi point, but providing more frequency point doe not improve the reolution, it imply provide a more continuou graph of the pectrum. Thi i een in Figure 9.4, which how the Hamming window cae with N 0 and K 0. Comparing thi to the 0-point graph in Figure 9.3, we note that the 3-kH component i obcured in either cae. Increaing the number of frequency data point 50-fold did nothing to improve the reolution of the DFT. In a imilar argument, if you have available many time ample, but compute far fewer frequency point, you are loing valuable frequency information. Therefore, a general rule of thumb i to let N K a a tarting point in the deign of a DFT ytem. On occaion, it may be neceary to allow K to increae to find a more exact value of the frequency of a maximum. 9. THE FAST FOURIER TRANSFORM FFT While the computation of the DFT may be traightforward, it i not without computational cot. For an N-point DFT, each frequency point will require N multiplication of the real valued xn time the complex valued exp jω k n. Thi operation effectively require two real multiplier. Then, auming there are N different frequency point, there will be N complex multiplication neceary for the computation of the DFT. Thi can produce large number very quickly. The fat Fourier tranform FFT had it beginning in 965, long before the DSP chip wa even a dream of engineer. However, it took the computational power of computer to bring it importance to the attention of deigner. It i ometime thought that the FFT produce a different reult than the DFT, but it doe not. The FFT i imply a fater method of computing the DFT. Derivation of the FFT algorithm can be found in the reference in Appendix A, but it i worthwhile to ee a imple illutration of how computational aving can be made uing the FFT.

224 Digital Filtering Uing the FFT 5 Figure 9.4 DFT with Hamming window and K The Derivation of the FFT To begin, conider 9.6, which i a treamlined verion of 9.. In it we replace ω k with the index k, and let W N replace the cumberome exp jπ/n. Thee W N kn term are often referred to a twiddle factor , 0, N-,, k W n x k X N n kn N We can now look at a imple 4-point DFT example. If we expand 9.6 into four eparate equation repreenting the four frequency point, we have W x W x W x W x X W x W x W x W x X W x W x W x W x X W x W x W x W x X Uing the value of the twiddle factor in thi pecial cae we can repreent thi proce a a matrix multiplication a follow: 9.8 x X j j j j

225 6 Practical Analog and Digital Filter Deign Another popular method decribing the mathematical proce, and one that better decribe the computational efficiency we are looking for, i to ue ignal flow graph, a hown in Figure 9.5. In thi decription, all branche of the graph have a weight or multiplier of except a noted. Figure 9.5 Four point decimation-in-time FFT. It i clear from thi illutration that few multiplication are neceary and alo that ample are combined at intermediate point along the path. For example, in the middle of the diagram we ee that combination of x 0 and x a well a x and x 3 are made. Thee combination are then proceed a a unit that ave individual computation. So intead of x 0 being involved in four multiplication a hown in 9.7, it i involved only in two. Thi efficiency i continued for larger FFT. For example, if an 8-point DFT were required, two 4-point DFT would be ued with an additional butterfly tage. The ditinctive cro-linked tructure in Figure 9.5 i called a butterfly becaue if you rotate it 90 that i what it look like. A the length of the DFT increae, the number of butterfly tage increae a well, which produce the efficiency. The net effect i that the FFT algorithm would require N log N complex multiplication intead of N a in the DFT cae. The reulting efficiency can be een in Table 9.. One intereting feature of the proce hown in Figure 9.5 i that the frequency point along the right ide of the graph are in equence, while the time point are in huffled order. Thi particular ordering i decribed a the decimation-in-time DIT tranform. There i alo a decimation-in-frequency DIF algorithm in which the time-domain ample remain in equence, but the frequency component are huffled. Although the huffled equence may look arbitrary, we will ee that the ordering can be exploited with a novel addreing mode available in mot DSP proceor. A an example, conider an 8-point FFT looking only at the input equence a hown in Table 9.. Column how the huffled order of xn a being x0, x4, x, and o forth. Column how the

226 Digital Filtering Uing the FFT 7 binary equivalent of the index. Column 3 how the reult of revering the bit of column. Finally, the lat column how that the indice are in order if viewed a bit-revered value. Thi feature i exploited in DSP chip and i a common addreing mode ued for FFT, one of the many efficiencie built into DSP chip. Table 9. Comparion of DFT and FFT Computation N DFT FFT Ratio DFT/FFT , ,536,048 3,04.05E06 0,40 0 4, E06 49,5 34 6, E06 9,380,70 65, E09.05E06 4,096 Table 9. Bit-Revered Addreing DIT order Index a binary Bit-revered index Bit-revered order 9.. The Invere FFT Once the FFT ha been computed, we have information about the frequency content of the ignal. There are many cae when we will need to proce thi frequency information in ome way and then want to tranform the frequency content back to the time domain. For that we will need the invere FFT. Becaue of the ymmetry of the tranform, it can be hown that the invere FFT can be baed on the FFT with imple operation both before and after the FFT, a hown in 9.9. A indicated, the invere FFT of a equence can be found by finding the FFT of the conjugate of the equence, and then conjugating the reult and dividing by N the length of the FFT. We will make ue of thi fact in Section 9.4. At thi point we are ready to dicu the C code neceary to implement the FFT algorithm. [ FFT X ] FFT X N * * 9.9

227 8 Practical Analog and Digital Filter Deign 9.3 C CODE FOR THE FFT A we begin the dicuion of the C code for computation of the FFT, it i important to note the difference between programming for a general purpoe proceor and a DSP chip. The DSP chip i a microproceor deigned to implement the type of computation that are commonplace in digital ignal proceing application. Thee include complex arithmetic, convolution, and fat Fourier tranform. DSP proceor have multiple data and control bue and highly efficient intructional command. For example, mot DSP proceor will be able to accomplih a multiply-add intruction in only one intruction cycle while general purpoe proceor would require many more. Another major difference i the fact that DSP chip have an addreing mode that include bit-revered addreing. Thi eliminate the huffling of data point either time-domain or frequency-domain that we need in our general purpoe code. A well, DSP proceor have dual memorie to hold the real and imaginary part of complex number, while we have to implement a complex data type to handle the FFT computation. Therefore, it i recommended that if your project will be implemented on a DSP chip, you ue the feature of the oftware for that chip to mot efficiently implement your project. But if you have a need to implement the FFT on a general purpoe proceor, we will develop that code now. There are a number of FFT algorithm dicued in the available reference, but we will dicu the common decimation-in-time radix- algorithm. A radix- implementation require that the number of input data point be equal to a power of two, a hown in 9.0, where B i an integer. Although thi may firt appear to be a limitation, it i not. Any input equence can imply be increaed to the required ie by adding ero to the end of the equence. Thi operation i referred to a padding the equence and in no way affect the computation of the FFT. B N 9.0 Liting 9. how FatFT, a function to compute the DIT implementation of the FFT. Thi function ha been adapted from Orfanidi text lited in Appendix A and i imilar to other decribed in the literature. The input ignal ha been placed into a complex array X ince thi particular algorithm will perform an in-place computation of the FFT. That mean that after the FFT ha been completed, the reulting complex valued FFT will reide in the array X. Thi will make the ue of memory more efficient. In addition to the input array, the function alo receive the length of the FFT and the number of bit required to decribe each index. The firt tep in the procedure i to wap the value in the input array a required in a DIT implementation. Thi i accomplihed in the firt loop and make ue of the RevBit function hown in Liting 9. alo adapted from the Orfanidi text. After the input value have been wapped, the FFT i computed by

228 Digital Filtering Uing the FFT 9 mean of equential calculation of the butterfly tage with the required twiddle factor computed firt. /* FatFT - radix- decimation-in-time Fat Fourier Tranform Prototype: void FatFThort Length, hort Bit, complex *X; Argument: Length - length of FFT Bit - Length ^Bit X - ptr to array of complex number Return: none converion done in place */ void FatFThort Length, hort Bit, complex *X { long k, i, p, q, /* counter and indice */ M; /* tage of FFT */ complex A, B, V, W, Tmp; /* complex contant */ hort n, /* counter */ RIndex; /* revered ndex */ } /* Swap the value in x */ forn 0; n < Length; n { RIndex RevBitn,Bit; /* get revered index */ if RIndex < n continue; /* only need to wap half */ Tmp *Xn; *Xn *XRIndex; *XRIndex Tmp; } /* Implement the butterfly in tage */ M ; while M < Length /* while loop control tage of FFT */ { W.re co*pi / M; /* twiddle factor */ W.im in*pi / M; V.re ; V.im 0; fork 0; k < M/; k /* index through tage */ { fori 0; i < Length; i M { p k i; q p M / ; A X[p]; B cmulx[q],v; X[p] cadda,b; /* butterfly operation */ X[q] cuba,b; } V cmulv,w; } M * M; } Liting 9. FatFT function. Thee two function can now be ued to compute the FFT of any input equence. All that i required i that the equence be adjuted to a length that i a power of two by padding the end of the equence with ero. The function can then be provided with the pointer to the equence, the length of the equence, and the number of bit in the indice. After the function ha completed it work, the array X will hold the complex valued FFT. Thee value will be tored a the real and imaginary value of the tranform, but can be better interpreted a the

229 0 Practical Analog and Digital Filter Deign magnitude and phae angle of the tranform. The converion from one form to another i hown in When computing the phae angle you hould ue the atan function that take both the real and imaginary value a argument. Thi guarantee that the angle will be placed in the correct quadrant. /* RevBit - revere the bit in an integer Prototype: hort RevBithort Input, hort NumBit; Argument: Input - integer to revere NumBit - number of bit ued Return: integer with bit revered */ /* Adapted from Orfanidi - Intro. to Signal Proceing */ hort RevBithort Input, hort NumBit { hort i, /* loop counter */ RevInput; /* interger with revered bit value */ RevInput 0; /* Loop through Input, bit by bit. If bit i et, et appropriate bit in RevInput, and clear bit in Input.*/ fori NumBit-; i > 0 ;i-- { if Input >> i { RevInput << NumBit--i; Input - << i; } } return RevInput; } Liting 9. RevBit function. Magnitude Re X Im X 9. Angle arctanim X / Re X 9. The interpretation of the reulting frequency repone i eay a long a we remember that the value of the FFT will be pread from ero frequency up to the ampling frequency. Therefore, if we had a,04-point FFT computed on a equence that had been ampled at a frequency of 0 kh, the value in the tranformed equence would be paced every 9.53 H 0 kh 04. Thi would mean that the firt ample wa the repone at 0 H or the DC value, and the lat value would repreent the repone at 9, H. Remember that the lat half of the repone will be a mirror image of the firt half. Therefore, for thi particular cae, only the firt half of the FFT value would need to be analyed. The other will imply be duplicate.

230 9.4 APPLICATION OF FFT TO FILTERING Digital Filtering Uing the FFT There are many application for the FFT. Frequency analyi, pectral denitie, and filtering are among the more popular. Since thi i a text about filtering, we dicu how the FFT can be ued in filtering application. To begin thi dicuion, we review the proce of FIR filtering firt. Once FIR filter coefficient have been determined, the output ignal of the filter can be determined from the input ignal by convolving the filter coefficient and the input ignal, a hown in 9.3. We learned in Chapter 5 that convolution in the time domain wa equivalent to imple multiplication in the frequency domain, a hown in 9.4. M y n h n x n h k x n k, n 0,,, N k Y H X 9.4 Since we now have a fat algorithm for determining the tranform of a timedomain ignal, it may be ueful to conider the alternative preented by 9.4. Let conider the tep involved in uing tranform to implement the filtering proce:. Tranform the filter coeffient: H FFT [ hn ].. Tranform the input ignal: X FFT [ xn ]. 3. Multiply the two complex equence: Y H X. 4. Invere tranform to find the output: yn FFT - [ Y ]. The proce outlined above may or may not prove to be fater than the convolution of 9.3. It all depend on the number of filter coefficient and the number of point in the FFT. The text by Proaki and Manolaki mentioned in Appendix A offer a detailed comparion that will be dicued further at the end of thi ection. Liting 9.3 how Dig_FFT_Filt that perform tep through 4 above. Note that it i aumed that the filter coefficient have already been tranformed and tored in H. The function firt tranform the input ignal X, then multiplie the coefficient time the tranform of X, and finally compute the invere FFT. Note that the reult of each of thee tep are tored in X. There are many cae when the length of the input ignal exceed the ie of the FFT that can be applied. In that cae, the ignal mut be broken into maller, more manageable, ection and the FFT filtering algorithm applied to each ection. Unfortunately, it i not a imple a taking each N-point group of input ample and generating an output group. The reulting patched-together equence would undoubtedly have dicontinuitie at the combination point. Thi problem can be

231 Practical Analog and Digital Filter Deign alleviated by keeping ome proceed ample from each grouping and uing them a the initial point in the next equence. Thi i exactly what wa done in the FIR filtering code decribed in Section 8.3. and repreent providing initial condition to the filtering proce. When applied in FFT filtering thi proce i often called the overlap-and-ave method. /* Dig_FFT_Filt - perform FFT filtering Prototype: void Dig_FFT_Filtcomplex *X, complex *H, hort numb_coef, hort FFT_ie, hort Bit; Return: error value. Argument: X - input data H - tranform of filter coef numb_coef - number of filter coef FFT_ie - number of pt in FFT Bit - FFT_ie ^Bit */ void Dig_FFT_Filtcomplex *X, complex *H, hort FFT_ie, hort Bit { hort i; /* Perform FFT on X */ FatFTFFT_ie,Bit,X; /* Multiply X and H */ for i 0; i < FFT_ie; i { X[i] cmulx[i],h[i];} /* Get invere FFT of X */ /* Conjugate input */ for i 0; i < FFT_ie; i { X[i] cconjx[i];} /* Perform FFT */ FatFTFFT_ie,Bit,X; /* Conjugate again */ for i 0; i < FFT_ie; i { X[i] cconjx[i];} } /* X now hold the filtered data */ return; Liting 9.3 Dig_FFT_Filt function. Figure 9.6 how the proce. The input ignal i padded with M initial ero auming there are M filter coefficient. Then, the remaining ignal i broken into ection containing L value where L i defined in 9.5. A pictured in the diagram, there will be N ample tranformed in each operation, but the firt M will be the value aved from the lat M value of the previou operation except for the initial grouping, which will have M ero. Once the FFT filtering ha been completed on the grouping, the lat L value of the equence are aved, dicarding the firt M value. Thi operation will reult in an error-free reult when the y grouping are reaembled.

232 Digital Filtering Uing the FFT 3 L N M 9.5 Figure 9.6 Uing the overlap-and-ave method for linear FFT filtering. WFilter doe have an option for FFT filtering available if an FIR filter ha been deigned. Once the filter ha been deigned, the uer can elect to filter a WAV file by electing Option->Filter Wave File. The Filter Wave File dialog box will appear, a hown in Figure 9.7, and will provide the uer the option of filtering the waveform via the more traditional method of convolution a dicued in Chapter 7, or uing the FFT technique dicued in thi chapter. Figure 9.7 Filter Wave File dialog box.

MAT 155: Describing, Exploring, and Comparing Data Page 1 of NotesCh2-3.doc

MAT 155: Describing, Exploring, and Comparing Data Page 1 of NotesCh2-3.doc MAT 155: Decribing, Exploring, and Comparing Data Page 1 of 8 001-oteCh-3.doc ote for Chapter Summarizing and Graphing Data Chapter 3 Decribing, Exploring, and Comparing Data Frequency Ditribution, Graphic

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each type of circuit will be implemented in two

More information

ES205 Analysis and Design of Engineering Systems: Lab 1: An Introductory Tutorial: Getting Started with SIMULINK

ES205 Analysis and Design of Engineering Systems: Lab 1: An Introductory Tutorial: Getting Started with SIMULINK ES05 Analyi and Deign of Engineering Sytem: Lab : An Introductory Tutorial: Getting Started with SIMULINK What i SIMULINK? SIMULINK i a oftware package for modeling, imulating, and analyzing dynamic ytem.

More information

Drawing Lines in 2 Dimensions

Drawing Lines in 2 Dimensions Drawing Line in 2 Dimenion Drawing a traight line (or an arc) between two end point when one i limited to dicrete pixel require a bit of thought. Conider the following line uperimpoed on a 2 dimenional

More information

Lecture 14: Minimum Spanning Tree I

Lecture 14: Minimum Spanning Tree I COMPSCI 0: Deign and Analyi of Algorithm October 4, 07 Lecture 4: Minimum Spanning Tree I Lecturer: Rong Ge Scribe: Fred Zhang Overview Thi lecture we finih our dicuion of the hortet path problem and introduce

More information

Representations and Transformations. Objectives

Representations and Transformations. Objectives Repreentation and Tranformation Objective Derive homogeneou coordinate tranformation matrice Introduce tandard tranformation - Rotation - Tranlation - Scaling - Shear Scalar, Point, Vector Three baic element

More information

Mobile Digital Filter Design Toolbox

Mobile Digital Filter Design Toolbox Mobile Digital Filter Deign Toolbox Somak Sukittanon and Joh Pott Univerity of Tenneee at Martin Department of Engineering Martin, TN USA ukitta@utm.edu, jolpott@ut.utm.edu Abtract! Mobile device have

More information

Motion Control (wheeled robots)

Motion Control (wheeled robots) 3 Motion Control (wheeled robot) Requirement for Motion Control Kinematic / dynamic model of the robot Model of the interaction between the wheel and the ground Definition of required motion -> peed control,

More information

SIMIT 7. Component Type Editor (CTE) User manual. Siemens Industrial

SIMIT 7. Component Type Editor (CTE) User manual. Siemens Industrial SIMIT 7 Component Type Editor (CTE) Uer manual Siemen Indutrial Edition January 2013 Siemen offer imulation oftware to plan, imulate and optimize plant and machine. The imulation- and optimizationreult

More information

Chapter 13 Non Sampling Errors

Chapter 13 Non Sampling Errors Chapter 13 Non Sampling Error It i a general aumption in the ampling theory that the true value of each unit in the population can be obtained and tabulated without any error. In practice, thi aumption

More information

Performance of a Robust Filter-based Approach for Contour Detection in Wireless Sensor Networks

Performance of a Robust Filter-based Approach for Contour Detection in Wireless Sensor Networks Performance of a Robut Filter-baed Approach for Contour Detection in Wirele Senor Network Hadi Alati, William A. Armtrong, Jr., and Ai Naipuri Department of Electrical and Computer Engineering The Univerity

More information

Shortest Paths Problem. CS 362, Lecture 20. Today s Outline. Negative Weights

Shortest Paths Problem. CS 362, Lecture 20. Today s Outline. Negative Weights Shortet Path Problem CS 6, Lecture Jared Saia Univerity of New Mexico Another intereting problem for graph i that of finding hortet path Aume we are given a weighted directed graph G = (V, E) with two

More information

Today s Outline. CS 561, Lecture 23. Negative Weights. Shortest Paths Problem. The presence of a negative cycle might mean that there is

Today s Outline. CS 561, Lecture 23. Negative Weights. Shortest Paths Problem. The presence of a negative cycle might mean that there is Today Outline CS 56, Lecture Jared Saia Univerity of New Mexico The path that can be trodden i not the enduring and unchanging Path. The name that can be named i not the enduring and unchanging Name. -

More information

Multi-Target Tracking In Clutter

Multi-Target Tracking In Clutter Multi-Target Tracking In Clutter John N. Sander-Reed, Mary Jo Duncan, W.B. Boucher, W. Michael Dimmler, Shawn O Keefe ABSTRACT A high frame rate (0 Hz), multi-target, video tracker ha been developed and

More information

Edits in Xylia Validity Preserving Editing of XML Documents

Edits in Xylia Validity Preserving Editing of XML Documents dit in Xylia Validity Preerving diting of XML Document Pouria Shaker, Theodore S. Norvell, and Denni K. Peter Faculty of ngineering and Applied Science, Memorial Univerity of Newfoundland, St. John, NFLD,

More information

New DSP to measure acoustic efficiency of road barriers. Part 2: Sound Insulation Index

New DSP to measure acoustic efficiency of road barriers. Part 2: Sound Insulation Index New DSP to meaure acoutic efficiency of road barrier. Part 2: Sound Inulation Index LAMBERTO TRONCHIN 1, KRISTIAN FABBRI 1, JELENA VASILJEVIC 2 1 DIENCA CIARM, Univerity of Bologna, Italy 2 Univerity of

More information

Generic Traverse. CS 362, Lecture 19. DFS and BFS. Today s Outline

Generic Traverse. CS 362, Lecture 19. DFS and BFS. Today s Outline Generic Travere CS 62, Lecture 9 Jared Saia Univerity of New Mexico Travere(){ put (nil,) in bag; while (the bag i not empty){ take ome edge (p,v) from the bag if (v i unmarked) mark v; parent(v) = p;

More information

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart.

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart. Univerität Augburg à ÊÇÅÍÆ ËÀǼ Approximating Optimal Viual Senor Placement E. Hörter, R. Lienhart Report 2006-01 Januar 2006 Intitut für Informatik D-86135 Augburg Copyright c E. Hörter, R. Lienhart Intitut

More information

Modeling of underwater vehicle s dynamics

Modeling of underwater vehicle s dynamics Proceeding of the 11th WEA International Conference on YTEM, Agio Nikolao, Crete Iland, Greece, July 23-25, 2007 44 Modeling of underwater vehicle dynamic ANDRZEJ ZAK Department of Radiolocation and Hydrolocation

More information

[N309] Feedforward Active Noise Control Systems with Online Secondary Path Modeling. Muhammad Tahir Akhtar, Masahide Abe, and Masayuki Kawamata

[N309] Feedforward Active Noise Control Systems with Online Secondary Path Modeling. Muhammad Tahir Akhtar, Masahide Abe, and Masayuki Kawamata he 32nd International Congre and Expoition on Noie Control Engineering Jeju International Convention Center, Seogwipo, Korea, Augut 25-28, 2003 [N309] Feedforward Active Noie Control Sytem with Online

More information

An Intro to LP and the Simplex Algorithm. Primal Simplex

An Intro to LP and the Simplex Algorithm. Primal Simplex An Intro to LP and the Simplex Algorithm Primal Simplex Linear programming i contrained minimization of a linear objective over a olution pace defined by linear contraint: min cx Ax b l x u A i an m n

More information

SIMIT 7. Profinet IO Gateway. User Manual

SIMIT 7. Profinet IO Gateway. User Manual SIMIT 7 Profinet IO Gateway Uer Manual Edition January 2013 Siemen offer imulation oftware to plan, imulate and optimize plant and machine. The imulation- and optimizationreult are only non-binding uggetion

More information

A SIMPLE IMPERATIVE LANGUAGE THE STORE FUNCTION NON-TERMINATING COMMANDS

A SIMPLE IMPERATIVE LANGUAGE THE STORE FUNCTION NON-TERMINATING COMMANDS A SIMPLE IMPERATIVE LANGUAGE Eventually we will preent the emantic of a full-blown language, with declaration, type and looping. However, there are many complication, o we will build up lowly. Our firt

More information

Laboratory Exercise 2

Laboratory Exercise 2 Laoratory Exercie Numer and Diplay Thi i an exercie in deigning cominational circuit that can perform inary-to-decimal numer converion and inary-coded-decimal (BCD) addition. Part I We wih to diplay on

More information

Compressed Sensing Image Processing Based on Stagewise Orthogonal Matching Pursuit

Compressed Sensing Image Processing Based on Stagewise Orthogonal Matching Pursuit Senor & randucer, Vol. 8, Iue 0, October 204, pp. 34-40 Senor & randucer 204 by IFSA Publihing, S. L. http://www.enorportal.com Compreed Sening Image Proceing Baed on Stagewie Orthogonal Matching Puruit

More information

Routing Definition 4.1

Routing Definition 4.1 4 Routing So far, we have only looked at network without dealing with the iue of how to end information in them from one node to another The problem of ending information in a network i known a routing

More information

Computer Arithmetic Homework Solutions. 1 An adder for graphics. 2 Partitioned adder. 3 HDL implementation of a partitioned adder

Computer Arithmetic Homework Solutions. 1 An adder for graphics. 2 Partitioned adder. 3 HDL implementation of a partitioned adder Computer Arithmetic Homework 3 2016 2017 Solution 1 An adder for graphic In a normal ripple carry addition of two poitive number, the carry i the ignal for a reult exceeding the maximum. We ue thi ignal

More information

Service and Network Management Interworking in Future Wireless Systems

Service and Network Management Interworking in Future Wireless Systems Service and Network Management Interworking in Future Wirele Sytem V. Tountopoulo V. Stavroulaki P. Demeticha N. Mitrou and M. Theologou National Technical Univerity of Athen Department of Electrical Engineering

More information

Quadrilaterals. Learning Objectives. Pre-Activity

Quadrilaterals. Learning Objectives. Pre-Activity Section 3.4 Pre-Activity Preparation Quadrilateral Intereting geometric hape and pattern are all around u when we tart looking for them. Examine a row of fencing or the tiling deign at the wimming pool.

More information

1 The secretary problem

1 The secretary problem Thi i new material: if you ee error, pleae email jtyu at tanford dot edu 1 The ecretary problem We will tart by analyzing the expected runtime of an algorithm, a you will be expected to do on your homework.

More information

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations:

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations: Faculty of Informatic Eötvö Loránd Univerity Budapet, Hungary Lecture : Intenity Tranformation Image enhancement by point proceing Spatial domain and frequency domain method Baic Algorithm for Digital

More information

Comparison of Methods for Horizon Line Detection in Sea Images

Comparison of Methods for Horizon Line Detection in Sea Images Comparion of Method for Horizon Line Detection in Sea Image Tzvika Libe Evgeny Gerhikov and Samuel Koolapov Department of Electrical Engineering Braude Academic College of Engineering Karmiel 2982 Irael

More information

DAROS: Distributed User-Server Assignment And Replication For Online Social Networking Applications

DAROS: Distributed User-Server Assignment And Replication For Online Social Networking Applications DAROS: Ditributed Uer-Server Aignment And Replication For Online Social Networking Application Thuan Duong-Ba School of EECS Oregon State Univerity Corvalli, OR 97330, USA Email: duongba@eec.oregontate.edu

More information

The Association of System Performance Professionals

The Association of System Performance Professionals The Aociation of Sytem Performance Profeional The Computer Meaurement Group, commonly called CMG, i a not for profit, worldwide organization of data proceing profeional committed to the meaurement and

More information

Distributed Packet Processing Architecture with Reconfigurable Hardware Accelerators for 100Gbps Forwarding Performance on Virtualized Edge Router

Distributed Packet Processing Architecture with Reconfigurable Hardware Accelerators for 100Gbps Forwarding Performance on Virtualized Edge Router Ditributed Packet Proceing Architecture with Reconfigurable Hardware Accelerator for 100Gbp Forwarding Performance on Virtualized Edge Router Satohi Nihiyama, Hitohi Kaneko, and Ichiro Kudo Abtract To

More information

Floating Point CORDIC Based Power Operation

Floating Point CORDIC Based Power Operation Floating Point CORDIC Baed Power Operation Kazumi Malhan, Padmaja AVL Electrical and Computer Engineering Department School of Engineering and Computer Science Oakland Univerity, Rocheter, MI e-mail: kmalhan@oakland.edu,

More information

Minimum congestion spanning trees in bipartite and random graphs

Minimum congestion spanning trees in bipartite and random graphs Minimum congetion panning tree in bipartite and random graph M.I. Otrovkii Department of Mathematic and Computer Science St. John Univerity 8000 Utopia Parkway Queen, NY 11439, USA e-mail: otrovm@tjohn.edu

More information

A Study of a Variable Compression Ratio and Displacement Mechanism Using Design of Experiments Methodology

A Study of a Variable Compression Ratio and Displacement Mechanism Using Design of Experiments Methodology A Study of a Variable Compreion Ratio and Diplacement Mechanim Uing Deign of Experiment Methodology Shugang Jiang, Michael H. Smith, Maanobu Takekohi Abtract Due to the ever increaing requirement for engine

More information

Advanced Encryption Standard and Modes of Operation

Advanced Encryption Standard and Modes of Operation Advanced Encryption Standard and Mode of Operation G. Bertoni L. Breveglieri Foundation of Cryptography - AES pp. 1 / 50 AES Advanced Encryption Standard (AES) i a ymmetric cryptographic algorithm AES

More information

How to Select Measurement Points in Access Point Localization

How to Select Measurement Points in Access Point Localization Proceeding of the International MultiConference of Engineer and Computer Scientit 205 Vol II, IMECS 205, March 8-20, 205, Hong Kong How to Select Meaurement Point in Acce Point Localization Xiaoling Yang,

More information

Analyzing Hydra Historical Statistics Part 2

Analyzing Hydra Historical Statistics Part 2 Analyzing Hydra Hitorical Statitic Part Fabio Maimo Ottaviani EPV Technologie White paper 5 hnode HSM Hitorical Record The hnode i the hierarchical data torage management node and ha to perform all the

More information

KS3 Maths Assessment Objectives

KS3 Maths Assessment Objectives KS3 Math Aement Objective Tranition Stage 9 Ratio & Proportion Probabilit y & Statitic Appreciate the infinite nature of the et of integer, real and rational number Can interpret fraction and percentage

More information

AUTOMATIC TEST CASE GENERATION USING UML MODELS

AUTOMATIC TEST CASE GENERATION USING UML MODELS Volume-2, Iue-6, June-2014 AUTOMATIC TEST CASE GENERATION USING UML MODELS 1 SAGARKUMAR P. JAIN, 2 KHUSHBOO S. LALWANI, 3 NIKITA K. MAHAJAN, 4 BHAGYASHREE J. GADEKAR 1,2,3,4 Department of Computer Engineering,

More information

An Approach to a Test Oracle for XML Query Testing

An Approach to a Test Oracle for XML Query Testing An Approach to a Tet Oracle for XML Query Teting Dae S. Kim-Park, Claudio de la Riva, Javier Tuya Univerity of Oviedo Computing Department Campu of Vieque, /n, 33204 (SPAIN) kim_park@li.uniovi.e, claudio@uniovi.e,

More information

Topics. Lecture 37: Global Optimization. Issues. A Simple Example: Copy Propagation X := 3 B > 0 Y := 0 X := 4 Y := Z + W A := 2 * 3X

Topics. Lecture 37: Global Optimization. Issues. A Simple Example: Copy Propagation X := 3 B > 0 Y := 0 X := 4 Y := Z + W A := 2 * 3X Lecture 37: Global Optimization [Adapted from note by R. Bodik and G. Necula] Topic Global optimization refer to program optimization that encompa multiple baic block in a function. (I have ued the term

More information

xy-monotone path existence queries in a rectilinear environment

xy-monotone path existence queries in a rectilinear environment CCCG 2012, Charlottetown, P.E.I., Augut 8 10, 2012 xy-monotone path exitence querie in a rectilinear environment Gregory Bint Anil Mahehwari Michiel Smid Abtract Given a planar environment coniting of

More information

(12) Patent Application Publication (10) Pub. No.: US 2011/ A1

(12) Patent Application Publication (10) Pub. No.: US 2011/ A1 (19) United State US 2011 0316690A1 (12) Patent Application Publication (10) Pub. No.: US 2011/0316690 A1 Siegman (43) Pub. Date: Dec. 29, 2011 (54) SYSTEMAND METHOD FOR IDENTIFYING ELECTRICAL EQUIPMENT

More information

International Journal of Engineering Research & Technology (IJERT) ISSN: Vol. 2 Issue 5, May

International Journal of Engineering Research & Technology (IJERT) ISSN: Vol. 2 Issue 5, May Intertage Pipeline VLI Architecture for 2-D DWT Ajinkya. Bankar 1,Bhavika. haha 2, P.K. Kadbe 3 E&TC Department, Pune Univerity 1,2,3 VPCOE Baramati Abtract In thi paper, a cheme for the deign of a high-pd

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each circuit will be decribed in VHL and implemented

More information

A Multi-objective Genetic Algorithm for Reliability Optimization Problem

A Multi-objective Genetic Algorithm for Reliability Optimization Problem International Journal of Performability Engineering, Vol. 5, No. 3, April 2009, pp. 227-234. RAMS Conultant Printed in India A Multi-objective Genetic Algorithm for Reliability Optimization Problem AMAR

More information

Finite Elements Method in Split Hopkinson Pressure Bar developing process

Finite Elements Method in Split Hopkinson Pressure Bar developing process 6th WSEAS International Conference on SYSTEM SCIENCE and SIMULATION in ENGINEERING, Venice, Italy, November 1-3, 007 63 Finite Element Method in Split Hopkinon Preure Bar developing proce ROTARIU ADRIAN

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each circuit will be decribed in Verilog and implemented

More information

A System Dynamics Model for Transient Availability Modeling of Repairable Redundant Systems

A System Dynamics Model for Transient Availability Modeling of Repairable Redundant Systems International Journal of Performability Engineering Vol., No. 3, May 05, pp. 03-. RAMS Conultant Printed in India A Sytem Dynamic Model for Tranient Availability Modeling of Repairable Redundant Sytem

More information

Focused Video Estimation from Defocused Video Sequences

Focused Video Estimation from Defocused Video Sequences Focued Video Etimation from Defocued Video Sequence Junlan Yang a, Dan Schonfeld a and Magdi Mohamed b a Multimedia Communication Lab, ECE Dept., Univerity of Illinoi, Chicago, IL b Phyical Realization

More information

Integration of Digital Test Tools to the Internet-Based Environment MOSCITO

Integration of Digital Test Tools to the Internet-Based Environment MOSCITO Integration of Digital Tet Tool to the Internet-Baed Environment MOSCITO Abtract Current paper decribe a new environment MOSCITO for providing acce to tool over the internet. The environment i built according

More information

(12) Patent Application Publication (10) Pub. No.: US 2003/ A1

(12) Patent Application Publication (10) Pub. No.: US 2003/ A1 US 2003O196031A1 (19) United State (12) Patent Application Publication (10) Pub. No.: US 2003/0196031 A1 Chen (43) Pub. Date: Oct. 16, 2003 (54) STORAGE CONTROLLER WITH THE DISK Related U.S. Application

More information

CENTER-POINT MODEL OF DEFORMABLE SURFACE

CENTER-POINT MODEL OF DEFORMABLE SURFACE CENTER-POINT MODEL OF DEFORMABLE SURFACE Piotr M. Szczypinki Iintitute of Electronic, Technical Univerity of Lodz, Poland Abtract: Key word: Center-point model of deformable urface for egmentation of 3D

More information

A Practical Model for Minimizing Waiting Time in a Transit Network

A Practical Model for Minimizing Waiting Time in a Transit Network A Practical Model for Minimizing Waiting Time in a Tranit Network Leila Dianat, MASc, Department of Civil Engineering, Sharif Univerity of Technology, Tehran, Iran Youef Shafahi, Ph.D. Aociate Profeor,

More information

Stochastic Search and Graph Techniques for MCM Path Planning Christine D. Piatko, Christopher P. Diehl, Paul McNamee, Cheryl Resch and I-Jeng Wang

Stochastic Search and Graph Techniques for MCM Path Planning Christine D. Piatko, Christopher P. Diehl, Paul McNamee, Cheryl Resch and I-Jeng Wang Stochatic Search and Graph Technique for MCM Path Planning Chritine D. Piatko, Chritopher P. Diehl, Paul McNamee, Cheryl Rech and I-Jeng Wang The John Hopkin Univerity Applied Phyic Laboratory, Laurel,

More information

Keywords Cloud Computing, Service Level Agreements (SLA), CloudSim, Monitoring & Controlling SLA Agent, JADE

Keywords Cloud Computing, Service Level Agreements (SLA), CloudSim, Monitoring & Controlling SLA Agent, JADE Volume 5, Iue 8, Augut 2015 ISSN: 2277 128X International Journal of Advanced Reearch in Computer Science and Software Engineering Reearch Paper Available online at: www.ijarce.com Verification of Agent

More information

SLA Adaptation for Service Overlay Networks

SLA Adaptation for Service Overlay Networks SLA Adaptation for Service Overlay Network Con Tran 1, Zbigniew Dziong 1, and Michal Pióro 2 1 Department of Electrical Engineering, École de Technologie Supérieure, Univerity of Quebec, Montréal, Canada

More information

Introduction to PET Image Reconstruction. Tomographic Imaging. Projection Imaging. PET Image Reconstruction 11/6/07

Introduction to PET Image Reconstruction. Tomographic Imaging. Projection Imaging. PET Image Reconstruction 11/6/07 Introduction to PET Image Recontruction Adam Aleio Nuclear Medicine Lecture Imaging Reearch Laboratory Diviion of Nuclear Medicine Univerity of Wahington Fall 2007 http://dept.wahington.edu/nucmed/irl/education.html

More information

The norm Package. November 15, Title Analysis of multivariate normal datasets with missing values

The norm Package. November 15, Title Analysis of multivariate normal datasets with missing values The norm Package November 15, 2003 Verion 1.0-9 Date 2002/05/06 Title Analyi of multivariate normal dataet with miing value Author Ported to R by Alvaro A. Novo . Original by Joeph

More information

A New Approach to Pipeline FFT Processor

A New Approach to Pipeline FFT Processor A ew Approach to Pipeline FFT Proceor Shouheng He and Mat Torkelon Department of Applied Electronic, Lund Univerity S- Lund, SWEDE email: he@tde.lth.e; torkel@tde.lth.e Abtract A new VLSI architecture

More information

Dynamically Reconfigurable Neuron Architecture for the Implementation of Self- Organizing Learning Array

Dynamically Reconfigurable Neuron Architecture for the Implementation of Self- Organizing Learning Array Dynamically Reconfigurable Neuron Architecture for the Implementation of Self- Organizing Learning Array Januz A. Starzyk,Yongtao Guo, and Zhineng Zhu School of Electrical Engineering & Computer Science

More information

3-D Visualization of a Gene Regulatory Network: Stochastic Search for Layouts

3-D Visualization of a Gene Regulatory Network: Stochastic Search for Layouts 3-D Viualization of a Gene Regulatory Network: Stochatic Search for Layout Naoki Hooyama Department of Electronic Engineering, Univerity of Tokyo, Japan hooyama@iba.k.u-tokyo.ac.jp Abtract- In recent year,

More information

See chapter 8 in the textbook. Dr Muhammad Al Salamah, Industrial Engineering, KFUPM

See chapter 8 in the textbook. Dr Muhammad Al Salamah, Industrial Engineering, KFUPM Goal programming Objective of the topic: Indentify indutrial baed ituation where two or more objective function are required. Write a multi objective function model dla a goal LP Ue weighting um and preemptive

More information

On successive packing approach to multidimensional (M-D) interleaving

On successive packing approach to multidimensional (M-D) interleaving On ucceive packing approach to multidimenional (M-D) interleaving Xi Min Zhang Yun Q. hi ankar Bau Abtract We propoe an interleaving cheme for multidimenional (M-D) interleaving. To achieved by uing a

More information

Lecture 8: More Pipelining

Lecture 8: More Pipelining Overview Lecture 8: More Pipelining David Black-Schaffer davidbb@tanford.edu EE8 Spring 00 Getting Started with Lab Jut get a ingle pixel calculating at one time Then look into filling your pipeline Multiplier

More information

CSE 250B Assignment 4 Report

CSE 250B Assignment 4 Report CSE 250B Aignment 4 Report March 24, 2012 Yuncong Chen yuncong@c.ucd.edu Pengfei Chen pec008@ucd.edu Yang Liu yal060@c.ucd.edu Abtract In thi project, we implemented the recurive autoencoder (RAE) a decribed

More information

NUMERICAL MODELING ON THE DAMPING CONTROL OF TLD STRUCTURE

NUMERICAL MODELING ON THE DAMPING CONTROL OF TLD STRUCTURE 4th International Conference on Earthquake Engineering Taipei, Taiwan October 12-13, 2006 Paper No. 183 NUMERICAL MODELING ON THE DAMPING CONTROL OF TLD STRUCTURE Han jun 1, Li Yingmin 2, Liu Liping 3,

More information

CS201: Data Structures and Algorithms. Assignment 2. Version 1d

CS201: Data Structures and Algorithms. Assignment 2. Version 1d CS201: Data Structure and Algorithm Aignment 2 Introduction Verion 1d You will compare the performance of green binary earch tree veru red-black tree by reading in a corpu of text, toring the word and

More information

AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROBLEM

AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROBLEM RAC Univerity Journal, Vol IV, No, 7, pp 87-9 AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROLEM Mozzem Hoain Department of Mathematic Ghior Govt

More information

Refining SIRAP with a Dedicated Resource Ceiling for Self-Blocking

Refining SIRAP with a Dedicated Resource Ceiling for Self-Blocking Refining SIRAP with a Dedicated Reource Ceiling for Self-Blocking Mori Behnam, Thoma Nolte Mälardalen Real-Time Reearch Centre P.O. Box 883, SE-721 23 Väterå, Sweden {mori.behnam,thoma.nolte}@mdh.e ABSTRACT

More information

A METHOD OF REAL-TIME NURBS INTERPOLATION WITH CONFINED CHORD ERROR FOR CNC SYSTEMS

A METHOD OF REAL-TIME NURBS INTERPOLATION WITH CONFINED CHORD ERROR FOR CNC SYSTEMS Vietnam Journal of Science and Technology 55 (5) (017) 650-657 DOI: 10.1565/55-518/55/5/906 A METHOD OF REAL-TIME NURBS INTERPOLATION WITH CONFINED CHORD ERROR FOR CNC SYSTEMS Nguyen Huu Quang *, Banh

More information

Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz

Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz Operational emantic Page Operational emantic Cla note for a lecture given by Mooly agiv Tel Aviv Univerity 4/5/7 By Roy Ganor and Uri Juhaz Reference emantic with Application, H. Nielon and F. Nielon,

More information

3D SMAP Algorithm. April 11, 2012

3D SMAP Algorithm. April 11, 2012 3D SMAP Algorithm April 11, 2012 Baed on the original SMAP paper [1]. Thi report extend the tructure of MSRF into 3D. The prior ditribution i modified to atify the MRF property. In addition, an iterative

More information

SIMIT 7. What's New In SIMIT V7.1? Manual

SIMIT 7. What's New In SIMIT V7.1? Manual SIMIT 7 What' New In SIMIT V7.1? Manual Edition January 2013 Siemen offer imulation oftware to plan, imulate and optimize plant and machine. The imulation- and optimization-reult are only non-binding uggetion

More information

Kinematics Programming for Cooperating Robotic Systems

Kinematics Programming for Cooperating Robotic Systems Kinematic Programming for Cooperating Robotic Sytem Critiane P. Tonetto, Carlo R. Rocha, Henrique Sima, Altamir Dia Federal Univerity of Santa Catarina, Mechanical Engineering Department, P.O. Box 476,

More information

INVERSE DYNAMIC SIMULATION OF A HYDRAULIC DRIVE WITH MODELICA. α Cylinder chamber areas ratio... σ Viscous friction coefficient

INVERSE DYNAMIC SIMULATION OF A HYDRAULIC DRIVE WITH MODELICA. α Cylinder chamber areas ratio... σ Viscous friction coefficient Proceeding of the ASME 2013 International Mechanical Engineering Congre & Expoition IMECE2013 November 15-21, 2013, San Diego, California, USA IMECE2013-63310 INVERSE DYNAMIC SIMULATION OF A HYDRAULIC

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier a a The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each b c circuit will be decribed in Verilog

More information

Modelling the impact of cyber attacks on the traffic control centre of an urban automobile transport system by means of enhanced cybersecurity

Modelling the impact of cyber attacks on the traffic control centre of an urban automobile transport system by means of enhanced cybersecurity Modelling the impact of cyber attack on the traffic control centre of an urban automobile tranport ytem by mean of enhanced cyberecurity Yoana Ivanova 1,* 1 Bulgarian Academy of Science, Intitute of ICT,

More information

Chapter S:II (continued)

Chapter S:II (continued) Chapter S:II (continued) II. Baic Search Algorithm Sytematic Search Graph Theory Baic State Space Search Depth-Firt Search Backtracking Breadth-Firt Search Uniform-Cot Search AND-OR Graph Baic Depth-Firt

More information

Analytical Redundancy and Fuzzy Inference in AUV Fault Detection and Compensation

Analytical Redundancy and Fuzzy Inference in AUV Fault Detection and Compensation Analytical Redundancy and Fuzzy Inference in AUV Fault Detection and Compenation A. J. Healey Profeor and Director Center for AUV Reearch Naval Potgraduate School Monterey, CA 93953 healey@me.np.navy.mil

More information

Web Science and additionality

Web Science and additionality Admin tuff... Lecture 1: EITN01 Web Intelligence and Information Retrieval Meage, lide, handout, lab manual and link: http://www.eit.lth.e/coure/eitn01 Contact: Ander Ardö, Ander.Ardo@eit.lth.e, room:

More information

Performance Evaluation of search engines via user efforts measures

Performance Evaluation of search engines via user efforts measures IJCSI International Journal of Computer Science Iue, Vol. 9, Iue 4, No, July 01 www.ijcsi.org 437 Performance Evaluation of earch engine via uer effort meaure Raeh Kumar Goutam 1 and Sanay K. Dwivedi 1

More information

else end while End References

else end while End References 621-630. [RM89] [SK76] Roenfeld, A. and Melter, R. A., Digital geometry, The Mathematical Intelligencer, vol. 11, No. 3, 1989, pp. 69-72. Sklanky, J. and Kibler, D. F., A theory of nonuniformly digitized

More information

IMPROVED JPEG DECOMPRESSION OF DOCUMENT IMAGES BASED ON IMAGE SEGMENTATION. Tak-Shing Wong, Charles A. Bouman, and Ilya Pollak

IMPROVED JPEG DECOMPRESSION OF DOCUMENT IMAGES BASED ON IMAGE SEGMENTATION. Tak-Shing Wong, Charles A. Bouman, and Ilya Pollak IMPROVED DECOMPRESSION OF DOCUMENT IMAGES BASED ON IMAGE SEGMENTATION Tak-Shing Wong, Charle A. Bouman, and Ilya Pollak School of Electrical and Computer Engineering Purdue Univerity ABSTRACT We propoe

More information

ANALYSIS OF THE FIRST LAYER IN WEIGHTLESS NEURAL NETWORKS FOR 3_DIMENSIONAL PATTERN RECOGNITION

ANALYSIS OF THE FIRST LAYER IN WEIGHTLESS NEURAL NETWORKS FOR 3_DIMENSIONAL PATTERN RECOGNITION ANALYSIS OF THE FIRST LAYER IN WEIGHTLESS NEURAL NETWORKS FOR 3_DIMENSIONAL PATTERN RECOGNITION A. Váque-Nava * Ecuela de Ingeniería. CENTRO UNIVERSITARIO MEXICO. DIVISION DE ESTUDIOS SUPERIORES J. Figueroa

More information

A NEW APPROACH IN MEASURING OF THE ROUGHNESS FOR SURFACE CONSTITUTED WITH MACHINING PROCESS BY MATERIAL REMOVAL

A NEW APPROACH IN MEASURING OF THE ROUGHNESS FOR SURFACE CONSTITUTED WITH MACHINING PROCESS BY MATERIAL REMOVAL International Journal of Mechanical and Production Engineering Reearch and Development (IJMPERD) ISSN 49-689 Vol. 3, Iue, Mar 3, 4-5 TJPRC Pvt. Ltd. A NEW APPROACH IN MEASURING OF THE ROUGHNESS FOR SURFACE

More information

A TOPSIS based Method for Gene Selection for Cancer Classification

A TOPSIS based Method for Gene Selection for Cancer Classification Volume 67 No17, April 2013 A TOPSIS baed Method for Gene Selection for Cancer Claification IMAbd-El Fattah,WIKhedr, KMSallam, 1 Department of Statitic, 3 Department of Deciion upport, 2 Department of information

More information

Anisotropic filtering on normal field and curvature tensor field using optimal estimation theory

Anisotropic filtering on normal field and curvature tensor field using optimal estimation theory Aniotropic filtering on normal field and curvature tenor field uing optimal etimation theory Min Liu Yuhen Liu and Karthik Ramani Purdue Univerity, Wet Lafayette, Indiana, USA Email: {liu66 liu28 ramani}@purdue.edu

More information

( ) subject to m. e (2) L are 2L+1. = s SEG SEG Las Vegas 2012 Annual Meeting Page 1

( ) subject to m. e (2) L are 2L+1. = s SEG SEG Las Vegas 2012 Annual Meeting Page 1 A new imultaneou ource eparation algorithm uing frequency-divere filtering Ying Ji*, Ed Kragh, and Phil Chritie, Schlumberger Cambridge Reearch Summary We decribe a new imultaneou ource eparation algorithm

More information

ECE-320 Lab 2: Root Locus For Controller Design

ECE-320 Lab 2: Root Locus For Controller Design ECE-320 Lab 2: Root Locu For Controller Deign In thi Lab you will exlore the ue of the root locu technique in deigning controller. The root locu indicate the oible location of the cloed loo ole of a ytem

More information

Laboratory Exercise 2

Laboratory Exercise 2 Laoratory Exercie Numer and Diplay Thi i an exercie in deigning cominational circuit that can perform inary-to-decimal numer converion and inary-coded-decimal (BCD) addition. Part I We wih to diplay on

More information

Course Project: Adders, Subtractors, and Multipliers a

Course Project: Adders, Subtractors, and Multipliers a In the name Allah Department of Computer Engineering 215 Spring emeter Computer Architecture Coure Intructor: Dr. Mahdi Abbai Coure Project: Adder, Subtractor, and Multiplier a a The purpoe of thi p roject

More information

TAM 212 Worksheet 3. Solutions

TAM 212 Worksheet 3. Solutions Name: Group member: TAM 212 Workheet 3 Solution The workheet i concerned with the deign of the loop-the-loop for a roller coater ytem. Old loop deign: The firt generation of loop wa circular, a hown below.

More information

Lecture Outline. Global flow analysis. Global Optimization. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization

Lecture Outline. Global flow analysis. Global Optimization. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization Lecture Outline Global flow analyi Global Optimization Global contant propagation Livene analyi Adapted from Lecture by Prof. Alex Aiken and George Necula (UCB) CS781(Praad) L27OP 1 CS781(Praad) L27OP

More information

S&C Scada-Mate Switching Systems. Specifications for S&C Current Sensors

S&C Scada-Mate Switching Systems. Specifications for S&C Current Sensors Thi data heet provide pecification for S&C Current Senor particularly when the Scada-Mate Switch i ued in application where the RTU i upplied by other. S&C Scada-Mate Switche include integral enor for

More information

Keywords: Defect detection, linear phased array transducer, parameter optimization, phased array ultrasonic B-mode imaging testing.

Keywords: Defect detection, linear phased array transducer, parameter optimization, phased array ultrasonic B-mode imaging testing. Send Order for Reprint to reprint@benthamcience.ae 488 The Open Automation and Control Sytem Journal, 2014, 6, 488-492 Open Acce Parameter Optimization of Linear Phaed Array Tranducer for Defect Detection

More information