Digital Signal Processing A Primer With MATLAB® Digital Signal Processing A Primer With MATLAB® Samir I. Abood MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of MATLAB® software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLAB® software. CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2020 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Printed on acid-free paper International Standard Book Number-13: 978-0-367-44493-8 (Hardback) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to pub- lish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copy- right.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com Dedicated to My great parents, who never stop giving of themselves in countless ways, My beloved brothers and sisters; My dearest wife, who offered me unconditional love with the light of hope and support; My beloved kids: Daniah, and Mustafa, whom I can't force myself to stop loving; To all my family, the symbol of love and giving. Contents Preface............................................................................................................................................ xiii Acknowledgments............................................................................................................................xv Author ............................................................................................................................................xvii Chapter 1 Continuous and Discrete Signals .................................................................................1 1.1 Continuous Signals............................................................................................1 1.1.1 Generation of Continuous Signals in MATLAB .................................1 1.1.2 Operations on Signals and Sequences..................................................2 1.2 Discrete-Time Signals .......................................................................................5 1.2.1 Complex Sequences..............................................................................5 1.3 Signals and Systems ..........................................................................................6 1.4 Classification of Signals and Systems...............................................................6 1.4.1 Continuous-Time and Discrete-Time Signals ......................................6 1.4.2 Analog and Digital Signals ..................................................................6 1.4.3 Deterministic and Random Signals......................................................6 1.4.4 Periodic and Nonperiodic Signals........................................................7 1.4.5 Power and Energy Signals....................................................................7 1.4.5.1 What Is Digital Signal Processing?......................................7 1.4.5.2 Why DSP?.............................................................................7 1.4.5.3 Applications (DSP)...............................................................7 1.5 Introduction to MATLAB in DSP.....................................................................8 1.5.1 MATLAB Windows.............................................................................8 1.5.2 Basic Commands in MATLAB............................................................9 1.6 Some Fundamental Sequences........................................................................11 1.6.1 Impulse Response in MATLAB ........................................................ 11 1.6.2 Signal Duration .................................................................................. 12 1.7 Generation of Discrete Signals in MATLAB.................................................. 12 Problems.....................................................................................................................17 Chapter 2 Signals Properties....................................................................................................... 19 2.1 Periodic and Aperiodic Sequences..................................................................19 2.2 Even and Odd Parts of a Signal (Symmetric Sequences).................................20 2.3 Signal Manipulations.......................................................................................23 2.3.1 Transformations of the Independent Variable....................................23 2.3.1.1 Shifting...............................................................................23 2.3.1.2 Reversal ..............................................................................23 2.3.1.3 Time-Scaling ......................................................................23 2.3.1.4 Addition, Multiplication, and Scaling ................................24 2.3.1.5 Addition..............................................................................24 2.3.1.6 Multiplication......................................................................24 2.3.1.7 Scaling................................................................................24 2.3.1.8 Signal Decomposition.........................................................24 2.4 Discrete-Time Systems....................................................................................25 2.4.1 System Properties...............................................................................25 2.4.1.1 Memoryless System............................................................25 2.4.1.2 Additivity............................................................................26 vii viii Contents 2.4.1.3 Homogeneity.......................................................................26 2.4.1.4 Stability...............................................................................26 2.5 Linear Time-Invariant Causal Systems (LTI).................................................27 2.5.1 Linearity.............................................................................................27 2.5.2 Time-Invariance ................................................................................. 31 2.5.3 Causality............................................................................................. 32 2.6 Definitions .......................................................................................................36 2.6.1 Continuous-Time System ...................................................................36 2.6.2 Discrete-Time System ........................................................................37 2.6.2.1 Delay Operator....................................................................38 2.6.2.2 Convolution Property..........................................................38 2.6.2.3 Impulse Function................................................................38 2.6.2.4 Impulse Response...............................................................38 2.6.2.5 Frequency Response...........................................................38 2.7 System Output .................................................................................................39 2.7.1 Causality.............................................................................................39 2.7.2 Stability..............................................................................................39 2.7.3 Invertibility.........................................................................................40 2.7.4 Memory..............................................................................................40 Problems.....................................................................................................................42 Chapter 3 Convolution ................................................................................................................ 47 3.1 Linear Convolution..........................................................................................47 3.2 Convolution Properties .................................................................................... 47 3.2.1 Commutative Property ....................................................................... 47 3.2.2 Associative Property ..........................................................................48 3.2.3 Distributive Property..........................................................................48 3.3 Types of Convolutions.....................................................................................48 3.3.1 Equations Method ..............................................................................49 3.3.1.1 Convolution of Two Sequences in MATLAB..................... 53 3.3.2 Graphical Method ..............................................................................54 3.3.3 Tabular Method .................................................................................. 55 Problems.....................................................................................................................60 Chapter 4 Difference Equations..................................................................................................65 4.1 Difference Equations and Impulse Responses................................................65 4.2 System Representation Using Its Impulse Response.......................................66 4.3 The Methods That One May Use to Solve the Difference Equations ............. 67 4.4 The Classical Approach...................................................................................68 Problems.....................................................................................................................72 Chapter 5 Discrete-Time Fourier Series (DTFS)........................................................................ 75 5.1 DTFS Coefficients of Periodic Discrete Signals ............................................. 75 5.2 Parseval’s Relation...........................................................................................77 5.3 Discreet Fourier Series....................................................................................79 Problems.....................................................................................................................83 Contents ix Chapter 6 Discrete-Time Fourier Transform (DTFT) ................................................................85 6.1 Frequency Response........................................................................................85 6.2 DTFT for Any Discrete Signal........................................................................87 6.3 Inverse DTFT..................................................................................................88 6.4 Interconnection of Systems .............................................................................89 6.5 DTFT Properties ............................................................................................. 91 6.6 Applications of DTFT ..................................................................................... 91 6.7 LSI Systems and Difference Equations...........................................................91 6.8 Solving Difference Equations Using DTFT....................................................93 6.9 Frequency Response in MATLAB................................................................ 102 Problems...................................................................................................................106 Chapter 7 Discrete Fourier Transform (DFT) .......................................................................... 109 7.1 Method of Decimation-in-Frequency............................................................109 7.2 Method of Decimation-in-Time..................................................................... 112 7.3 Properties of Discrete Fourier Transform ..................................................... 117 7.4 Discrete Fourier Transform of a Sequence in MATLAB ............................. 122 7.5 Linear Convolution Using the DFT...............................................................123 7.6 Generation of Inverse Discrete Fourier Transform in MATLAB.................124 Problems...................................................................................................................125 Chapter 8 Fast Fourier Transform (FFT).................................................................................. 129 8.1 Fast Fourier Transform Definition................................................................. 129 8.1.1 Decimation-in-Time FFT .................................................................1 29 8.1.2 Decimation-in-Frequency FFT ........................................................1 29 8.2 Finding the FFT of Different Signals in MATLAB...................................... 134 8.3 Power Spectral Density Using Square Magnitude and Autocorrelation ....... 135 8.3.1 Equivalence of FFT and N-phase Sequence Component Transformation.................................................................................136 Problems...................................................................................................................140 Chapter 9 Z-Transform.............................................................................................................. 143 9.1 Z-Transform Representation.......................................................................... 143 9.2 Region of Convergence (ROC)...................................................................... 144 9.3 Properties of the z-transform ......................................................................... 147 9.4 Inverse z-transform........................................................................................151 9.4.1 Partial Fraction Expansion and a Look-up Table.............................151 9.4.2 Power Series.....................................................................................154 9.4.3 Contour Integration..........................................................................154 Problems...................................................................................................................163 Chapter 10 Z-Transform Applications in DSP............................................................................165 10.1 Evaluation of LTI System Response Using Z-Transform..............................165 10.2 Digital System Implementation from Its Function........................................165 10.3 Pole-Zero Diagrams for a Function in the z-Domain....................................172 10.4 Frequency Response Using z-Transform ....................................................... 172 Problems................................................................................................................... 174