Understanding Digital

Richard G. Lyons

WIM EHl PRENTICE HALL PTR

A Prentice Hall PTR Publication Upper Saddle River, NJ 07458 WWW.phptr.com CONTENTS

Preface xi

1 DISCRETE SEQUENCES AND SYSTEMS 1

1.1 Discrete Sequences and Their Notation 2 1.2 Signal Amplitude, Magnitude, Power 8 1.3 Signal Processing Operational Symbols 10 1.4 Introduction to Discrete Linear Time-Invariant Systems 12 1.5 Discrete Linear Systems 13 1.6 Time-Invariant Systems 18 1.7 The Commutative Property of Linear Time-Invariant Systems . . 20 1.8 Analyzing Linear Time-Invariant Systems 20

2 PERIODIC SAMPLING 23

2.1 : Signal Ambiquity in the Frequency Domain 23 2.2 Sampling Low-Pass Signals 29 2.3 Sampling Bandpass Signals 32 2.4 Spectral Inversion in Bandpass Sampling 43

3 THE DISCRETE FOURIER TRANSFORM 49

3.1 Understanding the DFT Equation 50 3.2 DFT Symmetry 63 3.3 DFT Linearity 65 3.4 DFT Magnitudes 66 3.5 DFT Frequency Axis 67 3.6 DFT Shifting Theorem 68 3.7 Inverse DFT 70 3.8 DFT Leakage 71 3.9 Windows 80 3.10 DFT Scalloping Loss 88 3.11 DFT Resolution, Zero Stuffing, and Frequency-Domain Sampling 89 3.12 DFT Processing Gain 93 3.13 The DFT of Rectangular Functions 97 3.14 The DFT Frequency Response to a Complex Input 119 3.15 The DFT Frequency Response to a Real Cosine Input 123 3.16 The DFT Single-Bin Frequency Response to a Real Cosine Input 125

VII VÜi Understanding Digital Signal Processing

4 THE FAST FOURIER TRANSFORM 129 4.1 Relationship of the FFT to the DFT 130 4.2 Hints on Using FFTs in Practice 131 4.3 FFT Software Programs 136 4.4 Derivation of the Radix-2 FFT Algorithm 136 4.5 FFT Input/Output Data Index Bit Reversal 145 4.6 Radix-2 FFT Butterfly Structures 146

5 FINITE IMPULSE RESPONSE FILTERS 157 5.1 An Introduction to Finite Impulse Response FIR Filters 158 5.2 Convolution in FIR Filters 163 5.3 Low-Pass FIR Filter Design 174 5.4 Bandpass FIR Filter Design 191 5.5 Highpass FIR Filter Design 193 5.6 Remez Exchange FIR Filter Design Method 194 5.7 Half-Band FIR Filters 197 5.8 Phase Response of FIR Filters 199 5.9 A Generic Description of Discrete Convolution 204

6 INFINITE IMPULSE RESPONSE FILTERS 219

6.1 An Introduction to Infinite Impulse Response Filters 220 6.2 The 223 6.3 The z-Transform 238 6.4 Impulse Invariance HR Filter Design Method 254 6.5 HR Filter Design Method 272 6.6 Optimized HR Filter Design Method 284 6.7 Pitfalls in Building HR Digital Filters 286 6.8 Cascade and Parallel Combinations of Digital Filters 290 6.9 A Brief Comparison of HR and FIR Filters 292

7 ADVANCED SAMPUNG TECHNIQUES 297

7.1 Quadrature Sampling 297 7.2 Quadrature Sampling with Digital Mixing 301 7.3 Digital Resampling 303

8 319

8.1 Coherent Averaging 320 8.2 Incoherent Averaging 327 8.3 Averaging Multiple Fast Fourier Transforms 330 8.4 Filtering Aspects of Time-Domain Averaging 340 8.5 Exponential Averaging 341 Contents ix

9 DIGITAL DATA FORMATS AND THEIR EFFECTS 349

9.1 Fixed-Point Binary Formats 349 9.2 Binary Number Precision and Dynamic Range 356 9.3 Effects of Finite Fixed-Point Binary Word Length 357 9.4 Floating-Point Binary Formats 375 9.5 Block Floating-Point Binary Format 381

10 DIGITAL SIGNAL PROCESSING TRICKS 385

10.1 Frequency Translation without Multiplication 385 10.2 High-Speed Vector-Magnitude Approximation 400 10.3 Data Windowing Tricks 406 10.4 Fast Multiplication of Complex Numbers 411 10.5 Efficiently Performing the FFT of Real Sequences 412 10.6 Calculating the Inverse FFT Using the Forward FFT 425 10.7 Fast FFT Averaging 429 10.8 Simplified FIR Filter Structure 430 10.9 Accurate A/D Converter Testing Technique 432 10.10 Fast FIR Filtering Using the FFT 435 10.11 Calculation of Sines and Cosines of Consecutive Angles 436 10.12 Generating Normally Distributed Random Data 438

APPENDIX A. THE ARITHMETIC OF COMPLEX NUMBERS 443

A.l Graphical Representation of Real and Complex Numbers 443 A.2 Arithmetic Representation of Complex Numbers 444 A.3 Arithmetic Operations of Complex Numbers 446 A.4 Some Practical Implications of Using Complex Numbers 453

APPENDIX B. CLOSED FORM OF A GEOMETRIC SERIES 455

APPENDIX C. COMPLEX SIGNALS AND NEGATIVE FREQUENCY. .458

C.l Development of Imaginary Numbers 460 C.2 Representing Real Signals Using Complex Phasors 462 C.3 Representing Real Signals Using Negative Frequencies 467 C.4 Complex Signals and Quadrature Mixing 471

APPENDIX D. MEAN, VARIANCE, AND STANDARD DEVIATION 476

D.l Statistical Measures 476 D.2 Standard Deviation, or RMS, of a Continuous Sinewave 480 D.3 The Mean and Variance of Random Functions 481 D.4 The Normal Probability Density Function 484 X Understanding Digital Signal Processing

APPENDIX E. DECIBELS (dB AND dBm) 486

E.l Using Logarithms to Determine Relative Signal Power 486 E.2 Some Useful Decibel Numbers 492 E.3 Absolute Power Using Decibels 493

APPENDIX F. DIGITAL FILTER TERMINOLOGY 494

Index 507