Systems and Signal Processing with MATLAB®: Two Volume Set, 3rd Edition [1,2, 3 ed.] 9780367533595, 9781003088585

Most books on linear systems for undergraduates cover discrete and continuous systems material together in a single volu

259 33 90MB

English Pages 724 Year 2021

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Systems and Signal Processing with MATLAB®: Two Volume Set, 3rd Edition [1,2, 3 ed.]
 9780367533595, 9781003088585

Table of contents :
Cover
Volume 01
Cover
Half Page
Title Page
Copyright Page
Dedication
Table of Contents
Preface
About the Author
Acknowledgment
Chapter 1 Signal Representation
1.1 Examples of Continuous Signals
1.2 The Continuous Signal
1.3 Periodic and Nonperiodic Signals
1.4 General Form of Sinusoidal Signals
1.5 Energy and Power Signals
1.6 The Shifting Operation
1.7 The Reflection Operation
1.8 Even and Odd Functions
1.9 Time Scaling
1.10 The Unit Step Signal
1.11 The Signum Signal
1.12 The Ramp Signal
1.13 The Sampling Signal
1.14 The Impulse Signal
1.15 Some Insights: Signals in the Real World
1.15.1 The Step Signal
1.15.2 The Impulse Signal
1.15.3 The Sinusoidal Signal
1.15.4 The Ramp Signal
1.15.5 Other Signals
1.16 End-of-Chapter Examples
1.17 End-of-Chapter Problems
Chapter 2 Continuous Systems
2.1 Definition of a System
2.2 Input and Output
2.3 Linear Continuous System
2.4 Time-Invariant System
2.5 Systems Without Memory
2.6 Causal Systems
2.7 The Inverse of a System
2.8 Stable Systems
2.9 Convolution
2.10 Simple Block Diagrams
2.11 Graphical Convolution
2.12 Differential Equations and Physical Systems
2.13 Homogeneous Differential Equations and Their Solutions
2.13.1 Case When the Roots Are All Distinct
2.13.2 Case When Two Roots Are Real and Equal
2.13.3 Case When Two Roots Are Complex
2.14 Nonhomogeneous Differential Equations and Their Solutions
2.14.1 How Do We Find the Particular Solution?
2.15 The Stability of Linear Continuous Systems: The Characteristic Equation
2.16 Block Diagram Representation of Linear Systems
2.16.1 Integrator
2.16.2 Adder
2.16.3 Subtractor
2.16.4 Multiplier
2.17 From Block Diagrams to Differential Equations
2.18 From Differential Equations to Block Diagrams
2.19 The Impulse Response
2.20 Some Insights: Calculating y(t)
2.20.1 How Can We Find These Eigenvalues?
2.20.2 Stability and Eigenvalues
2.21 End-of-Chapter Examples
2.22 End-of-Chapter Problems
Chapter 3 Fourier Series
3.1 Review of Complex Numbers
3.1.1 Definition
3.1.2 Addition
3.1.3 Subtraction
3.1.4 Multiplication
3.1.5 Division
3.1.6 From Rectangular to Polar
3.1.7 From Polar to Rectangular
3.2 Orthogonal Functions
3.3 Periodic Signals
3.4 Conditions for Writing a Signal as a Fourier Series Sum
3.5 Basis Functions
3.6 The Magnitude and the Phase Spectra
3.7 Fourier Series and the Sin-Cos Notation
3.8 Fourier Series Approximation and the Resulting Error
3.9 The Theorem of Parseval
3.10 Systems with Periodic Inputs
3.11 A Formula for Finding y(t) When x(t) Is Periodic: The Steady-State Response
3.12 Some Insight: Why the Fourier Series
3.12.1 No Exact Sinusoidal Representation for x(t)
3.12.2 The Frequency Components
3.13 End-of-Chapter Examples
3.14 End-of-Chapter Problems
Chapter 4 The Fourier Transform and Linear Systems
4.1 Definition
4.2 Introduction
4.3 The Fourier Transform Pairs
4.4 Energy of Nonperiodic Signals
4.5 The Energy Spectral Density of a Linear System
4.6 Some Insights: Notes and a Useful Formula
4.7 End-of-Chapter Examples
4.8 End-of-Chapter Problems
Chapter 5 The Laplace Transform and Linear Systems
5.1 Definition
5.2 The Bilateral Laplace Transform
5.3 The Unilateral Laplace Transform
5.4 The Inverse Laplace Transform
5.5 Block Diagrams Using the Laplace Transform
5.5.1 Parallel Systems
5.5.2 Series Systems
5.6 Representation of Transfer Functions as Block Diagrams
5.7 Procedure for Drawing the Block Diagram from the Transfer Function
5.8 Solving LTI Systems Using the Laplace Transform
5.9 Solving Differential Equations Using the Laplace Transform
5.10 The Final Value Theorem
5.11 The Initial Value Theorem
5.12 Some Insights: Poles and Zeros
5.12.1 The Poles of the System
5.12.2 The Zeros of the System
5.12.3 The Stability of the System
5.13 End-of-Chapter Examples
5.14 End-of-Chapter Problems
Chapter 6 State-Space and Linear Systems
6.1 Introduction
6.2 A Review of Matrix Algebra
6.2.1 Definition, General Terms, and Notations
6.2.2 The Identity Matrix
6.2.3 Adding Two Matrices
6.2.4 Subtracting Two Matrices
6.2.5 Multiplying a Matrix by a Constant
6.2.6 Determinant of a 2 × 2 Matrix
6.2.7 Transpose of a Matrix
6.2.8 Inverse of a Matrix
6.2.9 Matrix Multiplication
6.2.10 Diagonal Form of a Matrix
6.2.11 Exponent of a Matrix
6.2.12 A Special Matrix
6.2.13 Observation
6.2.14 Eigenvalues of a Matrix
6.2.15 Eigenvectors of a Matrix
6.3 General Representation of Systems in State Space
6.4 General Solution of State-Space Equations Using the Laplace Transform
6.5 General Solution of the State-Space Equations in Real Time
6.6 Ways of Evaluating eAt
6.6.1 First Method: A Is a Diagonal Matrix
6.6.2 Second Method: A Is of the Form
6.6.3 Third Method: Numerical Evaluation, A of Any Form
6.6.4 Fourth Method: The Cayley–Hamilton Approach
6.6.5 Fifth Method: The Inverse Laplace Method
6.6.6 Sixth Method: Using the General Form of Φ(t) = eAt and Its Properties
6.7 Some Insights: Poles and Stability
6.8 End-of-Chapter Examples
6.9 End-of-Chapter Problems
Index
Volume 02
Cover
Half Title
Title Page
Copyright Page
Dedication
Table of Contents
Preface
About the Author
Acknowledgment
Chapter 1 Signal Representation
1.1 Introduction
1.2 Why Do We Discretize Continuous Systems?
1.3 Periodic and Nonperiodic Discrete Signals
1.4 Unit Step Discrete Signal
1.5 Impulse Discrete Signal
1.6 Ramp Discrete Signal
1.7 Real Exponential Discrete Signal
1.8 Sinusoidal Discrete Signal
1.9 Exponentially Modulated Sinusoidal Signal
1.10 Complex Periodic Discrete Signal
1.11 Shifting Operation
1.12 Representing a Discrete Signal Using Impulses
1.13 Reflection Operation
1.14 Time Scaling
1.15 Amplitude Scaling
1.16 Even and Odd Discrete Signal
1.17 Does a Discrete Signal Have a Time Constant?
1.18 Basic Operations on Discrete Signals
1.18.1 Modulation
1.18.2 Addition and Subtraction
1.18.3 Scalar Multiplication
1.18.4 Combined Operations
1.19 Energy and Power Discrete Signals
1.20 Bounded and Unbounded Discrete Signals
1.21 Some Insights: Signals in the Real World
1.21.1 Step Signal
1.21.2 Impulse Signal
1.21.3 Sinusoidal Signal
1.21.4 Ramp Signal
1.21.5 Other Signals
1.22 End-of-Chapter Examples
1.23 End-of-Chapter Problems
Chapter 2 Discrete System
2.1 Definition of a System
2.2 Input and Output
2.3 Linear Discrete Systems
2.4 Time Invariance and Discrete Signals
2.5 Systems with Memory
2.6 Causal Systems
2.7 Inverse of a System
2.8 Stable System
2.9 Convolution
2.10 Difference Equations of Physical Systems
2.11 Homogeneous Difference Equation and Its Solution
2.11.1 Case When Roots Are All Distinct
2.11.2 Case When Two Roots Are Real and Equal
2.11.3 Case When Two Roots Are Complex
2.12 Nonhomogeneous Difference Equations and Their Solutions
2.12.1 How Do We find the Particular Solution?
2.13 Stability of Linear Discrete Systems: The Characteristic Equation
2.13.1 Stability Depending on the Values of the Poles
2.13.2 Stability from the Jury Test
2.14 Block Diagram Representation of Linear Discrete Systems
2.14.1 Delay Element
2.14.2 Summing/Subtracting Junction
2.14.3 Multiplier
2.15 From the Block Diagram to the Difference Equation
2.16 From the Difference Equation to the Block Diagram: A Formal Procedure
2.17 Impulse Response
2.18 Correlation
2.18.1 Cross-Correlation
2.18.2 Auto-Correlation
2.19 Some Insights
2.19.1 How Can We Find These Eigenvalues?
2.19.2 Stability and Eigenvalues
2.20 End-of-Chapter Examples
2.21 End-of-Chapter Problems
Chapter 3 Fourier Series and the Fourier Transform of Discrete Signals
3.1 Introduction
3.2 Review of Complex Numbers
3.2.1 Definition
3.2.2 Addition
3.2.3 Subtraction
3.2.4 Multiplication
3.2.5 Division
3.2.6 From Rectangular to Polar
3.2.7 From Polar to Rectangular
3.3 Fourier Series of Discrete Periodic Signals
3.4 Discrete System with Periodic Inputs: The Steady-State Response
3.4.1 General Form for yss (n)
3.5 Frequency Response of Discrete Systems
3.5.1 Properties of the Frequency Response
3.5.1.1 Periodicity Property
3.5.1.2 Symmetry Property
3.6 Fourier Transform of Discrete Signals
3.7 Convergence Conditions
3.8 Properties of the Fourier Transform of Discrete Signals
3.8.1 Periodicity Property
3.8.2 Linearity Property
3.8.3 Discrete-Time-Shifting Property
3.8.4 Frequency-Shifting Property
3.8.5 Reflection Property
3.8.6 Convolution Property
3.9 Parsevals Relation and Energy Calculations
3.10 Numerical Evaluation of the Fourier Transform of Discrete Signals
3.11 Some Insights: Why Is This Fourier Transform?
3.11.1 Ease in Analysis and Design
3.11.2 Sinusoidal Analysis
3.12 End-of-Chapter Examples
3.13 End-of-Chapter Problems
Chapter 4 z-Transform and Discrete Systems
4.1 Introduction
4.2 Bilateral z-Transform
4.3 Unilateral z-Transform
4.4 Convergence Considerations
4.5 Inverse z-Transform
4.5.1 Partial Fraction Expansion
4.5.2 Long Division
4.6 Properties of the z-Transform
4.6.1 Linearity Property
4.6.2 Shifting Property
4.6.3 Multiplication by e−an
4.6.4 Convolution
4.7 Representation of Transfer Functions as Block Diagrams
4.8 x(n), h(n), y(n), and the z-Transform
4.9 Solving Difference Equation Using the z-Transform
4.10 Convergence Revisited
4.11 Final-Value Theorem
4.12 Initial-Value Theorem
4.13 Some Insights: Poles and Zeroes
4.13.1 Poles of the System
4.13.2 Zeros of the System
4.13.3 Stability of the System
4.14 End-of-Chapter Examples
4.15 End-of-Chapter Problems
Chapter 5 Discrete Fourier Transform and Discrete Systems
5.1 Introduction
5.2 Discrete Fourier Transform and the Finite-Duration Discrete Signals
5.3 Properties of the DFT
5.3.1 How Does the Defining Equation Work?
5.3.2 DFT Symmetry
5.3.3 DFT Linearity
5.3.4 Magnitude of the DFT
5.3.5 What Does k in x(k), the DFT, Mean?
5.4 Relation the DFT Has with the Fourier Transform of Discrete Signals, the z-Transform, and the Continuous Fourier Transform
5.4.1 DFT and the Fourier Transform of x(n)
5.4.2 DFT and the z-Transform of x(n)
5.4.3 DFT and the Continuous Fourier Transform of x(t)
5.5 Numerical Computation of the DFT
5.6 Fast Fourier Transform: A Faster Way of Computing the DFT
5.7 Applications of the DFT
5.7.1 Circular Convolution
5.7.2 Linear Convolution
5.7.3 Approximation to the Continuous Fourier Transform
5.7.4 Approximation to the Coefficients of the Fourier Series and the Average Power of the Periodic Signal x(t)
5.7.5 Total Energy in the Signal x(n) and x(t)
5.7.6 Block Filtering
5.7.7 Correlation
5.8 Some Insights
5.8.1 DFT is the Same as the fft
5.8.2 DFT Points Are the Samples of the Fourier Transform of x(n)
5.8.3 How Can We Be Certain that Most of the Frequency Contents of x(t) Are in the DFT?
5.8.4 Is the Circular Convolution the Same as the Linear Convolution?
5.8.5. Is |X(w)| ≊ |X(k)|?
5.8.6 Frequency Leakage and the DFT
5.9 End-of-Chapter Examples
5.10 End-of-Chapter Problems
Chapter 6 State-Space and Discrete Systems
6.1 Introduction
6.2 Review on Matrix Algebra
6.2.1 Definition, General Terms, and Notations
6.2.2 Identity Matrix
6.2.3 Adding Two Matrices
6.2.4 Subtracting Two Matrices
6.2.5 Multiplying a Matrix by a Constant
6.2.6 Determinant of a Two-by-Two Matrix
6.2.7 Inverse of a Matrix
6.2.8 Matrix Multiplication
6.2.9 Eigenvalues of a Matrix
6.2.10 Diagonal Form of a Matrix
6.2.11 Eigenvectors of a Matrix
6.3 General Representation of Systems in State Space
6.3.1 Recursive Systems
6.3.2 Nonrecursive Systems
6.3.3 From the Block Diagram to State Space
6.3.4 From the Transfer Function H(z) to State Space
6.4 Solution of the State-Space Equations in the z-Domain
6.5 General Solution of the State Equation in Real Time
6.6 Properties of An and Its Evaluation
6.7 Transformations for State-Space Representations
6.8 Some Insights: Poles and Stability
6.9 End-of-Chapter Examples
6.10. End-of-Chapter Problems
Index

Citation preview

Continuous Signals and Systems with MATLAB®

Electrical Engineering Textbook Series Continuous Signals and Systems with MATLAB®, Third Edition Volumes in the series: Volume I – Continuous Signals and Systems with MATLAB® Taan S. ElAli Volume II – Discrete Signals and Systems with MATLAB® Taan S. ElAli

Continuous Signals and Systems with MATLAB® Third Edition

Authored by

Taan S. ElAli Embry-Riddle Aeronautical University

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. First edition published 2001 by CRC Press 6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 and by CRC Press 2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN © 2021 Taan S. ElAli CRC Press is an imprint of Taylor & Francis Group, LLC Reasonable efforts have been made to publish 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, microflming, 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, access www.copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact [email protected] Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identifcation and explanation without intent to infringe. ISBN: 978-0-367-53359-5 (hbk) ISBN: 978-1-003-08858-5 (ebk) Visit the Routledge/Resources: www.routledge.com/9780367533595

Dedication This book is dedicated frst to the glory of the Almighty God. It is dedicated next to my beloved parents, my father, Saeed, and my mother, Shandokha—may God have mercy on their souls. It is dedicated then to my wife, Salam; my beloved children, Mohammad, Nusayba, Ali, and Zayd; my brothers, Mohammad and Khaled; and my sisters, Sabha, Khulda, Miriam, and Fatma. I ask the Almighty God to have mercy on us and to bring peace, harmony, and justice to all. – Taan ElAli

Contents Preface.......................................................................................................................xi About the Author ................................................................................................... xiii Acknowledgment ..................................................................................................... xv Chapter 1

Signal Representation...........................................................................1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15

Examples of Continuous Signals...............................................1 The Continuous Signal ..............................................................1 Periodic and Nonperiodic Signals .............................................2 General Form of Sinusoidal Signals..........................................4 Energy and Power Signals .........................................................5 The Shifting Operation..............................................................7 The Refection Operation .......................................................... 8 Even and Odd Functions.......................................................... 10 Time Scaling............................................................................ 12 The Unit Step Signal................................................................ 14 The Signum Signal .................................................................. 16 The Ramp Signal ..................................................................... 16 The Sampling Signal ............................................................... 17 The Impulse Signal.................................................................. 18 Some Insights: Signals in the Real World ...............................20 1.15.1 The Step Signal ..........................................................20 1.15.2 The Impulse Signal ....................................................20 1.15.3 The Sinusoidal Signal................................................. 21 1.15.4 The Ramp Signal........................................................ 22 1.15.5 Other Signals .............................................................. 22 1.16 End-of-Chapter Examples ....................................................... 22 1.17 End-of-Chapter Problems........................................................ 38

Chapter 2

Continuous Systems ........................................................................... 47 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11

Defnition of a System ............................................................. 47 Input and Output...................................................................... 47 Linear Continuous System ...................................................... 47 Time-Invariant System ............................................................ 50 Systems Without Memory ....................................................... 52 Causal Systems........................................................................ 52 The Inverse of a System .......................................................... 54 Stable Systems ......................................................................... 55 Convolution.............................................................................. 56 Simple Block Diagrams........................................................... 58 Graphical Convolution............................................................. 61 vii

viii

Contents

2.12 Differential Equations and Physical Systems..........................66 2.13 Homogeneous Differential Equations and Their Solutions ..................................................................................66 2.13.1 Case When the Roots Are All Distinct ...................... 67 2.13.2 Case When Two Roots Are Real and Equal .............. 67 2.13.3 Case When Two Roots Are Complex......................... 67 2.14 Nonhomogeneous Differential Equations and Their Solutions .................................................................................. 68 2.14.1 How Do We Find the Particular Solution? ................. 69 2.15 The Stability of Linear Continuous Systems: The Characteristic Equation ........................................................... 73 2.16 Block Diagram Representation of Linear Systems ................. 76 2.16.1 Integrator .................................................................... 76 2.16.2 Adder .......................................................................... 77 2.16.3 Subtractor ................................................................... 77 2.16.4 Multiplier.................................................................... 77 2.17 From Block Diagrams to Differential Equations ................... 78 2.18 From Differential Equations to Block Diagrams ................... 79 2.19 The Impulse Response............................................................. 81 2.20 Some Insights: Calculating y(t)................................................ 83 2.20.1 How Can We Find These Eigenvalues?......................84 2.20.2 Stability and Eigenvalues ...........................................84 2.21 End-of-Chapter Examples ....................................................... 85 2.22 End-of-Chapter Problems...................................................... 109 Chapter 3

Fourier Series ................................................................................... 119 3.1

Review of Complex Numbers................................................ 119 3.1.1 Defnition.................................................................. 119 3.1.2 Addition.................................................................... 119 3.1.3 Subtraction ............................................................... 119 3.1.4 Multiplication ........................................................... 119 3.1.5 Division .................................................................... 120 3.1.6 From Rectangular to Polar ....................................... 121 3.1.7 From Polar to Rectangular ....................................... 121 3.2 Orthogonal Functions ............................................................ 122 3.3 Periodic Signals ..................................................................... 124 3.4 Conditions for Writing a Signal as a Fourier Series Sum...... 124 3.5 Basis Functions...................................................................... 124 3.6 The Magnitude and the Phase Spectra .................................. 126 3.7 Fourier Series and the Sin-Cos Notation............................... 126 3.8 Fourier Series Approximation and the Resulting Error ........ 130 3.9 The Theorem of Parseval ...................................................... 131 3.10 Systems with Periodic Inputs ................................................ 132 3.11 A Formula for Finding y(t) When x(t) Is Periodic: The Steady-State Response........................................................... 134

ix

Contents

3.12 Some Insight: Why the Fourier Series .................................. 136 3.12.1 No Exact Sinusoidal Representation for x(t) ............ 136 3.12.2 The Frequency Components..................................... 136 3.13 End-of-Chapter Examples ..................................................... 137 3.14 End-of-Chapter Problems...................................................... 148 Chapter 4

The Fourier Transform and Linear Systems .................................... 153 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8

Chapter 5

The Laplace Transform and Linear Systems ................................... 191 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12

5.13 5.14 Chapter 6

Defnition............................................................................... 153 Introduction ........................................................................... 153 The Fourier Transform Pairs ................................................. 154 Energy of Nonperiodic Signals ............................................. 167 The Energy Spectral Density of a Linear System ................. 168 Some Insights: Notes and a Useful Formula ......................... 168 End-of-Chapter Examples ..................................................... 170 End-of-Chapter Problems...................................................... 183

Defnition............................................................................... 191 The Bilateral Laplace Transform........................................... 191 The Unilateral Laplace Transform ........................................ 191 The Inverse Laplace Transform............................................. 193 Block Diagrams Using the Laplace Transform ..................... 198 5.5.1 Parallel Systems ....................................................... 198 5.5.2 Series Systems.......................................................... 199 Representation of Transfer Functions as Block Diagrams ....................................................................... 200 Procedure for Drawing the Block Diagram from the Transfer Function................................................................... 201 Solving LTI Systems Using the Laplace Transform.............. 203 Solving Differential Equations Using the Laplace Transform ..............................................................................205 The Final Value Theorem......................................................208 The Initial Value Theorem ....................................................208 Some Insights: Poles and Zeros.............................................208 5.12.1 The Poles of the System ...........................................209 5.12.2 The Zeros of the System...........................................209 5.12.3 The Stability of the System ......................................209 End-of-Chapter Examples .....................................................209 End-of-Chapter Problems...................................................... 233

State-Space and Linear Systems ...................................................... 245 6.1 6.2

Introduction ........................................................................... 245 A Review of Matrix Algebra .................................................246 6.2.1 Defnition, General Terms, and Notations ...............246

x

Contents

6.3 6.4 6.5 6.6

6.7 6.8 6.9

6.2.2 The Identity Matrix ..................................................246 6.2.3 Adding Two Matrices...............................................246 6.2.4 Subtracting Two Matrices ........................................ 247 6.2.5 Multiplying a Matrix by a Constant ......................... 247 6.2.6 Determinant of a 2 × 2 Matrix ................................. 247 6.2.7 Transpose of a Matrix ..............................................248 6.2.8 Inverse of a Matrix ...................................................248 6.2.9 Matrix Multiplication ...............................................248 6.2.10 Diagonal Form of a Matrix ...................................... 249 6.2.11 Exponent of a Matrix ............................................... 249 6.2.12 A Special Matrix ...................................................... 250 6.2.13 Observation .............................................................. 251 6.2.14 Eigenvalues of a Matrix ........................................... 251 6.2.15 Eigenvectors of a Matrix .......................................... 252 General Representation of Systems in State Space ............... 271 General Solution of State-Space Equations Using the Laplace Transform ................................................ 272 General Solution of the State-Space Equations in Real Time .............................................................................. 272 Ways of Evaluating e At .......................................................... 273 6.6.1 First Method: A Is a Diagonal Matrix ...................... 273 ˜ a b ˝ 6.6.2 Second Method: A Is of the Form ˛ 0 a ˆ ........ 273 ° ˙ 6.6.3 Third Method: Numerical Evaluation, A of Any Form ................................................................. 273 6.6.4 Fourth Method: The Cayley–Hamilton Approach ........................................................... 274 6.6.5 Fifth Method: The Inverse Laplace Method ............ 276 6.6.6 Sixth Method: Using the General Form of Φ(t) = e At and Its Properties........................ 277 Some Insights: Poles and Stability ........................................ 282 End-of-Chapter Examples ..................................................... 283 End-of-Chapter Problems...................................................... 326

Index...................................................................................................................... 337

Preface All books on linear systems for undergraduates cover discrete and continuous systems material together in a single volume. Such books also include topics in discrete and continuous flter design, and discrete and continuous state-space representations. However, with this magnitude of coverage, the student typically gets a little of both discrete and continuous linear systems but not enough of either. Minimal coverage of discrete linear systems material is acceptable provided that there is ample coverage of continuous linear systems. On the other hand, minimal coverage of continuous linear systems does no justice to either of the two areas. Under the best of circumstances, a student needs a solid background in both these subjects. It is no wonder that these two areas are now being taught separately in so many institutions. Continuous linear systems is a broad topic in itself and merits a single book devoted to that material. The objective of this book is to present the required material that an undergraduate student needs to master this subject matter and the use of MATLAB® (The MathWorks Inc.) in solving problems in this area. This book offers broad, detailed, focused comprehensive coverage of continuous linear systems, based on basic mathematical principles. It presents many solved problems from various engineering disciplines using analytical tools as well as MATLAB. This book is intended primarily for undergraduate junior and senior electrical, mechanical, aeronautical, and aerospace engineering students. Practicing engineers will also fnd this book useful. This book is ideal for use in a one-semester course in continuous linear systems where the instructor can easily cover all of the chapters. Each chapter presents numerous examples that illustrate each concept. Most of the worked-out examples are frst solved analytically and then solved using MATLAB in a clear and understandable fashion. This book concentrates on explaining the subject matter with easy-to-follow mathematical development and numerous solved examples. The book covers traditional topics and includes an extensive coverage of state-space representation and analysis. The reader does not need to be fuent in MATLAB because the examples are presented in a self-explanatory way. Three chapters (7, 8, and 9) on block diagrams, the design of analog flters, and nonlinear systems, in addition to MATLAB m-fles for the frst 6 chapters, are provided online by the publisher at www.routledge.com/9780367533595. To the Instructor: In one semester, all chapters can be covered in the order they are presented. For additional topics the instructor decides to cover, three chapters on block diagrams, the design of analog flters, and nonlinear systems are provided by the publisher at www.routledge.com/9780367533595. MATLAB m-fles for the frst six chapters will be provided at this link too. To the Student: Familiarity with calculus, differential equations, and basic dynamics is desirable. If and where certain background material must be presented, that background material is presented right before the topic under consideration. This unique “just-in-time approach” helps the student stay focused on the topic. xi

xii

Preface

This  book presents three forms of numerical solutions using MATLAB. The frst form allows you to type any command at the MATLAB prompt and then press the Enter key to get the results. The second form is the MATLAB script, a set of MATLAB commands you type and save in a fle. You can run this fle by typing the fle name at the MATLAB prompt and then pressing the Enter key. The third form is the MATLAB function form, where you create the function and run it in the same way you create and run the script fle. The only difference is that the name of the MATLAB function should be the same as the fle name. Three chapters (7, 8, and 9) on block diagrams, the design of analog flters, and nonlinear systems, in addition to MATLAB m-fles for the frst 6 chapters, are provided online by the publisher at www.routledge.com/9780367533595. To the Practicing Engineer: The practicing engineer will fnd topics in this book useful. In real life systems are nonlinear, and this book describes, step by step, the process of linearizing nonlinear systems. MATLAB, an invaluable tool for the practicing engineer, is used in solving most of the problems. Three chapters (7, 8, and 9) on block diagrams, the design of analog flters, and nonlinear systems, in addition to MATLAB m-fles for the frst 6 chapters, are provided online by the publisher at www.routledge.com/9780367533595. MATLAB® is a registered trademark of The Math Works, Inc. For product information, please contact: The Math Works, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 Tel: 508-647-7000 Fax: 508-647-7001 E-mail: [email protected] Web: http://www.mathworks.com

About the Author Taan S. ElAli, PhD is a full professor of electrical engineering. He is currently the chair of the Engineering Program at ERAU. He has served as the chairman of the curriculum committee of the new College of Engineering at King Faisal University (KFU) from August 2008, when the committee was formed, to August 2009, when the fnal draft of the curriculum and its quality assurance plan for the college of engineering was approved by the University Council, the president of KFU, and the Ministry of Higher Education. From August 2009 to August 2010, Dr. ElAli was responsible for the implementation of the college of engineering curriculum quality assurance plan and the chairman of the electrical engineering department. Dr. ElAli has worked full-time at several academic institutions in the United States of America for more than 26 years in the areas of curriculum development, accreditation, teaching, research, etc. He received his BS degree in electrical engineering in 1987 from the Ohio State University, Columbus, Ohio, USA, his MS degree in systems engineering in 1989 from Wright State University, Dayton, Ohio, USA, and his M.S. in applied mathematical systems, and his PhD in electrical engineering, with a specialization in systems, controls, and signal processing from the University of Dayton in the years 1991 and 1993, respectively. Dr. ElAli has discovered a new approach to dynamic system identifcation and arrived at new mathematical formula in an automatically controlled dynamic system. Dr. ElAli is the author and coauthor of 13 books and textbooks in the area of electrical engineering and engineering education. He has contributed many papers and conference presentations in the area of dynamic systems and signal processing. In his efforts to revolutionize the engineering education, Dr. ElAli has contributed greatly to the Project-Based Curriculum (PBC) approach to engineering education. This approach has led to the restructuring of one of the major courses in the engineering curriculum and thus to the restructuring of the textbooks used for the course. From this restructuring, two textbooks have emerged: Continuous Signals and Systems with MATLAB® and Discrete Systems and Digital Signal Processing with MATLAB®. Universities like Rochester Institute of Technology, University of Texas at San Antonio, the University of Georgia, New Mexico State University, University of Massachusetts at Dartmouth, Texas A&M University at Kingsville, Western New England College, Lakehead University, University of New Haven, etc. have come on board to use these textbooks. He has taken the PBC approach to engineering education one step further and introduced student-focused learning through PBC. Dr. ElAli has contributed a chapter to the well-known The Engineering Handbook by CRC Press, another to the well-known The Electrical Engineering Handbook, by Taylor & Francis Group, and another two to Advances in Systems, and Computing Sciences and Software Engineering, by Springer, Germany, 2006 xiii

xiv

About the Author

and 2007, respectively. Dr. ElAli is a Fulbright Scholar, and a senior member of the Institute of Electrical and Electronics Engineers (IEEE), a rare honor attained by fewer than 8% of IEEEs more than 400,000 members and is conferred only on those who have outstanding research achievements and who have performed great service to the scientifc community.

Acknowledgment We would like to thank the CRC Press team. Special thanks also go to Nora Konopka, who greatly encouraged us when we discussed this project with her initially. She has reaffrmed our belief that this is a much-needed book. Those thanks extend to all the people from CRC Press who worked on and helped in this project. Finally, “nothing is perfect.” Please forward any comments or concerns about this book to the publisher.

xv

1 1.1

Signal Representation

EXAMPLES OF CONTINUOUS SIGNALS

We experience signals of various types almost on a continual basis in our daily lives. The blowing of the wind is an example of a continuous wave. We can plot the strength of the wind wave, the velocity of the wave, and the distance it travels as functions of time. When we speak, continuous signals are generated. These spoken word signals travel from one place to another so that other people can hear them. These are our familiar sound waves. When a radar system detects a certain object in the sky, an electromagnetic signal is sent. This signal leaves the radar system and travels the distance in the air until it hits the target object, which then refects back to the sending radar to be analyzed, where it is decided if the target is present or not. We understand that this electromagnetic signal, whether it is the one being sent or the one being received by the radar, is attenuated (its strength reduced) as it travels away from the radar station. Thus, the attenuation of this electromagnetic signal can be plotted as a function of time. If you vertically attach a certain mass to a spring from one end while the other end is fxed and then pull the mass, oscillations are created such that the spring’s length increases and decreases until the oscillations fnally stop. The oscillations produced are a signal that also dies out with increasing time. This signal, for example, can represent the length of the spring as a function of time. Signals also can appear as electric waves. Examples are voltages and currents on long transmission lines. Voltage value is reduced as the impressed voltage travels on transmission lines from one city to another. Therefore, we can represent these voltages as signals as well and plot them in terms of time. When we discharge or charge a capacitor, the rate of charging and discharging depends on the time factor (among other factors). Charging and discharging the capacitor can be represented thus as voltage across the capacitor terminal as a function of time. These are a few examples of continuous signals that exist in nature and that can be modeled mathematically as signals that are functions of various parameters.

1.2

THE CONTINUOUS SIGNAL

A signal v(t) is said to be continuous at time t = t1, if and when v ( t1+ ) = v ( t1− ) = v ( t1 ). Where t1+ ˜indicates time just after t = t1 and t1− indicates time just before t = t1. If, on the other hand, this is untrue, the signal v(t) is referred to as a discontinuous signal. Figure 1.1 shows an example of a continuous signal.

1

2

Continuous Signals and Systems with MATLAB®

FIGURE 1.1

An example of a continuous signal.

FIGURE 1.2

Signal for Example 1.1.

Example 1.1 Consider a signal of magnitude a as shown in Figure 1.2 and discuss its continuity. SOLUTION

( ) ( )

( )

( )

− As you can see in Figure 1.2, v t1+ ˛ v t1− since v t1+ = 0 and v t1 = a. Also, + − v t 2 ˛ v t 2 . Accordingly, in this example, the signal is piecewise continuous. It is continuous at all t except at t = tk, where k = 0, 1, 2, 3, …. It is customary to estimate a unique value for the signal at each of the discontinuities. For example, the value of v(t) at t = t1 is

( ) ( )

( ) ( )

v (t = t1) = 1/ 2 ˙ˆv t1+ + v t1− ˇ˘ = a/ 2.

1.3 PERIODIC AND NONPERIODIC SIGNALS A signal v(t) is periodic if v(t) = v(t + kT), where k is an integer that has the values ±1, ±2, ±3, ±4, …, and T is referred to as the fundamental period. In other words, if the signal v(t) repeats itself every T seconds or units of time it is called periodic with period T. If v1(t) is periodic with period T1 and if v2(t) is periodic with period T2, what can we say about the period of v(t) = v1(t) + v2(t)? Consider v(t) to be periodic having period T. Accordingly, we can say that v(t) = v(t + T) as per the defnition of periodicity just given to us.

3

Signal Representation

Since v1(t) and v2(t) are each periodic with period T1 and T2, respectively, then v1 ( t ) = v1 ( t + kT1 ) , and v2 ( t ) = v2 ( t + mT2 ) , where k and m are integers. Since v ( t ) = v1 ( t ) + v2 ( t ) , we have v ( t + T ) = v1 ( t + kT1 ) + v2 ( t + mT2 ). But v1 ( t + T ) + v2 ( t + T ) = v1 ( t + kT1 ) + v2 ( t + mT2 ). For this last equation to be true, we must have T = kT1 and T = mT2. This implies kT1 = mT2 , which says that T1 / T2 = m / k where m/k is a rational number. Therefore, the combination signal v ( t ) = v1 ( t ) + v2 ( t ) is a periodic signal if T1/T2 = m/k, where m/k is a rational number, and the period of v(t) is T = kT1 = mT2 .

4

Continuous Signals and Systems with MATLAB®

FIGURE 1.3

Sinusoidal signal.

1.4 GENERAL FORM OF SINUSOIDAL SIGNALS Consider the sinusoidal signal shown in Figure 1.3. The magnitude of the signal v(t) at π/2 and 5π/2 is the same. The time between these values is called the period T. Every T units of time the signal repeats with the same magnitude. The period of this signal is 2π units of time. A general form of a sinusoidal signal is v ( t ) = Asin ( ˝t + ˆ )

(1.1)

where A is the magnitude of the signal v(t). ω is the angular frequency (ω = 2πf). f is the frequency in hertz (f = 1/T). Φ is the phase angle in radians. Example 1.2 Let v1(t) = sin(t) and v2(t) = cos(t). Consider the sum of the two signals v(t) = v1(t) + v2(t). Is v(t) periodic? If so, what is the period of v(t)? SOLUTION v1(t) has an angular frequency of 1 rad/sec and v2(t) has an angular frequency of 1 rad/sec, too. For v1(t) and with w = 1 we can write 1 = 2° /T1 ˛ T1 = 2°. Also, for v2(t) and with w = 1 we can write 1 = 2° /T2 ˛ T2 = 2°. Checking the ratio T1 /T2 = 2° / 2° = 1

5

Signal Representation indicates that it is a rational number. Therefore, v(t) is a periodic signal and has a period T = kT1 = mT2 T1 /T2 = m /k = 1/1° m = 1˜and˜k = 1. Thus, T = kT1 = 2° or T = mT2 = 2°.

Example 1.3 Let v1(t) = sin(2πt) and v2(t) = sin(t). Consider the sum v(t) = v1(t) + v2(t). Is v(t) periodic? If so, what is the period of v(t)? SOLUTION For v1(t) we have T1 = 1, and for v2(t) we have T2 = 2°. The ratio T1 /T2 = 1/ 2° is not a rational number. Therefore, v(t) = v1(t) + v2(t) is not a periodic signal.

1.5

ENERGY AND POWER SIGNALS

The signal energy over a time interval 2L is given by L

E=

˜ v (t )

2

dt.

(1.2)

2

dt

(1.3)

−L

If the interval is infnite then ˆ

E=

˜ v (t )

−ˆ

6

Continuous Signals and Systems with MATLAB®

and in terms of limits, it is given as L

E = limit L˙ˆ

˜ v (t )

2

(1.4)

dt.

−L

In Equation (1.4), v(t) can be thought of as the voltage across a 1-Ohm resistor, and thus (v(t))2 is the instantaneous power. The average power is thus given by L

P = limit (1/2L ) L˙ˆ

˜ v (t )

2

dt.

(1.5)

−L

Let us consider the following two cases. 1. If in Equation (1.4) we fnd that 0 < E < ∞, then v(t) is referred to as the energy signal and the average power is zero. 2. If in Equation (1.5) we fnd that 0 < P < ∞, then v(t) is referred to as a power signal and it produces infnite energy. For periodic signals, if we set 2L in Equation (1.5) such that 2L = mT, where m is an integer then we have T

P = limit ( m/mT ) m˙ˆ

˜ v (t )

2

dt

0

which simplifes to T

P = (1 / T )

˜ v (t )

2

dt.

0

Example 1.4 Let v(t) = Ae −t for t ≥ 0. What kind of signal is given in Figure 1.4? SOLUTION Let us calculate the energy in the signal frst as ˛

E=

˜ Ae

−t 2

dt

0

˛

˜

E = A2e −2t dt. 0

(1.6)

7

Signal Representation

FIGURE 1.4

Signal for Example 1.4.

Carrying out the integration we get

(

)

E = A2 / − 2 e −2t

˙ 0

(

)

= A2 / 2 .

Since 0 < E = A 2/2 < ∞, v(t) is an energy signal.

1.6

THE SHIFTING OPERATION

Consider the signal v(t) in general. The representation v(t − t0) implies that v(t) is shifted to the right t0 units provided t0 > 0. On the other hand, when t0 < 0, v(t − t0) implies that v(t) is shifted to the left t0 units. Example 1.5 Consider the signal shown in Figure 1.5. Determine mathematically both v(t − 2) and v(t + 2). SOLUTION Mathematically the signal in Figure 1.5 can be expressed as ˆ˘ t v (t ) = ˇ ˘ 0

FIGURE 1.5

Signal for Example 1.5.

t˝0 t < 0.

8

Continuous Signals and Systems with MATLAB® To plot v(t − 2) we slide the graph of v(t) two units to the right. Likewise, to plot v(t + 2) we slide the graph of v(t) two units to the left. Mathematically ˇ t − 2 v (t − 2) = ˘  0

t − 2˙ 0 t − 2< 0

and fnally ˇ t − 2 v (t − 2) = ˘  0

t˙2 . t 1. On the other hand, v(nt) becomes an expanded signal of v(t) if and when |n| < 1. Example 1.9 Given v(t) shown in Figure 1.14a, fnd v(t/2) and v(2t). SOLUTION The solution is presented graphically in Figure 1.14b.

FIGURE 1.14a

Signal for Example 1.9.

13

Signal Representation

FIGURE 1.14b

Signal for Example 1.9.

Example 1.10 Consider the signal shown in Figure 1.15. Plot and analytically fnd v(2t − 1). SOLUTION Mathematically, we can represent the signal shown in Figure 1.15 using the equation ˆ t ˘ v (t ) = ˇ 1 ˘ 0 

0 ˝t ˝1 1˝ t ˝ 2 . t>2

The signal shifted by 1 and scaled by 2 is ˇ 2t − 1  v ( 2t − t ) = ˘ 1  0 

0 ˙ 2t − 1 ˙ 1 1 ˙ 2t − 1 ˙ 2 . 2t − 1 > 2

By fxing the time scale, we get ˇ 2t − 1  v ( 2t − t ) = ˘ 1   0

FIGURE 1.15

Signal for Example 1.10.

1 ˙ 2t ˙ 2 2 ˙ 2t ˙ 3 , 2t > 3

14

Continuous Signals and Systems with MATLAB®

FIGURE 1.16

Signal for Example 1.10.

or fnally ˇ 2t − 1  v ( 2t − 1) = ˘ 1  0 

1/ 2 ˙ t ˙ 1 1˙ t ˙ 3/ 2 . t > 3/ 2

The signal v(2t − 1) is thus obtained from v(t) by compressing its slant segment by 1/2 and shifting the constant segment by t = 1/2. The resulting graph of v(2t − 1) is shown plotted in Figure 1.16.

1.10

THE UNIT STEP SIGNAL

It is common to close and open an electrical switch to cause a sudden change in the signal of an electrical circuit. To effect changes in a fuid-based system you may actuate a valve. You may also release a spring, which was compressed in a mechanical system. In these and similar situations, the signal value changes quickly as compared to the response of the system. This is what we commonly refer to as the step signal. Mathematically, a step signal such as that shown in Figure 1.17 is represented as ˆ A ˘ A ˘ Au ( t ) = ˇ ˘ 2 ˘ 0

t>0 t=0 t 0.

FIGURE 1.17

The step signal.

15

Signal Representation

FIGURE 1.18

Signal for Example 1.11.

Example 1.11 Express the rectangular pulse signal shown in Figure 1.18 as a sum of unit step signals. SOLUTION Let us look at the plots of Au(t + a) and Au(t − a) shown in Figures 1.19 and 1.20. By subtracting the signal of Figure 1.20 from that of Figure 1.19, we can write Au (t + a) − Au (t − a) = A ˆˇu (t + a) − u (t − a) ˘ . The graph of the difference shown in Figure 1.21 is identical to the rectangular pulse given in Figure 1.18.

FIGURE 1.19

Signal for Example 1.11.

FIGURE 1.20

Signal for Example 1.11.

16

Continuous Signals and Systems with MATLAB®

FIGURE 1.21

1.11

Signal for Example 1.11.

THE SIGNUM SIGNAL

The signum signal is sketched in Figure 1.22. Mathematically, it can be expressed as ˇ 1  sgn ( t ) = ˘ 0  −1 

t>0 t = 0. t 0, u(t) = 1. In this case −1 + 2(1) = 1. When t = 0, u(t) = 1/2. Herein, −1 + 2(1/2) = 0. Finally, when t < 0, u(t) = 0. In this case −1 + 2(0) = −1. These cases do conform to the graph. Therefore, indeed, sgn(t) = −1 + 2u(t).

1.12

THE RAMP SIGNAL

Ramp signals are also commonplace in many physical systems. A ramp signal can exist in a tracking-type situation, for example, when a target is moving at a constant velocity. A tracking antenna may need a ramp signal in order to track a plane traveling at a constant speed. In this case, the ramp signal increases linearly as a function of time as shown in the plot in Figure 1.23. Mathematically, the ramp signal can be written as ˆ t r (t ) = ˇ ˘ 0

FIGURE 1.22

The signum signal.

t˝0 . t0 . t0 . t 3 , elsewhere

ˆ˘ −2 − t x ( −3 − t ) = ˇ ˘ 0

−3 < t < −2 . elsewhere

and fnally

This is a refection and also a shifting operation involving x(t). The sketch of x(−3 −t) is shown in Figure 1.33.

FIGURE 1.33

Signal for EOCE 1.1.

25

Signal Representation

FIGURE 1.34

Signal for EOCE 1.1.

3. Rewriting x(t) again we have ˇ t + 1 x (t ) = ˘  0

−1 < t < 0 . elsewhere

Scaling with a factor of 3 gives ˇ t /3 + 1 x (t /3) = ˘  0

−1< t /3 < 0 , elsewhere

ˇ t /3 + 1 x (t /3) = ˘  0

−3 < t < 0 . elsewhere

and fnally

The plot of x(t/3) is shown in Figure 1.34. 4. Any signal x(t) can be represented as the sum of even and odd signals as x (t ) = xeven (t ) + xodd (t ) , Where xeven (t ) = 1/ 2 ˆx ˇ (t ) + x ( −t ) ˘ ˇ t / 2 + 1/ 2 xeven (t ) = ˘  0

ˇ −t / 2 + 1/ 2 −1 < t < 0 + ˘ elsewhere  0

0 2.

The output y(t) = x(t) * h(t) thus takes the graphical form such as that shown in Figure 2.24.

FIGURE 2.23

Signal for Example 2.12.

66

Continuous Signals and Systems with MATLAB®

FIGURE 2.24 Signal for Example 2.12.

2.12 DIFFERENTIAL EQUATIONS AND PHYSICAL SYSTEMS In most physical systems, y(t) is a solution of a differential equation. Since we are dealing with LTI systems, our differential equations will be linear and have constant coeffcients. The general form is an

d n−1 d n−2 dn y ( t ) + an−1 y ( t ) + an−2 y ( t ) +  + a0 y ( t ) dt dt dt

= bm

dm d m−1 x ( t ) + bm−1 x ( t ) +  + b0 x ( t ) dt dt

(2.2)

where x(t) is the input and y(t) is the output of the system under consideration. In order to solve for the output y(t), we must have all initial conditions needed. We will need n initial conditions, where n is the order of the differential equation. These initial conditions are d n−1 d n−2 y ( 0 ) , …, y ( 0 ). y(0), dt dt

(2.3)

2.13 HOMOGENEOUS DIFFERENTIAL EQUATIONS AND THEIR SOLUTIONS If we set the right-hand side of Equation (2.2) to zero, we will have the homogeneous differential equation an

d n−1 d n−2 dn y(t ) + an−1 y(t ) + an−2 y(t ) + …+ a0 y(t ) = 0 dt dt dt

with the initial conditions d n−1 d n−2 y ( 0 ) ,…, y ( 0 ). y(0), dt dt

(2.4)

67

Continuous Systems

To solve the homogeneous differential equation, we form the characteristic algebraic equation an m n + an−1m n−1 + …+ a0 = 0.

(2.5)

The roots for this algebraic equation are called the poles or the eigenvalues of the system.

2.13.1

CASE WHEN THE ROOTS ARE ALL DISTINCT

If the roots are all distinct, the solution of the homogeneous equation is y ( t ) = c1e m1t + c2 e m2t + …+ cn e mn t

(2.6)

where m1, m2, …, mn are the n distinct roots of the characteristic equation describing the system. The constants are determined using the initial conditions, which are usually given along with the description of the system.

2.13.2

CASE WHEN TWO ROOTS ARE REAL AND EQUAL

If we have a second-order differential equation, where m1 and m2 are real and equal, we are then tempted to write the solution as y ( t ) = c1e m1t + c2 e m2t = c1e m1t + c2 e m1t = ( c1 + c2 ) e m1t = ce m1t .

(2.7)

Notice that this is a solution of a frst-order system with one energy storage element. In this case, the solution is corrected and written as y ( t ) = c1e m1t + c2 te m1t where the two terms are independent. If the differential equation is of third-order type, with m3 as another root, then the solution is y ( t ) = c1e m1t + c2 te m2t + c3e m3t .

2.13.3 CASE WHEN TWO ROOTS ARE COMPLEX If m1 and m2 are two complex roots of the characteristic equation, the two roots should appear in a complex conjugate pair. In this case, the roots are still distinct but complex. The solution is still of the form y ( t ) = c1e m1t + c2 e m2t .

68

Continuous Signals and Systems with MATLAB®

In general, we can write m1 and m2 as a + jb and a − jb. The solution becomes y ( t ) = c1e( a + jb )t + c2 e( a − jb )t . Using the fact that e ± jx = cos ± j sin x and ex+ y = exey , we can simplify the above equation as y ( t ) = c1e( a + jb )t + c2 e( a − jb )t y ( t ) = c1e at [ cos bt + j sin bt ] + c2 e at [ cos˜ bt − j sin bt ]. Simplifying we get y ( t ) = e at [( c1 + c2 ) cos bt + ( c1 + c2 ) j sin bt ]. If we let c1 + c2 = a1 and (c1 − c2)j = a2 then y ( t ) = e at [ a1 cos bt + a2 sin bt ]

(2.8)

where a1 and a2 can be found using the given initial conditions.

2.14

NONHOMOGENEOUS DIFFERENTIAL EQUATIONS AND THEIR SOLUTIONS

A differential equation is referred to as nonhomogeneous if it has an input (a forcing function) that appears to the right of the equal sign as in the following an

d n−1 d n−2 dn y ( t ) + an−1 y ( t ) + an−2 y ( t ) +  + a0 y ( t ) = x ( t ) . dt dt dt

(2.9)

A solution of this equation has the form y ( t ) = yh ( t ) + y p ( t )

(2.10)

where yh(t) is the homogenous part of the solution and yp(t) is the particular part. The homogenous part has the form yh ( t ) = c1e m1t + c2 e m2t + …+ cn e mn t .

69

Continuous Systems

In the homogenous solution we cannot use the initial conditions d n−1 d n−2 y ( 0 ) ,…, y ( 0 ) y(0), dt dt to fnd the constants. These initial conditions should be applied to y(t) not yh(t). After we fnd the combined solution y ( t ) = yh ( t ) + y p ( t ) we can use the initial condition to fnd the cs.

2.14.1 HOW DO WE FIND THE PARTICULAR SOLUTION? Table 2.1 will help us in fnding the form of the particular solution. The constants that correspond to the particular solution can be obtained by simply substituting yp(t) in the given nonhomogeneous equation and then equating coeffcients. The constants corresponding to the homogeneous equation are determined using the initial conditions that come with the given nonhomogeneous differential equation with its constants, after the two solutions, yh(t) and yp(t), have been determined. These two solutions are added together to form the overall solution y(t). Example 2.13 Consider the system described by the following differential equation d2 d y (t ) + y (t ) = 2t dt dt with the initial conditions y ( 0 ) = 0˜and˜

d y ( 0 ) = 0. dt

What is the solution y(t) (the output)?

TABLE 2.1 Particular Solution Forms Input constant A Aeat A cos (at) or A sin (at) Atn

Particular Solution constant B Beat B1cos (at) + B2sin (at) Bntn + Bn − 1tn − 1 + … + B0

70

Continuous Signals and Systems with MATLAB® SOLUTION y(t) will have two components: the homogeneous solution and the particular solution. We fnd the homogeneous solution by frst fnding the characteristic equation as m2 + m = m ( m + 1) = 0. The two roots are real and distinct: m = 0 and m = −1. The corresponding homogeneous solution is therefore y h (t ) = c1e −1t + c 2e 0t = c1e −t + c 2. Here, the input x(t) is 2t. If we look at Table 2.1, we fnd out that the form of the particular solution is y p (t ) = B2t + B1 If we substitute this particular solution in the given differential equation we will get 0 + B2 = 2t. By equating coeffcients of t(0t0 is compared with B2t0), B2 is 0 and there is no way of calculating B1. The terms in yp(t) + yh(t) must be independent. Here we have the following combination as the total solution y h (t ) + y p (t ) = c1e −t + c 2 + B2t + B1, where c2 and B1 are dependents. In this situation we multiply B1, the part of the particular solution that causes the dependency, by the minimum integer positive power of t to make the whole combination independent. This can be achieved by multiplying B1 by t 2. Therefore, we now rewrite the particular solution as y p (t ) = B2t + B1t 2. If we substitute in the differential equation given we will have 2B1 + B2 + 2B1t = 2t. By equating coeffcients, we have B1 = 1 and 2B1 + B2 = 0

71

Continuous Systems which gives B2 = −2 The particular solution is then y p (t ) = −2t + t 2. The overall solution is y (t ) = y h (t ) + y p (t ) = c1e −t + c 2 + −2t + t 2. Using the initial conditions, we can now fnd the constants as in the following. y ( 0 ) = 0 = c1 + c 2 d y (t ) = −c1e −t − 2 + 2t dt d y ( 0 ) = −c1 − 2 = 0 dt This indicates that c1 = −2 and c2 = 2. The fnal solution is y (t ) = y h (t ) + y p (t ) = −2e −t + 2 − 2t + t 2.

Example 2.14 Consider the system described by the following differential equation d3 y (t ) − y (t ) = sin t dt with initial conditions y ( 0 ) = 0,˜

d d2 y ( 0 ) = 0,˜and˜ y ( 0 ) = 0. dt dt

What is the output of the system? SOLUTION The auxiliary equation is m3 − 1 = 0 with the roots m1 = 1, m2 = −0.5 + 0.866j, and m3 = −0.5 − 0.866j.

72

Continuous Signals and Systems with MATLAB® The homogeneous solution is therefore y h (t ) = c1et + e −0.5t ˙a ˆ 1cos ( 0.866t ) + a2sin ( 0.866t ) ˇ. ˘ To fnd the particular part of the solution, we look at the input to the system. The input is sin(t), and therefore, the form of the particular solution using Table 2.1 is y p (t ) = B1cos˜t + B2sin˜t. Next we will fnd B1 and B2 by substituting the particular solution in the given differential equation to get B1sin˜t − B2cos˜t − B1cos˜t − B2sin˜t = sin˜t. By grouping like terms we arrive at

(B1 − B2 ) sin˜t − (B2 − B1) cos˜t = sin t , and by equating coeffcients we will have B1 − B2 = 1 and B2 − B1 = 0 where B1 = 1/2 and B2 = −1/2. The total solution now is y (t ) = c1et + e −0.5t ˙ˆ a1cos ( 0.866t ) + a2sin ( 0.866t ) ˇ˘ + 1/ 2cost − 1/ 2˜sin˜t. Using the initial conditions given, we will get three algebraic equations in three unknowns as c1 + a1 + 0a2 = −0.5 c1 − 0.5a1 + 0.886a2 = 0.5 c1 − 0.535a1 − 0.886 = 0.5 The solution to these equations is c1 = 0.159,˜a1 = −0.659,˜and˜a2 = 0.013. The fnal solution is

(t ) = 0.159et + e −0.5t ˆ−0.659˜cos (0.866t ) + 0.013sin (0.866t ) ˘ ˇ +1/ 2cos˜t − 1/ 2sin˜t.

73

Continuous Systems

2.15

THE STABILITY OF LINEAR CONTINUOUS SYSTEMS: THE CHARACTERISTIC EQUATION

If the coeffcients of the characteristic equation have the same sign, then the system is stable. If there are sign changes in the coeffcients of the characteristic equation, we can test stability by fnding the roots of the characteristic equation analytically, or we can use the MATLAB function “roots” to fnd the roots of the characteristic equation. We can also fnd the solution to the given differential equation with zero input and nonzero initial conditions, and if the output settles at a constant value, then we conclude that the system is stable. If the coeffcients in the characteristic equation are not constants, then we can use the Routh test to check for stability. The Routh test can be used for any characteristic equation whether the coeffcients are constants or not. In general, consider the following characteristic equation a5 m 5 + a4 m 4 + a3 m 3 + a2 m 2 + a1m + a0 = 0.

(2.11)

We form the Routh array as in the following: m5 m4 m3 m2 m1 m0

a5 a4 (a4a3 − a5a2)/a4 call this term x1 (x1a2 − a4x2)/x1 call this term x3 (x3x2 − x1a0)/x3 call this term x4 (x4a0 − x3 (0))/x4 = a0

a3 a2 (a4a1 − a5a0)/a4 call this term x2 (x1a0 − a4 (0))/x1 = a0 (x3(0) − x1(0))/x3 = 0 (x4(0) − x3(0))/x4 = 0

a1 a0 0 0 0 0

Now we look at the frst column of the Routh array and see that every term in this frst column must be positive for stability. So for stability, a5, a4, x1, x3, x4, and a0 must all be positive. Example 2.15 Consider the following systems. 1. 2. 3. 4. 5. 6.

d2 d y + y + y = x (t ) dt dt d2 d y + y − y = x (t ) dt dt d2 d y + y + ky = x (t ) dt dt d2 d y + k y + y = x (t ) dt dt d2 d y + y + (1+ k ) y = x (t ) dt dt d2 d y + k y + y = x (t ) dt dt

Are the above systems stable?

74

Continuous Signals and Systems with MATLAB® SOLUTION

SYSTEM 1 The characteristic equation is m2 + m + 1 = 0. We form the Routh array as 1 1

1 0

(1(1) − 1(0)) /1= 1 The terms in the frst column are all positive; therefore, the system is stable.

SYSTEM 2 The characteristic equation is m2 + m − 1 = 0. We form the Routh array as 1 1

−1 0

(1( −1) − 1(0)) /1= −1 One term in the frst column of the array is negative; therefore, the system is unstable.

SYSTEM 3 The characteristic equation is m2 + m + k = 0. The Routh array is 1 1

k 0

(1( k ) − 1(0)) /1= k All terms in the frst column of the array are positive if k is positive. This is to say that the system is stable for all values of k > 0.

75

Continuous Systems

SYSTEM 4 The characteristic equation is m2 + km + 1 = 0. We form the Routh array as 1 k

1 0

( k (1) − 1(0)) /k = 1 Here also k must be greater than zero for stability.

SYSTEM 5 The characteristic equation is m2 + m + (1+ k ) = 0. The Routh array is 1+ k 0

1 1

˙1 ˆ (1+ k ) − 1( 0 ) ˇ˘ /1= 1+ k For stability, (k + 1) should be positive; therefore, the system is stable if k > −1.

SYSTEM 6 The characteristic equation is m3 + km + 1 = 0. The Routh array is 1 0

k 1

Before we continue and calculate the other terms in the Routh array, and since we have a leading zero in the frst column, we substitute that zero with a very small positive number and we call it e. The Routh array becomes 1 e

k 1

˙˝ e ( k ) − 1ˇˆ /e = k − 1/e

76

Continuous Signals and Systems with MATLAB® For stability, k − 1/e should be positive. This is equivalent to saying that k > 1/e. Notice that e is a very small positive number. So what is the range for k that must make this system stable? In theory we say k > ∞. Use the Matlab script, Example 215. When we run this script the result is enter a value for roots_of_system_6 0.0005 + 31.6228i 0.0005 − 31.6228i − 0.0010 enter a value for roots_of_system_6 1.0e + 002* 0.0000 + 1.0000i 0.0000 − 1.0000i 0.0000 enter a value for roots_of_system_6 1.0e + 003* 0.0000 + 1.0000i 0.0000 − 1.0000i 0.0000 enter a value for roots_of_system_6 1.0e + 005* 0.0000 + 1.0000i 0.0000 − 1.0000i 0.0000 enter a value for roots_of_system_6 1.0e + 008* 0.0000 + 1.0000i 0.0000 − 1.0000i 0.0000 enter a value for

k, a negative number to exit: 1000 =

k, a negative number to exit: 10000 =

k, a negative number to exit: 1000000 =

k, a negative number to exit: 10000000000 =

k, a negative number to exit: 10000000000000000 =

k, a negative number to exit: −1

Notice that no matter how big k is, the real parts of the roots are either positive or zero, indicating instability.

2.16 BLOCK DIAGRAM REPRESENTATION OF LINEAR SYSTEMS Block diagrams are representations of physical systems using blocks. Individual blocks can be put together to represent the physical system in block diagram form. Individual blocks are considered next.

2.16.1 INTEGRATOR The integrator block diagram is shown in Figure 2.25.

FIGURE 2.25 An integrator block diagram.

77

Continuous Systems

FIGURE 2.26 An adder block diagram.

The output y(t) in this case is y (t ) =

˜ x (t ) dt.

2.16.2 ADDER The adder block diagram is shown in Figure 2.26. The output y(t) in this case is y ( t ) = x1 ( t ) + x 2 ( t ) .

2.16.3

SUBTRACTOR

The subtractor block diagram is shown in Figure 2.27. The output is y ( t ) = x1 ( t ) − x 2 ( t ) .

2.16.4

MULTIPLIER

The multiplier block diagram is shown in Figure 2.28. The output is y (t ) = k x (t ).

FIGURE 2.27 A subtractor block diagram.

FIGURE 2.28 A multiplier block diagram.

78

Continuous Signals and Systems with MATLAB®

2.17 FROM BLOCK DIAGRAMS TO DIFFERENTIAL EQUATIONS This process is best understood by using examples. Example 2.16 Consider the block diagram in Figure 2.29. The arrows indicate the direction of the signal fow. What is the system described by this block diagram? Or what is the differential equation that this system represents? SOLUTION d Since y(t) is the output of the integrator, the input to the integrator is y (t ) . dt The output of the summer is d y (t ) = x (t ) + ay (t ) dt Writing this frst-order differential equation in the standard form gives us the system differential equation d y (t ) − ay (t ) = x (t ) . dt

Example 2.17 Consider the block diagram shown in Figure 2.30. What is the system described by this block diagram?

FIGURE 2.29 System for Example 2.16.

FIGURE 2.30 System for Example 2.17.

79

Continuous Systems SOLUTION The input to the frst integrator is the second derivative of y(t). At the summer d2 y (t ) = bx (t ) + ay (t ) dt or d2 y (t ) − ay (t ) = bx (t ) , dt which is the differential equation described by the block diagram given in Figure 2.30.

2.18 FROM DIFFERENTIAL EQUATIONS TO BLOCK DIAGRAMS This method is also best understood by using examples. Example 2.18 Consider the following differential equation d y (t ) − ay (t ) = x (t ) . dt What is the block diagram that represents the system or the differential equation? SOLUTION d d2 , and so on. , D2 represent dt dt Therefore, if we substitute in the differential equation given we get

Let D represent

Dy (t ) − ay (t ) = x (t ) . Multiply by D −1, where 1 is the highest power in the above differential equation, the above equation becomes y (t ) − aD −1y (t ) = D −1x (t ) . We then solve for y(t) to get y (t ) = D −1 ˙x ˆ (t ) + ay (t ) ˇ˘ . The differential equation we started with has only a frst derivative, and in the block diagram we will need one integrator, one input x(t), and one output y(t). We will also have a summer at each input of any integrator used in the block diagram and use that as a rule for constructing block diagrams. We will take the following steps to draw the block diagram.

80

Continuous Signals and Systems with MATLAB®

FIGURE 2.31

System for Example 2.18.

STEP 1 This step is represented graphically, according to the rule just explained, shown in Figure 2.31. The “D” letter on the integrator block in the fgure is just to aid in understanding the procedure.

STEP 2 The block shown in Figure 2.32 is a direct implementation of the equation y (t ) = D −1 ˙ˆ x (t ) + ay (t ) ˘ˇ . Notice that the terms x(t) and ay(t) are inputs to the summer that comes before the integrator.

Example 2.19 Consider the following differential equation d2 y (t ) − ay (t ) = bx (t ) . dt What is the block diagram that represents this system? SOLUTION Using the same procedure as explained before, we can write the differential equation as D 2y (t ) − ay (t ) = bx (t ) . Multiply the above equation by D −2, where 2 is the highest power in the equation above, to get y (t ) − aD −2y (t ) = bD −2x (t ) .

FIGURE 2.32

System for Example 2.18.

81

Continuous Systems

FIGURE 2.33

System for Example 2.19.

FIGURE 2.34

System for Example 2.19.

We then solve for y(t) to get y (t ) = D −2 ˙ˆ ay (t ) + bx (t ) ˇ˘ . Since we were given a second-order differential equation, we will have two integrators in the block diagram. We will also have the input x(t) and the output y(t). Each integrator will have a summer at its input.

STEP 1 This step is accomplished by drawing the initial block shown in Figure 2.33.

STEP 2 The terms bx(t) and ay(t) are associated with D −2 and are inputs to the summer, which is the input of the frst integrator from the left. We do not see a D −1 term in the above equation and therefore the term associated with D −1 is zero. Zero means nothing is supplied as input to the second integrator other than the straight path from the frst integrator. The fnal block representation is shown in Figure 2.34.

2.19

THE IMPULSE RESPONSE

To fnd the response to an input x(t), the output of the system y(t) will have the following form +ˇ

y (t ) =

˜ x ( ˙) h (t − ˙) d˙,

−ˇ

where h(t) is the impulse response of the system when x(t) = δ(t). Therefore, we can say that if x(t) = δ(t), then y(t) = h(t), the impulse response. The following examples will show us how to fnd h(t).

82

Continuous Signals and Systems with MATLAB®

Example 2.20 Consider the frst-order differential equation d y (t ) + 4y (t ) = x (t ) dt Find the impulse response for this system. SOLUTION To fnd the impulse response for the given system, we set the input x(t) equal to δ(t) and fnd y(t), which is then h(t), the impulse response. Therefore, the given equation representing the system in this case can be written as d h (t ) + 4h (t ) = ˙ (t ) . dt

(

)

Again, the total solution for h(t), as we have seen before, will have two parts: the homogenous part and the particular part. For the homogenous solution we set x(t) to zero and this kills the δ(t) signal. Therefore, we have d h (t ) + 4h (t ) = 0. dt

(

)

The auxiliary (characteristic) equation is m + 4 = 0, which indicates that m = −4 and the homogenous solution is hh (t ) = c1e −4t ˜t > 0. To fnd c1 we need the total solution for h(t) frst. For the particular solution we predict that the solution has the form hp (t ) = 0 because this is always the case in most real systems, where the order of the derivative in the output y(t) is greater than the order of the derivative in the input x(t). Therefore, the total solution is h (t ) = hh (t ) + hp (t ) h (t ) = c1e −4t ˜t > 0, or we can write instead h (t ) = c1e −4tu (t ) ,

83

Continuous Systems where u(t) is the unit step signal that when multiplied by or other signal will force the other signal to start at t = 0 without any other alteration in the other signal. Finally we have to fnd c1. To do so we substitute the total solution for h(t) in the original differential equation noting that the derivative of u(t) is δ(t). The derivative of h(t) is d h (t ) = c1 ( −4 ) e −4tu (t ) + c1e −4t ˆ (t ) , dt where we used the product rule for derivatives. Therefore, substituting back in the differential equation gives ˆˇc1 ( −4 ) e −4tu (t ) + c1e −4t ˙ (t ) ˘ + 4 ˆˇc1e −4tu (t ) ˘ = ˙ (t ) . Remember that the δ(t) signal is only valid at t = 0, and in this case any function multiplied by δ(t) is evaluated at t = 0. Therefore ˆˇc1 ( −4 ) e −4tu (t ) + c1˙ (t ) ˘ + 4 ˆˇc1e −4tu (t ) ˘ = ˙ (t ) . The above equation reduces to c1˛ (t ) = ˛ (t ) . Equating coeffcients we fnd that c1 = 1, and the fnal solution is h (t ) = y (t ) = e −4t ˜t > 0.

2.20

SOME INSIGHTS: CALCULATING y(t)

If we study carefully the solution of the system in Example 2.20, we see that the output y(t) is y ( t ) = e −4t ˜t > 0. As time approaches infnity, the output will approach the value zero. In this sense, we say the output is stable for our particular input. For frst-order systems (that is described by frst-order differential equations), the output will have one exponential term at the most. This exponential term is called the transient of the system. For second-order systems, the output will have two transients (two exponential terms) at the most. For third-order systems we will have three exponential terms, and so on. In many systems of order greater than two, and for the purpose of analysis and design, we can reduce the order of the system at hand to a second-order system due to the fast decay of some transients. The solution for the output for these systems is in the following form y ( t ) = c1e˙1t ˜+c2 e˙ 2t .

84

Continuous Signals and Systems with MATLAB®

The stability of the system is determined by the values of α1 and α2. If any of the α’s are positive, the output y(t) will grow wild as t approaches infnity. So if the α’s are all negative then the output y(t) will decay gradually and stay at a fxed value as time progresses. The α’s are called the eigenvalues of the system. Therefore, we can say that an LTI system is stable if the eigenvalues of the system are all negative.

2.20.1

HOW CAN WE FIND THESE EIGENVALUES?

An LTI system can always be represented by a linear differential equation with constant coeffcients an

d n−1 d n−2 dn y ( t ) + aa−1 y ( t ) + an−2 y ( t ) + …+ a0 y ( t ) dt dt dt

= bm

dm d m−(1) x ( t ) + bm−1 x ( t ) + …+ b0 x ( t ) . dt dt

We can look at the auxiliary algebraic equation by setting the input x(t) to zero an and letting

d n−1 d n−2 dn y ( t ) + an−1 y (t ) + y ( t ) + …+ a0 y ( t ) = 0 dt dt dt

d = m to get dt an m n y ( t ) + an−1m n−1 y ( t ) + …+ a0 y ( t ) = 0.

We can factor out y(t) as n n−1 y ( t ) ˙a ˆ n m + an−1m + …+ a0 ˇ˘ = 0.

y(t) cannot be zero (in which case the output of the system would be zero at all times), and therefore, n n−1 ˛a ˝ n m + an−1m + …+ a0 ˙ˆ = 0

or a0 ˆ ˛ n an−1 n−1 ˙ m + a m + …+ a ˘ = 0. n n ˇ ˝ This is a nth-order algebraic equation with n roots. These are the eigenvalues of the system.

2.20.2 STABILITY AND EIGENVALUES To summarize, any LTI system can be modeled by a linear differential equation with constant coeffcients. The auxiliary algebraic equation that can be obtained from

85

Continuous Systems

the differential equation will have a number of roots called the eigenvalues of the system. The stability of the system is determined by these roots. These roots may be real or complex. If all the real parts of the roots are negative, then the system is stable. If any of the real parts of the roots is positive, then the system is unstable. The eigenvalues of the system are responsible for the shape of the output y(t). They dictate the shape of the transients of the system as well.

2.21 END-OF-CHAPTER EXAMPLES EOCE 2.1 Consider the following systems. 1. y (t ) =

1 x (t )

(

2. y (t ) = t˜sin x (t )

(

3. y (t ) = t˜ln x (t )

)

)

Are the above systems linear? SOLUTION For the frst system y1 (t ) =

1 x1 (t )

y 2 (t ) =

1 x 2 (t )

y (t ) =

1 ˝x1 (t ) + ˆx2 (t )

Is y(t) = αy1(t) + βy2(t)? ˛y1 (t ) =

˛ x1 (t )

˛y 2 (t ) =

˛ x 2 (t )

y (t ) =

1 ˝ ˆ ˇ + ˝x1 (t ) + ˆx2 (t ) x1 (t ) x2 (t )

Therefore, the system is not linear.

86

Continuous Signals and Systems with MATLAB® For the second system

(

)

(

)

y1 (t ) = t˜sin x1 (t )

y 2 (t ) = t ˜sin x2 (t )

(

y (t ) = t˜sin ˝x1 (t ) + ˆx2 (t )

)

Is y(t) = αy1(t) +βy2(t)?

(

)

(

)

˛y1 (t ) = ˛t˜sin x1 (t )

˛y 2 (t ) = ˛t˜sin x2 (t )

(

)

(

)

(

y (t ) = ˜t ˜sin ˝x1 (t ) + ˆx2 (t ) ˇ ˜˝t˜sin x1 (t ) + ˜ˆt ˜sin x2 (t ) Therefore, the system is not linear. For the third system

(

)

(

)

y1 (t ) = t ˜ln x1 (t )

y 2 (t ) = t˜ln x2 (t )

(

y (t ) = ˜t ˜ln ˝x1 (t ) + ˆx2 (t )

)

Is y(t) = αy1(t) + βy2(t)?

(

)

(

)

˛y1 (t ) = ˛t˜ln x1 (t )

˛y 2 (t ) = ˛t ˜ln x2 (t )

(

)

(

)

(

y (t ) = ˜t ˜ln ˝x1 (t ) + ˆx2 (t ) ˇ ˜˝t ˜ln x1 (t ) + ˜ˆt ˜ln x2 (t ) Therefore, the system is not linear.

EOCE 2.2 Consider EOCE 2.1 again. Are the systems time-invariant? SOLUTION For the frst system y1 (t ) = y1 (t − t0 ) =

1 x1 (t ) 1 x1 (t − t0 )

)

)

87

Continuous Systems y 2 (t ) = y1 (t − t0 ) =

1 x1 (t − t0 ) 1 1 = y 2 (t ) = x1 (t − t0 ) x1 (t − t0 )

Therefore, the system is time-invariant. For the second system

(

y1 (t ) = t ˜sin x1 (t )

) (

y1 (t − t0 ) = (t − t0 )˜sin x1 (t − t0 )

(

y 2 (t ) = t ˜sin x1 (t − t0 )

)

)

(

)

(

y1 (t − t0 ) = (t − t0 ) ˜sin x1 (t − t0 ) ˙ y 2 (t ) = t˜sin x1 (t − t0 )

)

Therefore, the system is not time-invariant. For the third system

(

y1 (t ) = t ˜ln x1 (t )

) (

y1 (t − t0 ) = (t − t0 ) ˜ln x1 (t − t0 )

(

y 2 (t ) = t ˜ln x1 (t − t0 )

)

)

(

)

(

y1 (t − t0 ) = (t − t0 ) ˜ln x1 (t − t0 ) ˙ y 2 (t ) = t˜ln x1 (t − t0 )

)

Therefore, the system is not time-invariant.

EOCE 2.3 Consider the systems represented in block diagrams shown in Figure 2.35. Find the output y(t) using convolution for both systems.

FIGURE 2.35

Systems for EOCE 2.3.

88

Continuous Signals and Systems with MATLAB® SOLUTION

SYSTEM 1 We can use the convolution integral to fnd the output y(t) as

y (t ) =



˜



˜ h (˙) x (t − ˙) d˙

x ( ˙ ) h (t − ˙ ) d˙ =

−ˇ

y (t ) =

−ˇ



˜e

u ( ˙ ) ˆ (t − ˙ ) d˙.

−˙

−˘

Using the sifting property +˘

˜ x (˝) ˙ (t − ˝) d˝ = x (t )

−˘

and noticing that the impulse is applied at τ = t, the output becomes y (t ) = e −tu (t ) .

SYSTEM 2 In this case, we also use the convolution integral and write

y (t ) =





˜ h (˙) x (t − ˙) d˙ = ˜ e

−ˇ

u ( ˙ ) u (t − ˙ ) d˙.

−˙

−ˇ

Notice that u(t − τ) is a unit step function that is refected and shifted by t units. Also h(τ) is stationary with u(t − τ) moving to the right. Overlapping will start at τ = 0 and stop at some τ = t. Remember also that u(t − τ) and u(τ) are multiplied under the integrand. Therefore, t

˜

y (t ) e −˝d˝ = − ˇ˘ e −˝ 

t 0

0

y (t ) = − ˆ˙ e −t − 1˘ˇ = ˙ˆ1− e −t ˘ˇ ˜t  0.

EOCE 2.4 Consider the block diagram shown in Figure 2.36. Find the output y(t).

89

Continuous Systems

FIGURE 2.36

System for EOCE 2.4. SOLUTION

This is the case of a parallel system and the output y(t) is calculated as y (t ) = z1 (t ) + z2 (t ) with z1 (t ) = x (t ) ˝ h1 (t ) and z2 (t ) = x (t ) ˝ h2 (t ) . Using the convolution integral we write for z1(t) z1 (t ) =



˜

h1 ( ˙ ) x (t − ˙ ) d˙ =

−ˇ t

˜



˜e

u ( ˙ ) u (t − ˙ ) d˙

−˙

−ˇ

t

z1 (t ) = e −˙d˙ = − ˘ˇ e −˙  , 0

0

and fnally z1 (t ) = ˆ˙1− e − ˇ˘ ˜t  0. For z2(t) we write z2 ( t ) =



˜

h2 ( ˙ ) x (t − ˙ ) d˙ =

−ˇ t

˜

˜e

−ˇ

t

z2 (t ) = e −˙d˙ = − ˇ˘ e −˙  , 0



0

u ( ˙ ) u (t − ˙ ) d˙

−˙

90

Continuous Signals and Systems with MATLAB® and z2 (t ) = ˙ˆ1− e − ˇ˘ ˜t  0. The output is then y (t ) = z1 (t ) + z2 (t ) y (t ) = ˙ˆ1− e −t ˇ˘ ˜ + ˙ˆ1− e −t ˘ˇ ˜= ˙ˆ 2 − 2e −t ˘ˇ ˜t  0. Using MATLAB script EOCE2_4, we can plot h1(t), h2(t), z2(t), and y(t) for the impulse input x(t) The plots are shown in Figure 2.37.

FIGURE 2.37

Plots for EOCE 2.4.

91

Continuous Systems

EOCE 2.5 Consider the block diagram shown in Figure 2.38. Use h1(t) and h2(t) as given in EOCE 2.4 with x(t) as a unit step input and fnd the output y(t). SOLUTION We start with the intermediate output z(t) and write

z (t ) =



˜

h1 ( ˙ ) x (t − ˙ ) d˙ =

−ˇ



˜e

u ( ˙ ) u (t − ˙ ) d˙

−˙

−ˇ

t

˜

z (t ) = e −˙d˙ = − ˘ˇ e −˙ 

t 0

0

and fnally z (t ) = ˙ˆ1− e −t ˇ˘ ˜t  0. But y(t) is the convolution between z(t) and h2(t) y (t ) = z (t ) * h2 (t ) y (t ) =





˜ h (˙) z (t − ˙) d˙ = ˜ (e ) u (˙) (1− e ( ) ) u (t − ˙) d˙, − t−˙

−˙

2

−ˇ

−ˇ

which simplifes to

y (t ) =

t

t

˜ (e ) (1− e ( ) ) dˆ = ˜ (e −ˆ

− t−ˆ

0

0

t

y (t ) = ˙ˆ1− e −t ˇ˘ − ˙ˆ e −t  ˇ˘ . 0

FIGURE 2.38 System for EOCE 2.5.

−ˆ

)

− e −t dˆ

92

Continuous Signals and Systems with MATLAB®

FIGURE 2.39 Plots for EOCE 2.5. Finally, y (t ) = ˙ˆ1− e −t ˇ˘ − ˙ˆ e −tt ˇ˘ = ˙ˆ1− e −t (1+ t ) ˇ˘ ˜t  0. For this impulse input, we can use the MATLAB script EOCE2_5 to plot z(t) and y(t). The plots are shown in Figure 2.39.

EOCE 2.6 Find the graphical convolution y (t ) = x1 (t ) * x2 (t ) where the signals x1(t) and x2(t) are shown in Figure 2.40.

FIGURE 2.40

Signals for EOCE 2.6.

93

Continuous Systems SOLUTION We start by mathematically writing the two signals x1(t) and x2(t) as ˙ˇ t x1 (t ) = x2 (t ) = ˆ ˇ˘ 0

0 0

12.

e−a|t|u(t) a > 0

13.

e −at u ( t ) a > 0

14.

˜ ˝ (t − nT )

1 2πδ(w) 2πδ(w − w0) π[δ(w − w0) + δ(w + w0)] π/j[δ(w − w0) − δ(w + w0)] jw w02 − w 2 w ˛ / 2 j ˇ˘˝ ( w − w0 ) + ˝ ( w˜ + ˜ w0 )  + 2 0 2 w0 − w ˛ / 2 ˇ˘˝ ( w − w0 ) + ˝ ( w˜ + ˜ w0 )  +

2a a2 + w2 ˜ e a

2

ˇ

n=−ˇ



˜

− w2 4a

2° 2n° ˘ ˙ ˛ˇ w −  T  T n=− ˆ

156

Continuous Signals and Systems with MATLAB®

Example 4.1 Find the Fourier transform of x(t) = δ(t). SOLUTION Using the defning integral, the Fourier transform equation that takes x(t) from its time domain and puts it in its frequency domain is X (w ) =

ˇ

˜

ˇ

˜

x (t ) e − jwt dt = ˙ (t ) e − jwt dt.

−ˇ

−ˇ

Using the sifting property of the impulse signal we can simplify to get X (w ) = e

− jw ( 0 )

= 1.

Therefore, we can write using the established notation x (t ) = ˝ (t ) ˙ X (w ) = 1.

Example 4.2 Find the Fourier transform of sgn(t). SOLUTION Let us take the derivative of sgn(t), the signal that was presented in Chapter 1, and write d sgn (t ) = 2˝ (t ) . dt Let us take the Fourier transform on both sides and use the Fourier transform derivative property as shown in Table 4.2 with x(t) = sgn(t) to get jwX (w ) ˛ 2 (1) . This last expression says that the Fourier transform of sgn(t) is 2/jw or sgn (t ) ˛ 2 / jw.

Example 4.3 Find the Fourier transform of x (t ) = e jw0t and then deduce the Fourier transform of the constant signal x(t) = k. SOLUTION Consider an impulse signal in the frequency domain as X (w ) = ˝ (w − w 0 ) .

157

The Fourier Transform and Linear Systems

TABLE 4.2 Properties of the Fourier Transform 1.

Time Signal x(t) N

2.

˜

Fourier Transform Signal X(w) N

˜ a X ( w)

an x n ( t )

n

n=1

3. 4.

x(−t) x(t − t0)

5.

x(αt)

X(−w) X ( w ) e − jwt0 1 X (w / ˛) ˛

7.

dn x (t ) dt x(t) * h(t)

8.

x(t)h(t)

9.

x ( t ) e jw0t

6.

(jw)n X(w) X(w)H(w) 1 X ( w)* H ( w) 2˛ X(w − w0)

ˆ

10.

˜ x ( ˝ ) d˝

X ( w) + ˝X ( 0 ) ˙ ( w ) jw

˜t˝ x˛ ˆ ° a˙

1 X ( w / a) a

−ˆ

11.

n

n=1

The inverse transform of X(w) is x (t ) =

1 2˙

˘

˜ ˆ (w − w ) e 0

jwt

dt.

−˘

By using the sifting property of the impulse function as explained in Chapter 1, we can write

x (t ) =

1 jw0t e . 2˝

But x(t) is the inverse transform of δ(w − w0), therefore e jw0t ˛ 2˝˙ (w − w 0 ) . Now let w0 = 0. The above transform becomes 1˛ 2˝˙ (w ) . Now we can use the linearity property from Table 4.2 and deduce k ˛ 2˝k˙ (w ) .

158

Continuous Signals and Systems with MATLAB®

Example 4.4 Consider the following signal x(t) of period T, where w = 2π/Τ. We can write x(t) using the Fourier series as x (t ) =

ˆ

˜c e n

jnw 0t

.

−ˆ

Let ℑ represent the Fourier transform operator. What is the ℑ(x(t))? SOLUTION The Fourier transform of x(t) is X (w ) =



˜ c ˙ ˆˇe n

jnw 0 t

−

˘,

which simplifes to X (w ) =



˜ c ˘ 2˙ˆ (w − nw ). n

0

−

X(w) can be viewed as a train of impulses on the w axis having values only at nw0, where n = 0, ±1, ±2, ±3, …. These impulses are separated from each other by w0. We can also fnd the magnitude of X(w) as X (w ) =



˜ c ˙ ˆˇe n

jnw 0 t

−

or X (w ) = 2˝ cn .

Example 4.5 Consider the following signal with period T. x (t ) =

ˇ

˜ ˙ (t − nT ) −ˇ

Find the Fourier transform of the given signal.

˘

159

The Fourier Transform and Linear Systems SOLUTION

Let us frst write the given signal as a sum of Fourier series. We can write the coeffcients frst as ˜

cn =

−j 1 x (t ) e T

˜

2ˆnt T

dt.

T

With x(t) as the given train of impulses, we can utilize the sifting property for integrals involving impulses to get ˜

cn =

−j 1 x (t ) e T

˜

2ˆnt T

dt =

T

1 . T

With x (t ) = ˝ ˇ−ˇ ˙ (t − nT ), the signal can be written as x (t ) =



˙

˜ T1 ˇˆe

j 2nt T

−

˘ , 

from which X (w ) =



˜ −

j 2nt 1 ˆ T  ˙ ˘e , T ˘ˇ 

or fnally X (w ) =



˜

2˙ 2n˙  ˘ ˆw − . T  T n=− 

In this last equation, we used entry number 4 in Table 4.1 for the Fourier transform pairs.

Example 4.6 Let x1(t) = δ(t) and x2 (t ) = e jw0t. Find the Fourier transform of (3x1(t) + 5x2(t)). SOLUTION We can use the second entry in Table 4.2 to transform the indicated sum. x1(t) can be transformed using Table 4.1 as x1 (1) ˛ 1.

160

Continuous Signals and Systems with MATLAB®

With the help of Table 4.1 we can also write x2 (t ) ˛ 2˝˙ (w − w 0 ) , and therefore, 3x1 (t ) ˜ + ˜5x2 (t ) ˝ 3 (1) + 5 ( 2) ˙ˆ (w − w 0 ) = 3 + 10˙ˆ (w − w 0 ) .

Example 4.7 Find the Fourier transform of x(t) = 1 + 2u(t). SOLUTION From entries 3 and 1 in Table 4.1 and entry 2 in Table 4.2 (the linearity property) we see that 1 ˛ 2˝˙ (w ) and 2u (t ) ˛ 2ˇ˘ ˝˙ (w ) + 1/ jw  . Therefore, x (t ) ˛ X (w ) = 4˙ˆ (w ) + 2 / jw.

Example 4.8 Find the Fourier transform of x(t − 2), where x(t) is as given in Example 4.7 above. SOLUTION Since in Example 4.7 we had x(t) = 1 + 2u(t), therefore, x (t − 2) = 1+ 2u (t − 2) . Using the time-shifting property, entry 4 in Table 4.2, we write x (t − 2) ˝ X (w ) e −2 jw . Therefore, x (t − 2) = 1+ 2u (t − 2) ˆ X (w ) e −2 jw = 4ˇ˘ (w ) + 2 / jw  e −2 jw . 

161

The Fourier Transform and Linear Systems

Example 4.9 Find the Fourier transform of

d x (t ), where x(t) is as given in Example 4.7. dt SOLUTION

FIRST METHOD From entry 6, Table 4.2, with n = 1, we have d x (t ) ˛ jwX (w ) = jw ˘4˙ˆ (w ) + 2 / jw .  dt Remember that with any function f(t), f(t)δ(t) = δ(t) f(t = 0). Therefore, d x (t ) ˛ jwX (w ) = jw ˘4˙ˆ (w ) + 2 / jw  = 2.  dt

SECOND METHOD Let us differentiate x(t) frst and write d d ˙1+ 2u (t ) ˇ˘ = 2 (t ) , x (t ) = dt dt ˆ where the derivative of u(t) is δ(t). Therefore, 2˛ (t ) ˝ 2(1) = 2.

Example 4.10 Find the Fourier transform of x(t/3), where x(t) is as in Example 4.7. SOLUTION Using entry 5, Table 4.2, we have x (t / 3) ˛ ˝˙1/ 1/ 3 ˆˇ X (w / 1/ 3) . By substituting for x(t/3) and X(w/(1/3)) we arrive at

(

)

(

)

˝˙1+ 2u (t / 3) ˆˇ ˘ ˙˝1/ 1/ 3 ˆˇ ˝˙ 4 w / (1/ 3) + 2 / j w / (1/ 3) ˆˇ = 3 ˇ˘ 4˝˙ ( 3w ) + 6 / jw  .

162

Continuous Signals and Systems with MATLAB®

Example 4.11 Find the Fourier transform of x(t)*x(t − 2), where * means convolution and x(t) is as given in Example 4.7. SOLUTION From entry 7, Table 4.2, we have x (t ) * x (t − 2) ˝ X (w ) X (w ) e −2 jw . If we substitute for x(t) and x(t − 2), we have −2 jw . ˙˝1+ 2u (t ) ˆˇ * ˙˝1+ 2u (t − 2) ˆˇ  ˝˙ 4 (w ) + 2 / jw ˆˇ ˝˙ 4 (w ) + 2 / jw ˇˆ e

Example 4.12 Let x(t) = e −tu(t), and the system’s impulse response, h(t) = δ(t). 1. Find the Fourier transform of x(t) and h(t). 2. Let y(t) be the output of a linear time-invariant system, with x(t) and h(t), as given in this example. Find the output y(t). 3. Let x(t) = u(t) and h(t) = e −tu(t). Find y(t), the output, for this new system. SOLUTION 1. From Table 4.1, entry 9, we have x (t ) = e −t u (t ) ˝ X (w ) = 1/ ˆˇ1+ jw ˘ , and from Table 4.1, entry 2, we also have h (t ) = ˝ (t ) ˙ H (w ) = 1. 2. From Table 4.2, entry 7, we have y (t ) = x (t ) * h (t ) ˝ Y (w ) = X (w ) H (w ) . Therefore, Y (w ) = (1) ˙ˆ1/ (1+ jw ) ˇ˘ = ˙ˆ1/ (1+ jw ) ˘ˇ . We can also look at Table 4.1 again and see the inverse transform of Y(w), which is y (t ) = e −t u (t ) .

163

The Fourier Transform and Linear Systems 3. With x(t) = u(t) and h(t) = e −tu(t), the output y(t) is y (t ) = x (t ) * h (t ) = u (t ) * e −t u (t ) . We can take the Fourier transform of this last equation to get ˇ 1 ˇ 1  + ˙ˆ (w )   Y (w ) =   jw ˘  ˘ 1+ jw  ˇ ˝˙ (w )  ˇ 1  ˇ 1  Y (w ) =  +  . ˘ 1+ jw  ˘ 1+ jw  ˘ jw  Always remember that with any function f(t), f(t)δ(t) = δ(t)f(t = 0). With this note and using partial fractions we write  ˆ ˝˙ (w )  ˆ 1 +˘ Y (w ) = ˘ .  ˇ 1  ˘ˇ w ( j − w )  We can do partial fraction expansion on

1 and write w ( j − w)

ˆ ˝˙ (w )  ˆ 1  ˆ 1  Y (w ) = ˘ −˘ . +˘ ˇ 1  ˇ jw  ˇ 1+ jw  Let us defne ℑ−1 to be the inverse Fourier transform. Then by using Table 4.1 again we get ˘ ˙ˆ (w ) 1  1  −1 ˘ y (t ) = ˝−1  + −˝  . jw   1+ jw   1 Finally, y (t ) = u (t ) − e −t u (t ) .

Example 4.13 Let x1(t) = e −tu(t) and x2(t) = cos(2t). Find y(t) = x1 (t)*x2(t)· SOLUTION Using the convolution property we write y (t ) = x1 (t ) * x2 (t ) ˝ Y (w ) = X1 (w ) X 2 (w ) .

164

Continuous Signals and Systems with MATLAB®

With the values for X1(w) and X2(w) substituted using the tables, we have ˙ 1 ˘ Y (w ) = ˇ  ˆ˙ (w − 2) +  (w + 2) ˘ ˆ 1+ jw  ˘ ˝˙ (w − 2)  ˘ ˝˙ (w + 2)  Y (w ) =  + .  1+ jw   1+ jw  Using the fact that F (w ) ˛ (w − w 0 ) = F (w 0 ) ˛ (w − w 0 ) , we write Y(w) as ˘ ˝˙ (w − 2)  ˘ ˝˙ (w + 2)  Y (w ) =  + .  1+ j2   1− j2  Notice that 1+˜j 2 and 1−˜j 2 are constant numbers. Therefore, by utilizing Table 4.1 again we can invert transform Y(w) to write ˆ ˝  1 2 jt ˆ ˝  1 −2 jt y (t ) = ˘ e +˘ e .   ˇ 1+ j2  2˝ ˇ 1− j2  2˝ In the above equation for y(t), the terms ˛ ˜ ˆ 1 2 jt e ˙ ˘ ˝ 1+ j2 ˇ 2˜ and ˛ ˜ ˆ 1 −2 jt e ˙ ˘ ˝ 1− j2 ˇ 2˜ are complex conjugate functions. If you add two complex conjugate functions, the sum is twice the real part of the complex number. Using this fact we can write y(t) as  ˆ ˝  1 2 jt  y (t ) = 2Real  ˘ e    ˇ 1+ j2  2˝   1 ˙ 1− 2 j ˘ y (t ) = 2Real  ˇ  cos ( 2t ) + jsin ( 2t ) 2ˆ 5 

(

and fnally y (t ) = [1/ 10 ] ˇ˘ 2cos ( 2t ) + 4sin ( 2t )  .

) , 

The Fourier Transform and Linear Systems

FIGURE 4.3

165

Sending end of transmission.

Example 4.14 Before we send an information signal through a communication medium, the information signal is converted to another signal via a process called modulation. Let us look at the block diagram in Figure 4.3. x(t) is the signal that carries the information, m(t) is the signal that we call the carrier, and y(t) is the signal that the receiver gets as input, assuming perfect transmission. Let m(t) = cos(w0t), where w0 is the carrier frequency. As shown in the multiplier block diagram in Figure 4.3 y (t ) = x (t ) m (t ) = x (t ) cos (w 0t ) . From Table 4.2 we see that multiplication in the time domain is convolution in the frequency domain. With the help of Table 4.1 we can write the Fourier transform of y(t) as Y (w ) =

X (w ) * M (w ) 1 ˙X (w ) ˇ˘ * ˝ ˙ˆ (w − w 0 ) +  (w + w 0 ) ˇ˘ = 2˝ 2˝ ˆ

with M (w ) = ˝ ˘˙ (w − w 0 ) + ˙ (w + w 0 ) .  M(w) will have the shape shown in Figure 4.4. Let us look at the band limited signal x(t) in the frequency domain. Assume X(w) has the form as shown in Figure 4.5. The convolution of X(w) and M(w) is presented by the graph in Figure 4.6, where |X(w)| is shifted twice (due to the presence of the two impulses) to the left and to the right by w0. But at the output y(t), we are interested in our transmitted signal x(t).

FIGURE 4.4 m(t) magnitude spectra.

166

Continuous Signals and Systems with MATLAB®

FIGURE 4.5

x(t) magnitude spectra.

FIGURE 4.6

The convolution of x(t) and m(t) in the frequency domain.

Let us introduce another signal and call it s(t) as seen in Figure 4.7. From Figure 4.7 we can see that s (t ) = y (t ) cos (w 0t ) . Taking the Fourier transform of this equation for s(t) we will have s (t ) = y (t ) cos (w 0t ) ˝ S (w ) =

1 ˆY (w ) ˘ * ˙ ˆˇ (w − w 0 ) +  (w + w 0 ) ˘ . 2˙ ˇ

This process now is called demodulation and it takes place at the receiving end of the transmission media.

FIGURE 4.7

The end of transmission.

167

The Fourier Transform and Linear Systems

FIGURE 4.8

Convolution of y(t) and m(t) in the frequency domain.

FIGURE 4.9

Low-pass flter.

Let us look now graphically at the convolution process as seen in Figure 4.8. To get our desired signal x(t) at the receiving end of the transmission media, we pass s(t) through a low-pass flter with H(w) as shown in Figure 4.9.

4.4 ENERGY OF NONPERIODIC SIGNALS The energy of the signal x(t) is defned as ˆ

E=

˜ x (t )

ˆ

2

dt =

−ˆ

˜ x (t ) x (t ) dt, *

−ˆ

where * means conjugate. Taking the Fourier transform of x *(t) we get ˆ 1   x (t ) ˘ X * ( w ) e − jwt dw  dt ˘ 2˙  − ˇ −  

E=

˜

1 E= 2˙

˜

ˆ  X ( w ) ˘ x ( t ) e − jwt dt  dw. ˘  − ˇ −  

˜

*

˜

168

Continuous Signals and Systems with MATLAB®

The last integral term in the above equation is the Fourier transform of x(t), X(w). Therefore, E=

1 2˙

ˇ

˜

X * ( w ) X ( w ) dw =

−ˇ

1 2˙

ˇ

˜ X ( w)

2

dw,

−ˇ

that is, what we call the theorem of Parseval. Since |X(w)| is an even function, we have 1 E= ˙

4.5

ˆ

˜ X ( w)

2

dw.

(4.8)

0

THE ENERGY SPECTRAL DENSITY OF A LINEAR SYSTEM

Consider a linear time-invariant system with input x(t), impulse response function h(t), and output y(t). In real time we write the output as y (t ) = x (t ) * h (t ) , where * means convolution. In the Fourier transform language we write the output y(t) as Y ( w) = X ( w) H ( w), and by taking magnitudes we get Y ( w) = X ( w) H ( w) , 2

2

which simplifes to Y ( w) = X ( w) H ( w) . 2

2

2

(4.9)

Therefore, the energy spectral density for the output of the system is the product of the energy spectral density of the input times the squared magnitude of the system’s transfer function H(w).

4.6

SOME INSIGHTS: NOTES AND A USEFUL FORMULA

Fourier series are limited as to their use. They only represent signals of periodic nature. Many important functions like the isolated pulse and the decaying exponential are nonperiodic and therefore cannot be represented by the Fourier series. Using the Fourier transform we were able to represent such functions. Fourier series coeffcients cn in the previous chapter were used to study and examine the frequency components of the signal under investigation. The Fourier

The Fourier Transform and Linear Systems

169

transform allows us to look at the Fourier transform of the impulse function h(t), and thus, study the frequency response of the system h(t) represents. From H(jw) we can deduce the magnitude and the phase of the system. If the system under investigation is to pass a signal that has many unknown frequencies, plotting H(jw) vs. w will tell us what frequencies the system will pass and what frequencies it will block or attenuate. Knowing the transfer function H(jw), we can fnd its magnitude and phase at a particular frequency. If the system H(jw) represents is subject to a sinusoidal input signal at that particular frequency of H(jw), the steady-state output yss(t) of the system can be evaluated as yss ( t ) = x ( t ) H ( jw ) cos ( wt + ˙ + ˆ ) ,

(4.10)

where x ( t ) = A cos ( wt + ˙ ) and φ is the phase of H(jw) at a particular given w. If x ( t ) = Asin ( wt + ˙ ) , then yss ( t ) = x ( t ) H ( jw ) sin ( wt + ˙ + ˆ ) .

(4.11)

This says that the output of a linear time-invariant system, if subject to a sinusoidal input, will have a steady-state solution equal to the magnitude of the input signal multiplied by the magnitude of the transfer function of the system, evaluated at the frequency of the input signal and shifted by the phase angle of the transfer function evaluated at the input frequency as well. Some notes on Fourier transform are worth mentioning: 1. The magnitude spectrum of the Fourier transform of a signal x(t) is even and the phase spectrum is odd. 2. Shifting the signal x(t) in time does not alter its magnitude. 3. Time compression of a signal x(t) corresponds to frequency expansion of X(w). 4. Time expansion of a signal x(t) corresponds to frequency compression of X(w). 5. A time-limited signal x(t) has a Fourier transform, X(w), which is not band limited (by band limited we mean the frequency band). 6. If X(w) is band limited, then x(t) is not time limited.

170

4.7

Continuous Signals and Systems with MATLAB®

END-OF-CHAPTER EXAMPLES

EOCE 4.1 Let the Fourier transforms of x1(t) and x2(t) be X1(w) and X2(w), respectively. Let ℑ denote “the Fourier transform of.” Is ℑ(ax1(t) + bx2(t)) = a ℑ(x1(t)) + b ℑ(x2(t))? Assume a and b are constants. SOLUTION Using the defning integral of the Fourier transform and properties of integrals we have

(

)

˝ ax1 (t ) + bx2 (t ) =

˘

˜ (ax (t ) + bx (t )) e 1

2

− jwt

dt

−˘

(

)

˘

˜

˝ ax1 (t ) + bx2 (t ) = a x1 (t ) e

˘

− jwt

˜

dt + b x2 (t ) e − jwt dt

−˘

(

−˘

)

(

)

(

)

˛ ax1 (t ) + bx2 (t ) = aX (w ) + bX (w ) = a˛ x1 (t ) + b˛ x2 (t ) . This is what we call the linearity property of the Fourier transform.

EOCE 4.2 If X(w) is the Fourier transform of x(t), what is the relation between X(t) and 2πx(−w)? SOLUTION From the defning integral X (w ) =

ˆ

˜ x (t ) e

− jwt

dt,

−ˆ

and x (t ) =

1 2˙

ˇ

˜ X (w )

jwt

dw.

−ˇ

If we set t = −t, then the last integral becomes x ( −t ) =

1 2ˆ

ˇ

˜ X (w ) e

−ˇ

− jwt

dw

171

The Fourier Transform and Linear Systems or ˇ

˜ X (w ) e

2˝x ( −t ) =

− jwt

dw.

−ˇ

Now replace w by t to get 2˝x ( −w ) =

ˇ

˜ X (t ) e

− jwt

dt.

−ˇ

This last equation says that the Fourier transform of X(t) is 2πx(−w), where X(t) is X(w) evaluated at w = t.

EOCE 4.3 If a is a positive constant, what is the Fourier transform of x(at)? SOLUTION Let us look at the familiar integral ˙

˜ x (at ) e

− jwt

dt.

−˙

If we let at = m, then dt = dm/a. The integral becomes ˆ

˜

1/ a x ( m) e − j( m/a)w dm = −ˆ

1 X (w / a) . a

Therefore,

(

)

˛ x ( at ) =

1 X (w / a) . a

EOCE 4.4 What is the Fourier transform of the shifted signal x(t − a)? SOLUTION Using the defning integral, we have

(

)

˝ x (t − a) =

ˇ

˜ x (t − a) e

−ˇ

− jwt

dt.

172

Continuous Signals and Systems with MATLAB®

Let t − a = m, then dt = dm. The above integral becomes

(

ˇ

)

˜ x ( m) e

˝ x (t − a) =

− jw ( m + a)

dm

−ˇ

(

ˇ

)

˜

˝ x (t − a) = e − jwa x ( m) e − jwmdm. −ˇ

Now it is clear from the last step that

(

)

˛ x (t − a) = e − jwa X (w ) .

EOCE 4.5 What is the Fourier transform of ejatx(t)? SOLUTION By using the defning integral again we can write

(

ˇ

) ˜e

˝ e jat x (t ) =

jat

x (t ) e jwt dt

−ˇ

(

ˇ

) ˜ x (t ) e

˝ e jat x (t ) =

− j (w −a)t

dt = X (w − a) .

−ˇ

EOCE 4.6 What is the Fourier transform of x(t)cos(at)? SOLUTION cos(at) can be written in exponential form as cos ( at ) =

e jat + e − jat . 2

Taking the Fourier transform we get ˆ e jat + e − jat  ˛ x (t ) cos ( at ) = ˛ ˘ x (t )  2 ˇ

(

)

˙ ˙ e jat ˘ e − jat ˘ = ˝ ˇ x (t ) + ˝ ˇ x (t ) .  2  2  ˆ ˆ

173

The Fourier Transform and Linear Systems By simplifcation we arrive at

(

)

˛ x (t ) cos ( at ) = =

(

)

(

1 1 ˛ x (t ) e jat + ˛ x (t ) e − jat 2 2

)

1 1 X (w − a) + X (w + a) . 2 2

EOCE 4.7 What is the Fourier transform of the derivative of x(t)? SOLUTION ˙d ˘ ˝ ˇ x (t ) = ˆ dt 



˙d

˘

˜ ˇˆ dt x (t ) e

− jwt

dt

−

d If we let u = e −jwt and ˛˙ x (t )ˆ˘ dt, then ˝ dt ˇ 



˙d ˘ ˝ ˇ x (t ) = e − jwt x (t ) + jw x (t ) e − jwt dt. ˆ dt  −

˜

−

The above equation was obtained by integrating by parts. 

˙d ˘ ˝ ˇ x (t ) = jw x (t ) e − jwt dt ˆ dt 

˜

−

˝d ˇ ˛ ˆ x (t ) = jwX (w ). ˙ dt ˘

EOCE 4.8 What is the Fourier transform of the second and the nth derivative of x(t)? SOLUTION By using the properties of the Fourier transform we write ˝ d2 ˇ ˝d ˇ ˛ˆ x (t ) = jw˛ ˆ x (t ) = jw ( jw ) X (w ) ˙ dt ˘ ˙ dt ˘ ˝ d2 ˇ 2 ˛ˆ x (t ) = ( jw ) X (w ) = −w 2X (w ) . ˙ dt ˘

174

Continuous Signals and Systems with MATLAB®

Similarly,

ˇ ˝ dn n ˛ˆ x ( t ) = ( jw ) X ( w ) . ˙ dt ˘ EOCE 4.9 Consider the signal in Figure 4.10 and its derivative in Figure 4.11. What is the Fourier transform of x(t)? SOLUTION d Let us start by taking the Fourier transform of x (t ). We can write x(t) mathematidt cally as    x (t ) =   

FIGURE 4.10 Signal for EOCE 4.9.

FIGURE 4.11

Signal for EOCE 4.9.

0 t −t + 2 0

t 0 ) ˛

5. x(αt)

( )

d x (t ) dt 2 d 7. x (t ) dt

sX ( s ) − x 0 −

6.

dx ( t ) − 0 dt X(s)H(s)

( )

s 2 X ( s ) − sx 0 − −

8. x(t) * h(t) ˙

˜

1 X (s) s

10. tx(t)

−dX ( s ) ds

9. x ( ˝ ) d˝ 0−

( )

11. x(t) sin(w0t)

1 ˙ X ( s − jw0 ) − X ( s + jw0 ) ˇ˘ 2j ˆ

12. x(t)cos(w0t)

1 ˙ X ( s − jw0 ) + X ( s + jw0 ) ˇ˘ 2ˆ

13. x(o+)

limit s˛˝ sX ( s )

14. limit t˛˝ x ( t )

limit s˛0 sX ( s )

5.4 THE INVERSE LAPLACE TRANSFORM The inverse Laplace transform can be found using Tables 5.1 and 5.2. It can also be found using the following equation 1 x (t ) = 2˙j

ˆ+ jw

˜ X ( s ) e ds, st

(5.6)

ˆ− jw

where s = σ + jw. In the next few examples, we will look at some entries in Table 5.1 and see how they were developed. You need to know that each entry in Table 5.1 is derived using the defning integral ˆ

X (s) =

˜ x (t ) e

−ˆ

−st

dt.

194

Continuous Signals and Systems with MATLAB®

Example 5.1 Find the Laplace transform of the impulse signal δ(t). SOLUTION Using the defning integral, we can fnd the Laplace transform of δ(t) as X (s) =

˙

˜ x (t ) e

0

− st

dt.



By substituting for x(t) we get ˆ

˜

X ( s ) = ˙ (t ) e − st dt = e − s(0) = 1. 0−

Therefore, x (t ) = ˝ (t ) ˙ X ( s ) = 1.

Example 5.2 Find the Laplace transform of the signal u(t). SOLUTION Using the defning integral, we can fnd the Laplace transform of u(t) as X (s) =

˙

˜ x (t ) e

− st

dt.

0−

By substituting for x(t) we have ˙

˜

X ( s ) = u (t ) e − st dt , 0−

and fnally ˇ

˜

X ( s ) = e − st dt = 0

e − st −s

ˇ

= 0

1 ˆ s

Therefore, we write x (t ) = u (t ) ˝ x ( s ) =

1 ˙ s

195

The Laplace Transform and Linear Systems

Example 5.3 Find the Laplace transform of the signal x(t) = e −at u(t). SOLUTION We can fnd the Laplace transform of e −at u(t) using the defning integral and write ˙

˜

X ( s ) = x (t ) e − st dt 0− ˙

˜

X ( s ) = e −atu (t ) e − st dt 0−

˙

˜

X ( s ) = e − ( a+ s ) dt t

0

and fnally e − ( s + a) X (s) = − ( s + a) t

ˇ

= 0

1 ˆ s+a

Therefore, we have the pairs x (t ) = e −atu (t ) ˝ X ( s ) =

1 ˆ s+a

The other entries in Table 5.1 can be evaluated in the same way.

Example 5.4 Find the inverse Laplace transform of X ( s ) = 1−

5 ˆ s +1

SOLUTION As Table 5.2 shows, we can use the frst entry to inverse transform each term separately. Using Table 5.1 we get ˛ (t ) ˝ 1 and 5 ° 5e −t . s +1

196

Continuous Signals and Systems with MATLAB®

Therefore, X ( s ) = 1−

5 ˆ x (t ) = ˇ (t ) − 5e −tu(t ). s +1

Example 5.5 Find the inverse Laplace transform of X (s) =

1 ˙ s2 + s + 1

SOLUTION We can see that the roots of the denominator in the above expression for X(s) are complex. In this case, we can try to avoid using partial fraction expansion to complete the squares in the denominator in X(s) and take advantage of the entries in Table 5.1. Therefore, we can write X (s) =

1 = 2 3 ˙ 1˘ ˙ + s + s+ ˇˆ  2 4 ˇˆ

1 2 ˙ 3˘ 1˘  + ˇ  2 ˆ 4

2



And by putting the above expression in a form similar to the form in Table 5.1, entry 11, we arrive at

X (s) =

˝ 3ˇ ˆ 4 ˘ ˙

1

2 2 ˝ 3ˇ ˝ ˝ 3ˇ 1ˇ + s + ˆ 4  ˆ˙  ˆ 4 ˙ ˘ 2˘ ˙ ˘



We can now look at entry 11 in Table 5.1 and write

X (s) =

1 ˝ 3ˇ ˝ ˆ  s+ ˙ 4 ˘ ˙ˆ

˝ 3ˇ ˆ 4 ˙ ˘ ˝ 3ˇ 1ˇ ˘ + ˆ  2 ˙ 4˘ 2

2

 x (t ) =

4 e 3

1 − t 2

˝ 3 ˇ sin ˆ t  u (t ) . ˙ 4 ˘

Note that when the roots of the denominator in the s-plane (frequency domain) are complex, use entries 10 and 11 in Table 5.1, depending on the problem at hand.

197

The Laplace Transform and Linear Systems

Example 5.6 Find the inverse Laplace transform of X (s) =

s ˙ s −1 2

SOLUTION In this case, the roots are not complex. This X(s) is not shown in Table 5.1. We will use partial fraction expansion as in the following. X (s) =

s A B = + , s2 − 1 s − 1 s + 1

where ˆ  s A = ( s − 1) ˘  s − 1 s + 1 ( )( ) ˇ 

. s=1

Notice here that we can cancel the (s − 1) terms before evaluating at s = 1. Therefore, we write ˙ s ˘ A= ˇ  ˆ ( s + 1) 

= s=1

1  2

B can also be calculated in a similar way as ˆ  s B = ( s + 1) ˘  s − 1 s + 1 ( )( ) ˇ 

s=−1

or ˛ s ˆ B=˙ ˝ s − 1˘ˇ

= s=−1

1  2

Therefore, we now write 1 1 s A B 2 2 X (s) = 2 = + = + ˆ s −1 s −1 s +1 s −1 s +1

198

Continuous Signals and Systems with MATLAB®

Using Table 5.1 we can inverse transform X(s) and write 1 1 1  ˇ1 2 2 X (s) = + ˆ x (t ) =  et + e −t  u (t )  s −1 s +1 2 2  ˘

5.5

BLOCK DIAGRAMS USING THE LAPLACE TRANSFORM

Any transfer function in the s-domain can be written in terms of a fraction: the numerator as a function of s, and the denominator as a function of s, too. We will denote such a transfer function as H(s), the numerator as N(s), and the denominator as D(s). In this case, we can write H (s) =

N (s) ˝ D (s)

The transfer function relates the input to an LTI (linear time-invariant) system x(t) to the output of the same system y(t). The transfer function can also be written as H (s) =

Y (s) N (s) = . X (s) D (s)

From the above equation, we can write Y ( s ) = X ( s ) H ( s ). As a block diagram representation, we represent the system in the above equation as in Figure 5.1.

5.5.1 PARALLEL SYSTEMS Consider three systems represented by their transfer functions H1(s), H2(s), and H3(s), with the single input X(s) and the single output Y(s). These can be represented in a block diagram as shown in Figure 5.2.

X(s)

FIGURE 5.1 General block diagram.

H(s)

Y(s)

The Laplace Transform and Linear Systems

199

FIGURE 5.2 Parallel system.

In Figure 5.2, the output is Y ( s ) = ( H1 ( s ) + H 2 ( s ) + H3 ( s )) X ( s ) . If we have more transfer functions, the procedure is the same where you add all the individual transfer functions and multiply by the input X(s) to get Y(s). You can fnd the equivalent transfer function for the whole system as H (s) =

5.5.2

Y (s) = H1 ( s ) + H 2 ( s ) + H3 ( s ) . X (s)

SERIES SYSTEMS

Consider three systems represented by their transfer functions H1(s), H2(s), and H3(s), with the single input X(s) and the single output Y(s). These can be represented in a block diagram as shown in Figure 5.3. In Figure 5.3, the output is Y ( s ) = ( H1 ( s ) H 2 ( s ) H3 ( s )) X ( s ) .

FIGURE 5.3 Series system.

200

Continuous Signals and Systems with MATLAB®

If we have more transfer functions, the procedure is the same where you multiply all the individual transfer functions frst and then multiply the result by the input X(s) to get Y(s). You can fnd the equivalent transfer function for the whole system as H (s) =

Y (s) = H1 ( s ) H 2 ( s ) H3 ( s ) . X (s)

5.6 REPRESENTATION OF TRANSFER FUNCTIONS AS BLOCK DIAGRAMS Block diagram representation is not unique, as you will see in the following examples which illustrate the procedure. Example 5.7 Represent the transfer function H (s) =

1 s2 − 1

using block diagrams. SOLUTION The representation can be accomplished in many ways. 1. With the relation Y (s) = H (s) X (s) , the procedure is straightforward, as shown in Figure 5.4. 2. We can write H(s) as the product of two terms H (s) =

1 ˙ 1 ˘˙ 1 ˘ =ˇ ˇ . s 2 − 1 ˆ s − 1 ˆ s + 1

This is the case of multiplying two transfer functions, and the block is shown in Figure 5.5.

FIGURE 5.4 Block for Example 5.7.

The Laplace Transform and Linear Systems

201

FIGURE 5.5 Block for Example 5.7.

FIGURE 5.6 Block for Example 5.7.

3. We can write H(s) as the sum of two terms ˙ 1 ˘ ˙ −1˘ 1 ˇ 2  ˇ 2 + H (s) = 2 = . s − 1 ˇ s − 1 ˇ s + 1 ˇˆ  ˆˇ  This is the case of adding two transfer functions. This block is shown in Figure 5.6.

5.7

PROCEDURE FOR DRAWING THE BLOCK DIAGRAM FROM THE TRANSFER FUNCTION

We will learn this procedure by example. Consider the following third-order system (we say third order because the denominator polynomial is of degree three) or third-order differential equation represented as the transfer function H (s) =

as 3 + bs 2 + cs + d , s 3 + es 2 + fs + g

where a, b, c, d, e, f, and g are constants. It is required that we represent this transfer function in block diagram form.

202

Continuous Signals and Systems with MATLAB®

FIGURE 5.7 Three-integrators block diagram.

The frst thing we do here is to make the coeffcient of s3 in the denominator unity. Our transfer function has that characteristic. Because the order of the denominator in this expression for H(s) is 3, we will need three integrators. Let us precede each integrator by a summer and follow the last integrator by a summer, too. The initial step in the development of drawing this block diagram is shown in Figure 5.7. Next, we will feedback Y(s) multiplied by the negative of each of the constants e, f, and g, in the denominator of H(s). If we proceed from left to right, the signal [Y(s) (−g)] will be fed to the summer that precedes the frst integrator, the signal [Y(s)(−f)] will be fed to the summer that precedes the second integrator, and the signal [Y(s) (−e)] will be fed to the summer that precedes the third integrator. The diagram is shown in Figure 5.8. Finally, we will feed forward the input signal [X(s)(d)] to the summer that precedes the frst integrator, [X(s)(c)] to the summer that precedes the second integrator, [X(s)(b)] to the summer that precedes the third integrator, and [X(s)(a)] to the summer that follows the third integrator. The fnal block diagram is shown in Figure 5.9.

FIGURE 5.8 Three-integrators block diagram.

FIGURE 5.9 Three-integrators block diagram.

203

The Laplace Transform and Linear Systems

Notes on the above example: 1. If the order of the numerator in the example at hand is 2, then the feed forward to the summer after the third integrator is zero, and we represent that without connection. 2. If the coeffcient of s2 in the numerator in the example at hand is zero, then there will be no feed forward signal to the summer that precedes the third integrator. 3. If there is no constant term in the numerator (if d = 0), then there will be no feed forward from x(t) to the frst summer before the frst integrator. We will consider further examples to illustrate these notes.

5.8

SOLVING LTI SYSTEMS USING THE LAPLACE TRANSFORM

Given the system impulse response h(t) and the input x(t), we should be able to fnd the output y(t) easily, using the Laplace transform techniques. Example 5.8 For a certain system, let h(t) = e −t u(t) and x(t) = δ(t). What is the output of the system? SOLUTION We will take this system into the Laplace domain and fnd Y(s). We then inverse transform Y(s) to get y(t). For the impulse response h (t ) = e −tu (t ) ˝ H ( s ) =

1 , s +1

and for the input x (t ) = ˝ (t ) ˙ X ( s ) = 1. The output of the system in the Laplace domain is Y (s) = X (s) H (s) or ˙ 1 ˘  Y ( s ) = (1) ˇ ˆ s + 1 Using Table 5.1, we can see that the inverse transform of Y(s) is y (t ) = e −tu (t ) .

204

Continuous Signals and Systems with MATLAB®

FIGURE 5.10 System for Example 5.8.

Let us look at the system graphically. In the Laplace domain we have the block in Figure 5.10. In the time domain, we have the signals as shown in Figure 5.11.

Example 5.9 For a certain system let h (t ) = e −tu (t ) and x (t ) = u (t) . What is the output of the system? SOLUTION We will take this system into the Laplace domain and fnd Y(s). We then inverse transform Y(s) to get y(t). For the impulse signal h (t ) = e −tu (t ) ˝ H ( s ) =

1 , s +1

and for the input x (t ) = u (t ) ˝ X ( s ) =

FIGURE 5.11 Signals for Example 5.8.

1 . s

205

The Laplace Transform and Linear Systems

FIGURE 5.12 System for Example 5.9.

FIGURE 5.13 Signals for Example 5.9. The output is then Y (s) = X (s) H (s) ˝ 1ˇ ˝ 1 ˇ Y (s) = ˆ  ˆ . ˙ s ˘ ˙ s + 1˘ If we look at Table 5.1, we cannot see an entry similar to Y(s) as given in this example. We will do partial fraction expansion on Y(s) and write 1 ˝ 1ˇ ˝ 1 ˇ 1 = −  Y (s) = ˆ  ˆ ˙ s ˘ ˙ s + 1˘ s s + 1 We can now use Table 5.1 and inverse transform each term in Y(s) to get

(

)

y (t ) = u (t ) − e −tu (t ) = 1− e −t u (t ) . Graphically, and in the Laplace domain, we have the system shown in Figure 5.12. In the time domain we have the picture in Figure 5.13.

5.9 SOLVING DIFFERENTIAL EQUATIONS USING THE LAPLACE TRANSFORM We need to remember that the systems we are dealing with here are nothing but dynamical systems that can be represented as differential equations. The differential equation d y (t ) + y (t ) = x (t ) dt

206

Continuous Signals and Systems with MATLAB®

is a frst-order differential equation that describes a linear system with x(t) as an input and y(t) as an output. Using Tables 5.1 and 5.2, we can solve differential equations easily. Example 5.10 Find the output of the following system represented by the differential equation d y (t ) + 9y (t ) = ˙ (t ) dt with the initial condition y(0 −) set to zero. SOLUTION In this equation x(t) is given as δ(t). We need to fnd y(t). Using Table 5.2, we can write the Laplace equivalent of the differential equation given. We will transform the differential equation term by term and write

( )

˝ sY ( s ) − y 0 − ˆ + 9Y ( s ) = 1. ˙ ˇ With the initial condition set to zero, we can solve for Y(s) as Y (s) =

1 . s+9

We now take the inverse transform of Y(s) using Table 5.1 to get y (t ) = e −9tu (t ) .

Example 5.11 Suppose we have the same differential equation as in Example 5.10 with nonzero initial condition y(0 −) = 1. What is the output y(t) of this system if x(t) is set to zero? SOLUTION We proceed with the solution as we did in the previous example and write the Laplace transform of the system this time as

( )

˝ sY ( s ) − y 0 − ˆ + 9Y ( s ) = 0 ˙ ˇ ˙˝sY ( s ) − 1ˆˇ + 9Y ( s ) = 0. Finally Y (s) =

1 . s+9

207

The Laplace Transform and Linear Systems Next, we take the inverse transform to get y (t ) = e −9tu (t ) .

Example 5.12 Let us now consider a second-order system described by the differential equation d2 d y (t ) + 2 y (t ) = ˙ (t ) . dt dt The input is applied at t = 0 and the initial conditions are set as

( )

y 0− =

d y (t ) = 0. dt t =0−

Find the output of this LTI system. SOLUTION We can look again at Table 5.2 to transform the given differential equation term by term into its Laplace domain and write ˝ 2 d ˆ s Y ( s ) − Y (t ) dt ˙

t =0−

ˇ − sy 0 −  + 2 ˝˙ sY ( s ) − y 0 − ˇ˘ = 1. ˘

( )

( )

Solving for Y(s) we get Y (s) =

1 1 = ˙ s 2 + 2s s ( s + 2)

Using partial fractions we write Y(s) as 1 1 − 2 2 Y (s) = + ˆ s s+2 The inverse transform of Y(s), y(t), is obtained using Table 5.1 as y (t ) = (1/ 2) u (t ) − (1/ 2) e −2tu (t ) , and fnally, y (t ) = (1/ 2) ˙ˆ1− e −2t ˇ˘ u (t ) .

208

Continuous Signals and Systems with MATLAB®

5.10 THE FINAL VALUE THEOREM Sometimes we are interested in the fnal value of the output y(t) as t → ∞. Instead of frst solving for y(t) in the time domain, which can be very tedious in some cases, we can use the Laplace transform and write limit tˆˇ˜ y ( t ) = limit sˆ0 [ sY ( s )]. To use the theorem above, the roots of the denominator of sY(s) must not be positive.

5.11

THE INITIAL VALUE THEOREM

For the initial value of y(t) we have limit tˆ0+ y ( t ) = y ( 0 + ) = limit sˆ˘ [ sY ( s )].

Example 5.13 If y(t) = 2e −9tu(t), what is limit t→ ∞y(t)? SOLUTION In this example, the solution for the output y(t) is given for us. As we said earlier, this solution may not be available, but what we can fnd in such a case is its transform Y(s) from which we can fnd limit t˘ y (t ) = limit s˘0 ˝sY ˙ ( s ) ˆ. ˇ In this example, we are lucky and have y(t). We can use this y(t) for checking our answer. Since u(∞) = 1 and e −∞ = 0, limit t→ ∞ y(t) = e −9(∞) u(∞) = (0) (1) = 0. According to the fnal value theorem ˝ 2 ˆ ˝ 0 ˆ = 0. limit t y (t ) = limit s0 ˙˝sY ( s ) ˇˆ = limit s0  s = ˙ s + 9 ˇ ˙ 0 + 9 ˇ Here we see that the two approaches agree.

5.12

SOME INSIGHTS: POLES AND ZEROS

The transfer function H(s) of a LTI system is a very important representation. It tells us about the stability of the system, the poles, the zeros, and the shape of the transients of the output of the system. Using H(s), we can find the steadystate response of the system and the particular solution of the system, all in one shot.

The Laplace Transform and Linear Systems

5.12.1

209

THE POLES OF THE SYSTEM

The poles of the system are the roots of the denominator, the algebraic equation in the variable s, of the transfer function H(s) H (s) =

N (s) ˝ D (s)

D(s) is a polynomial in s of order equal to the order of the system. The roots of the denominator D(s) are called the poles of the system. These are the same poles we discussed in Chapter 2. Then we called them the eigenvalues of the system. D(s) is actually the characteristic equation of the system, or, as we called it before, the auxiliary equation of the system.

5.12.2 THE ZEROS OF THE SYSTEM The roots of the numerator N(s) are called the zeros of the system.

5.12.3 THE STABILITY OF THE SYSTEM The poles of the system determine the stability of the system under investigation. If the real parts of the poles are all negative, then the system at hand is stable and the transients will die as time gets larger. The stability of the system is determined by the poles not the zeros of the system. If one of the real parts of the poles is positive, then the system is not stable. You may have positive and negative zeros, but the sign of their values has no effect on the stability of the system. If D(s) has two roots (second-order system) called α1 and a2, then the output will have the general form y ( t ) = c1e˙1t + c2 e˙2t , where the constant c’s are to be determined. The exponential terms will determine the shape of the transients. If one of the α’s is positive, the output will grow without bounds. If the two α’s are negative, the output will die as time progresses. The α’s are the eigenvalues or the poles of the system.

5.13 END-OF-CHAPTER EXAMPLES EOCE 5.1 What is the Laplace transform of the derivative of the signal x(t)? SOLUTION We can use the defning integral ˙

˜

X ( s ) = x (t ) e − st dt 0−

210

Continuous Signals and Systems with MATLAB®

and write ˝d ˇ L ˆ x (t ) = ˙ dt ˘



d

˜ dt x (t ) e

0

− st

dt,



where L represents “the Laplace transform of.” d Let u = e −st and du = x (t ) dt, then du = −se −stdt and v = x(t). We now can dt integrate by parts and write ˝d ˇ L ˆ x (t ) = e − st x (t ) ˙ dt ˘

 0−



˜

+ s x (t ) e − st dt 0−

( )

˛d ˆ L ˙ x (t )˘ = −x 0 − +˜sX ( s ) . ˝ dt ˇ Therefore, we can fnally write

( )

˛d ˆ L ˙ x (t )˘  ˜sX ( s ) − x 0 − . ˝ dt ˇ

EOCE 5.2 What is the Laplace transform of the second derivative of the signal x(t)? SOLUTION We can use EOCE 5.1 to solve EOCE 5.2 as in the following. The transform of the second derivative is ˛ d2 ˆ ˛d ˆ d L˙ x (t )˘ = sL ˙ x (t )˘ − x 0− . ˝ dt ˇ dt ˝ dt ˇ

( )

˛d ˆ Substituting for L ˙ x (t )˘ from EOCE 5.1 in the above equation, we get ˝ dt ˇ ˛ d2 ˆ d L˙ x 0− . x (t )˘ = s  sX ( s ) − x 0 −  − dt ˝ dt ˇ

( )

( )

By simplifcation we can fnally write ˛ d2 ˆ d L˙ x 0− . x (t )˘ = s 2X ( s ) − sx 0 − − dt ˝ dt ˇ

( )

( )

211

The Laplace Transform and Linear Systems

EOCE 5.3 What is the Laplace transform of

d3 x (t ) ? dt SOLUTION

The transform of the third derivative is ˆ ˛ d2 ˆ d2 ˛ d3 L˙ x (t )˘ = sL ˙ x (t )˘ − x 0− . ˝ dt ˇ ˝ dt ˇ dt

( )

˛ d2 ˆ Substituting for L ˙ x (t )˘ from EOCE 5.2 we get ˝ dt ˇ 2 ˛ d3 ˆ d   d L˙ x 0− . x (t )˘ = s  s 2X ( s ) − sx 0 − − x 0−  − dt ˝ dt ˇ   dt

( )

( )

( )

And with some manipulations, we arrive at ˛ d3 ˆ d d2 x (t )˘ = s 3X ( s ) − s 2X 0 − − s x 0 − − L˙ x 0− . dt dt ˝ dt ˇ

( )

( )

( )

EOCE 5.4 Now that we know how to transform a derivative of x(t), what about the integral of x(t)? SOLUTION Let X(t) be the integral of x(t). Then in this case

d X (t ) = x (t ) and dt

˝t ˇ L ˆ x (u ) du  = L X (t ) . ˆ˙ − ˘ 0

(

˜

)

But

( )

˝d ˇ L x (t ) = L ˆ X (t ) = sL X (t ) − X 0 − ˙ dt ˘

( (

)

L x (t )

)

(

0− ˆt  ˘ = sL x (u ) du − x (u ) du  ˘ −  ˇ0  0−

˜

˙t ˘ L x (t ) = sL ˇ x (u ) du  . ˇˆ −  0

(

)

)

˜

˜

212

Continuous Signals and Systems with MATLAB®

Therefore ˇ ˝t 1 1 L ˆ x (u ) du  = L x (t ) = X ( s ) . s ˆ˙ − ˘ s 0

(

˜

)

EOCE 5.5 d If x(0 −) = 0, we claim that the inverse Laplace transform of sX ( s ) = x (t ). Is this dt claim true? SOLUTION We can use EOCE 5.1 to write

) ( ) ( )

˛d ˆ L ˙ x (t )˘ = sL x (t ) − x 0 − − x 0 − = sX ( s ) . ˝ dt ˇ

(

This implies

(

)

L−1 sX ( s ) =

d x (t ) . dt

EOCE 5.6 Show that the inverse Laplace transform of X(s)/s is the integral of x(t). SOLUTION We know that ˝t ˇ 1 L ˆ x (u ) du  = X ( s ) . ˆ˙ − ˘ s 0

˜

This means that t

˝1 ˇ L−1 ˆ X ( s ) = x (u ) du. ˙s ˘

˜

0−

EOCE 5.7 Find the inverse Laplace transform of

1 1 . s s +1

213

The Laplace Transform and Linear Systems SOLUTION

We can use EOCE 5.6 and ignore the term 1/s to fnd the inverse transform of 1/(s + 1). 1 ˝ e −tu (t ) = x (t ) s +1 We can then integrate x(t) and get t

˜e

−u

(

)

du = − e −t − 1 = − e −t + 1.

0−

But

( −e

−t

)

+ 1 u (t ) ˙

1 , s ( s + 1)

and therefore ˝ 1 ˇ −t L−1 ˆ  = − e + 1 u (t ) . ˙ s ( s + 1) ˘

(

)

We can use partial fraction expansion to check this answer.

EOCE 5.8 Find the inverse Laplace transform of

s using EOCE 5.5. s +1

SOLUTION Let us ignore s in the numerator and inverse transform

1 . By doing that we can write s +1

1 ˝ e −tu (t ) . s +1 But at t = 0, e −t u(t) is not 0. Therefore, we cannot use the EOCE 5.5 result.

EOCE 5.9 Consider the two coupled frst-order differential equations with zero initial conditions d y (t ) + 2y (t ) + z (t ) = 0 dt d z (t ) + z (t ) = −u (t ) . dt Solve for y(t) using the Laplace transform approach.

214

Continuous Signals and Systems with MATLAB® SOLUTION

In the Laplace domain the two coupled equations are sY ( s ) + 2Y ( s ) + Z ( s ) = 0

(5.7)

sZ ( s ) + Z ( s ) = −1/s.

(5.8)

From Equation (5.8) we get Z(s) as Z (s) = −

1 . s ( s + 1)

From Equation (5.7) we have Y ( s ) [ s + 2] = −Z ( s ) . Substitute for Z(s) to get Y(s) as Y (s) =

1 . s ( s + 1)( s + 2)

Using partial fraction expansion we get 1 1 −1 + 2 , Y (s) = 2 + s s +1 s + 2 and then y(t) is obtained by inverse transforming Y(s) to get y (t ) =

1 1 u (t ) − e −tu (t ) + e −2tu (t ) . 2 2

EOCE 5.10 What is L(e −atx(t))? SOLUTION Using the defning integral we get

(

ˆ

) ˜

L e −at x (t ) = e −at x (t ) e − st dt 0−

(

ˆ

) ˜

L e −at x (t ) = x (t ) e − ( s + a)t dt = X ( s ) 0−

. s+a

215

The Laplace Transform and Linear Systems Therefore, the pairs are e −at x (t ) ˛ X ( s )

s+a

.

EOCE 5.11 What is the Laplace transform of e −2te −t u(t)? Use EOCE 5.10. SOLUTION We can use EOCE 5.10 and write e − t u (t ) ˛

1 s +1

and

(

)

(

)

1 s + 1 s+ 2

L e −2t e −tu (t ) =

1

L e −2t e −tu (t ) =

( s + 2) + 1

=

1 s+3

or e −2t e −tu (t ) ˛

1 . s+3

EOCE 5.12 Consider a shifted signal x(t − a). What is the Laplace transform of x(t − a)u(t − a)? SOLUTION Notice that the multiplication x(t − a)u(t − a) starts at t = a. Using the defning integral we can write

(

)

ˆ

˜

L x (t − a) u (t − a) = x (t − a) u (t − a) e − st dt 0−

(

)

ˆ

˜

L x (t − a) u (t − a) = x (t − a) e − st dt. a

If we let t − a = m, then

(

)

ˆ

˜

L x (t − a) u (t − a) = x ( m) e − s( m+ a)dm 0

216

Continuous Signals and Systems with MATLAB®

or

(

)

L x (t − a) u (t − a) = e

ˆ

− sa

˜ x ( m) e

dm = e − sa X ( s ) .

− sm

0

EOCE 5.13 Find the Laplace transform of the signal in Figure 5.14. SOLUTION Mathematically, the signal can be written as y (t ) = (t ) ˙ˆu (t ) − u (t − 1) ˇ˘ + ( −t + 2) ˙ˆu (t − 1) − u (t − 2) ˇ. ˘ Multiplying the terms out we get y (t ) = tu (t ) − tu (t − 1) + (t − 2) u (t − 2) + ( −t + 2) u (t − 1) . Expanding the terms we will have y (t ) = tu (t ) − (t + 1− 1) u (t − 1) + (t − 2) u (t − 2) − (t − 1+ 1) u (t − 1) + 2u (t − 1) y (t ) = tu (t ) − (t − 1) u (t − 1) + u (t − 1) + (t − 2) u (t − 2) − (t − 1) u (t − 1) − u (t − 1) + 2u (t − 1) . We can easily show by using the defning integral that u (t − a) ˝

e − sa . s

We can now fnd Y(s) as Y (s) =

e− s 1 e − s e − s e −2s e − s e − s − 2 + + 2 − 2 − +2 2 s s s s s s s Y (s) =

e − s e −2s e− s 1 −2 2 + 2 +2 . 2 s s s s

FIGURE 5.14 Signal for EOCE 5.13.

217

The Laplace Transform and Linear Systems

EOCE 5.14 What is L(tx(t))? SOLUTION Let us differentiate the defning integral ˙

˜

X ( s ) = x (t ) e − st dt 0−

with respect to s on both sides to get ˙

d d x (t ) e − st dt X (s) = ds ds −

˜

0

d X (s) = ds

ˆ

˜

0−

ˆ

d x (t ) e − st dt = − tx (t ) e − st dt. ds −

˜

0

Therefore ˆ

d − X ( s ) = tx (t ) e − st dt. ds −

˜

0

The last equation simply says that

(tx (t )) ˛ − dsd X ( s ) . EOCE 5.15 What is L(x(t)/t) if limt→ 0[x(t)/t] exists? SOLUTION By defnition ˙

X (s) =

˜ x (t ) e

− st

dt.

0−

If we integrate both sides from s to ∞ we get 

˜ s

X ( s ) ds =



˘ ˙ ˇ x (t ) e − st dt  ds. ˇ  ˆ 0− 

˜˜ s

218

Continuous Signals and Systems with MATLAB®

By interchanging the integrals we get 

 

s

0− s

˜X ( s ) ds = ˜˜

˙ˆ x (t ) e − st ds ˇ˘ dt =





˙ e − st ˇ  x (t ) −t  dt ˆ ˘s 0−

˜

or 

˜

X ( s ) ds =

s



 x (t )  ˙ x (t ) − st ˘ e  dt = L  , t  t   −

˜ ˇˆ

0

and fnally 

˝ x (t ) ˇ Lˆ  X ( s ) ds. ˙ t ˘

˜ s

EOCE 5.16 ˛ sin (t ) u (t ) ˆ What is L ˙ ˘ˇ ? t ˝ SOLUTION Using EOCE 5.15 we can write

(

˙

)

˜(

)

L sin (t ) u (t ) /t = L sin (t ) u (t ) ds, s

which simplifes to

(

)

L sin (t ) u (t ) /t =

ˆ

˜s s

2

1 ds = tan−1 ( s ) +1

ˆ s

,

and fnally

(

)

L sin (t ) u (t ) /t =

˝ − tan−1 ( s ) = cot −1 ( s ) . 2

EOCE 5.17 Consider the following output in the s-domain Y (s) =

1 ˆ s 3 + 4s 2 − 2s − 2

What are the initial and the fnal values of y(t)? Is the system stable?

219

The Laplace Transform and Linear Systems SOLUTION

We will give the solution in the time domain frst. We will use MATLAB to do partial fraction expansion and write the script num = [1]; den = [1 4 −2 −2]; [R, P, K] = residue (num, den)

The output is R = 0.0499 0.1364 −0.1864 P = −4.3539 0.8774 −0.5235 K = [ ]

Therefore Y (s) =

0.049 0.1364 0.1864 + − . s + 4.3539 s − 0.8774 s + 0.5235

K has no values. It will have values when the order of the numerator is greater than or equal to the order of the denominator. We can use the Laplace transform table to inverse transform Y(s) to get y(t) as y (t ) = 0.049e −4.3539tu (t ) + 0.1364e 0.8774tu (t ) − 0.1864e 0.5235tu (t ) . We notice that this output is unstable because one of the poles of the system is positive. As t approaches ∝, y(t) approaches ∝ and this indicates that we have a positive pole. As t approaches zero, y(0) = 0.049 + 0.1364 − 0.1864 = −0.001. In the s-domain, we can see that one of the poles is positive and that indicates instability. We cannot use the fnal value theorem to fnd y(∝) because one of the poles is positive.

EOCE 5.18 What is the Laplace transform of the signal x(t) that is periodic with period T on the interval [0 ∝]? SOLUTION Using the defning integral again we can write

(

)

ˇ

˜

T

2T

3T

0

T

2T

˜

˜

˜

L x (t ) = x (t ) e − st dt = x (t ) e − st dt + x (t ) e − st dt + x (t ) e − st dt + … 0−

220

Continuous Signals and Systems with MATLAB®

Let t = P in the frst integral, t = P + T in the second integral, t = P + 2T in the third integral, and so on, to get

(

ˆ

)

T

˜

T

˜

˜

L x (t ) = x (t ) e − st dt = x ( p ) e − st dp + x ( P + T ) e − s(P +T )dP 0−

0

0

T

˜

+ x ( P + 2T ) e − st (P + 2T )dP + … 0

Using the fact that x(P + T) = x(P), we get

(

T

)

˜

L x (t ) = x ( P ) e

T

− sP

dP + e

− sT

0

˜ x (P + T ) e

− s (P )

dP

0

T

˜

+e −2sT x ( P + 2T ) e − s(P )dP + … 0

(

)

T

T

˜

˜

L x (t ) = x ( P ) e − sP dP + e − sT x ( P ) e − s(P )dP 0

0

T

˜

+e −2sT x ( P ) e − s(P )dP + … 0

And by taking the common terms we arrive at

(

T

)

˜

L x (t ) = ˆˇ1+ e − sT + e −2sT + ˘ x ( P ) e − s(P )dP. 0

Also 1+ e − sT + e −2sT + e −3sT +  is a geometric series and can be written as the summation 1 . 1− e − sT Then T

ˆ 1  L x (t ) = ˘ x ( P ) e − s(P )dP. − sT ˇ 1+ e 

(

)

˜ 0

The Laplace Transform and Linear Systems

221

EOCE 5.19 Consider the following system represented by the differential equation d2 d y (t ) + y (t ) + y (t ) = x (t ) . dt dt Assume zero initial conditions and plot the output y(t) vs. time for a step and an impulse input x(t). Is the system stable? What are the fnal and the initial values of y(t) when the input is step, impulsive, and ramp? SOLUTION We can use MATLAB to fnd y(t). First, we need to fnd the transfer function that relates the input to the output. To do that we take the Laplace transform of the given differential equation with a general input x(t) to get s 2Y ( s ) + sY ( s ) + Y ( s ) = X ( s ) . Taking Y(s) as the common factor gives Y ( s ) ˝˙ s 2 + s + 1ˇˆ = X ( s ) , and the transfer function is Y (s) 1 = H (s) = 2 ˙ X (s) s + s +1 At this point, we can fnd the output y(t) for any input x(t) by inverse transforming Y (s) = H (s) X (s) into its time domain. Notice that H(s) is a ratio of two polynomials. To fnd the response (output) due to a step input, we type the following MATLAB script. num = [1]; den = [1 1 1]; step (num, den)

The output plot is shown in Figure 5.15. To fnd the output due to an impulsive input x(t), we type the following MATLAB script. num = [1]; den = [1 1 1 ]; impulse (num, den)

The output is shown in Figure 5.16.

222

FIGURE 5.15 Plot for EOCE 5.19.

FIGURE 5.16 Plot for EOCE 5.19.

Continuous Signals and Systems with MATLAB®

223

The Laplace Transform and Linear Systems

To fnd the output if the input is tu(t) = x(t), we need to fnd Y(s) if x(t) = tu(t), because MATLAB does not have a function to calculate a ramp response as we saw for the step and the impulse inputs. In this case, for x(t )˜ = ˜tu(t ) we have X (s) =

1 ˝ s2

The output Y(s) becomes Y (s) = H (s) X (s) =

1 1 ˜ ˙ s2 s2 + s + 1

If we write Y(s) as Y (s) =

1 1 ˜ , s3 + s 2 + s s

we can use the step response function to calculate the ramp response by writing this script num = [1]; den = [1 1 1 0]; [y, t] = step (num, den); Plot (y); xlabel (‘Time (sec)’), ylabel (‘Amplitude’) title (‘Response when x(t) = tu(t)’);

with the plot shown in Figure 5.17. It can be seen from the graphs that for the step response the initial value is 0 and the fnal value will approach 1. For the impulsive input, the initial value is 0 and the fnal value approaches 0 as well. For the ramp input the initial value is 0 and the fnal value approaches ∝. We could use the fnal and the initial value theorems to confrm the above statements. For the step input the output is 1 1 Y (s) = ˜ 2 ˙ s s + s +1 And using the initial value theorem, we can fnd the initial value of the output as 1 ˝ 1 ˇ = 0 = y (0) . limit s˜ ˜  ˆ s ˜ 2 ˙ s s + s + 1˘ We can use the fnal value theorem to calculate the fnal value of the output as 1 ˝ 1 ˇ limit s˜˜0 ˆ s ˜ 2 = 1= y () . ˙ s s + s + 1˘

224

Continuous Signals and Systems with MATLAB®

FIGURE 5.17 Plot for EOCE 5.19. For the impulsive input, the output is Y (s) =

1 ˙ s2 + s + 1

The initial value of the output is 1 ˝ ˇ limit s˜ ˜  ˆ s 2 = 0 = y (0) , ˙ s + s + 1˘ and the fnal value is 1 ˝ ˇ limit s˜˜0 ˆ s˜ 2 = 0 = y (). ˙ s + s + 1˘ For the ramp input, the output is Y (s) =

1 1 ˜ ˙ s2 s2 + s + 1

The initial value of y(t) is 1 ˝ 1 ˇ = 0 = y (0) , limit s˜ ˜  ˆ s˜ 2 ˜ 2 ˙ s s + s + 1˘

The Laplace Transform and Linear Systems

225

and its fnal value is 1 ˝ 1 ˇ =  = y (). limit s˜˜0 ˆ s˜ 2 ˜ 2 ˙ s s + s + 1˘ To discuss stability of the system, we look at the roots of the denominator of H(s) using MATLAB and type the following command at the MATLAB prompt. poles = roots ([1 1 1])

The poles are poles = −0.5000 + 0.8660i −0.5000 − 0.8660i

We observe that the roots are complex, but the real parts of the roots are negative and this indicates stability of the system represented by H(s).

EOCE 5.20 Consider the following systems: s3 + s s + s2 + 1

H (s) =

3

and H (s) = 1. 2. 3. 4.

s2 + s + 1 ˙ s + 4s 2 + 3s 3

Find the impulse response of each system. Discuss stability for each system. Draw the block diagram for each system. Find the fnal value and the initial value for y(t) when the input is an impulse.

SOLUTION For the frst system we write the script EOCE5_201 script with the output as poles_sys1 = –1.4656 0.2328 + 0.7926i 0.2328 − 0.7926i

and the output showing the impulse response is shown in Figure 5.18.

226

Continuous Signals and Systems with MATLAB®

FIGURE 5.18 Plot for EOCE 5.20.

We can see from MATLAB that the real parts of the poles are positive and this indicates instability. It is also seen that the fnal value of y(t) is ∝. The initial value of y(t) can be calculated from the expression for Y(s), Y ( s ) =˜

s3 + s ˙ s + s2 + 1 3

The initial value is then ˝ s3 + s ˇ limit s ˜ ˜  ˆ s 3  =  = y () , 2 ˙ s + s + 1˘ and the fnal value is ˝ s3 + s ˇ limit s ˜ ˜ 0 ˆ s 3  = 0 = y () , 2 ˙ s + s + 1˘ which contradicts the results from Figure 5.18. The reason is that one of the poles of sY(s) is positive. The exact values can be calculated by solving for y(t) in the time domain and then taking the limits to fnd the initial and fnal values for y(t).

The Laplace Transform and Linear Systems

227

FIGURE 5.19 Block diagram for EOCE 5.20. The block diagram representing the frst system is sketched in Figure 5.19. The block diagram in Figure 5.19 was drawn with the help of the example presented in this chapter. For the second system we type EOCE5_202 script with the output poles_sys2 = 0 −3 −1

and with the impulse response as shown in Figure 5.20.

FIGURE 5.20 Plot for EOCE 5.20.

228

Continuous Signals and Systems with MATLAB®

FIGURE 5.21 Block diagram for EOCE 5.20. We can see from MATLAB that the poles are negative and this indicates stability. The initial and fnal values of y(t) can be calculated by frst looking at the expression Y (s) =

s2 + s + 1 ˙ s + 4s 2 + 3s 3

The initial value for y(t) is ˝ s2 + s + 1 ˇ limit s ˜ ˜ ˆ s 3  = 1 = y (0) , 2 ˙ s + 4s + 3s ˘ and the fnal value is ˝ s2 + s + 1 ˇ limit s ˜ 0 ˜ ˆ s 3  = 1/3 = y (  ) . 2 ˙ s + 4s + 3s ˘ You can see that the results from the graphs agree with the results using the initial and the fnal value theorem, since all the eigenvalues of sY(s) are negative. The block diagram representing the second system is sketched in Figure 5.21.

EOCE 5.21 Consider the system in Figure 5.22. If the impulse response is h1 (t ) = e −tu (t ) = h2 (t ) , what is the output y(t) if x(t) = u(t)? Find the fnal and initial values of y(t) and discuss stability. SOLUTION x(t) will propagate through the system in Figure 5.22. In the block diagram and between h1(t) and h2(t), we can use convolution to write z (t ) = x (t ) * h1 (t ) .

The Laplace Transform and Linear Systems

229

FIGURE 5.22 System for EOCE 5.21.

At the output we write y (t ) = z (t ) * h2 (t ) . Taking the Laplace transform of the last two equations we get Z ( s ) = X ( s ) * H1 ( s ) and Y ( s ) = Z ( s ) * H2 ( s ) . Substituting Z(s) in Y(s) we get Y ( s ) = X ( s ) H1 ( s ) H2 ( s ) and H ( s ) = H1 ( s ) H2 ( s ) . Therefore, we have 1 1 1 1 Y (s) = ˜ ˜ = ˙ s s + 1 s + 1 s 3 + 2s 2 + s We can use MATLAB to solve for y(t) with H (s) =

1 , s 2 + 2s + 1

and by using the script to get poles_of_H = −1 −1

The plot is shown in Figure 5.23. From the plot you can see that the initial value of y(t) is 0 and the fnal value of y(t) is 1. We also can see that the system is stable (it settles at a fnal magnitude of 1).

230

Continuous Signals and Systems with MATLAB®

FIGURE 5.23 Plot for EOCE 5.21. These observations can be confrmed mathematically by looking at the poles of H(s) that are all negative and, therefore, an indication of stability. Also the initial and fnal values for y(t) can be calculated by using the expression for the output 1 1 Y (s) = ˜ 2 ˙ s s + 2s + 1 The initial value is 1 ˝ 1 ˇ limit s ˜ ˜  ˆ s ˜ 2 = 0 = y (0) , ˙ s s + 2s + 1˘ and the fnal value is 1 ˝ 1 ˇ limit s ˜ ˜0 ˆ s ˜ 2 ˘ = 1 = y (  ) . s s + + 2s 1 ˙

EOCE 5.22 Consider the system in Figure 5.24. If the impulse response is given by

The Laplace Transform and Linear Systems

231

FIGURE 5.24 System for EOCE 5.22. h1 (t ) = e −tu (t ) = h2 (t ) = h3 (t ) , what is the output y(t) if x(t) = u(t)? Find the fnal and initial values of y(t) and discuss stability. SOLUTION x(t) will propagate through the system in Figure 5.24. In the block diagram, and between h1(t) and h2(t), we can use convolution to write z1 (t ) = x (t ) * h1 (t ) . Taking the Laplace transform we have Z1 ( s ) = X ( s ) H1 ( s ) . Before the summer and at the lower part of the block in Figure 5.24 we also have z2 (t ) = x (t ) * h3 (t ) and its transform Z2 ( s ) = X ( s ) H3 ( s ) . Before the summer and at the upper part of the block we have z3 (t ) = z1 (t ) * h2 (t ) with its transform Z3 ( s ) = Z1 ( s ) H2 ( s ) . At the output we write y (t ) = z2 (t ) + z3 (t )

232

Continuous Signals and Systems with MATLAB®

or Y ( s ) = Z2 ( s ) + Z3 ( s ) = X ( s ) H3 ( s ) + X ( s ) H1 ( s ) H2 ( s ) ; and fnally, the transfer function of the system is H ( s ) = H3 ( s ) + H1 ( s ) H2 ( s ) , where H (s) =

1 1 1 s+2 + ˜ = s + 1 s + 1 s + 1 s 2 + 2s + 1

and the output Y (s) = X (s) H (s) , or 1 s+2 Y (s) = ˜ 2 ˙ s s + 2s + 1 Now we are ready to use the MATLAB EOCE5_22 script with the output as poles_of_H = −1 −1

The step response is shown in Figure 5.25. From the plot you can see that the initial value of y(t) is 0 and the fnal value of y(t) is 2. We also can see that the system is stable (it settles at a fnal magnitude of 2). These observations can be confrmed mathematically by looking at the poles of H(s), which are all negative, which is an indication of stability. Also, the initial and fnal values for y(t) can be calculated with the output written in the Laplace domain as 1 s+2 Y (s) = ˜ 3 ˙ s s + 2s + 1 The initial value of y(t) is s+2 ˇ ˝ 1 = 0 = y (0) , limit s ˜ ˜  ˆ s˜ ˜ 3 ˙ s s + 2s + 1˘ and the fnal value is s+2 ˇ ˝ 1 = 2 = y () . limit s ˜ ˜0 ˆ s˜ ˜ 3 ˙ s s + 2s + 1˘

The Laplace Transform and Linear Systems

FIGURE 5.25 Plot for EOCE 5.22.

5.14

END-OF-CHAPTER PROBLEMS

EOCP 5.1 Find the Laplace transform for each of the following signals. 1. 2u ( t − 10 ) + 10˙ ( t − 1)

2. sin ( 2 ( t − 1)) u ( t − 1)

3. cos ( 3( t − 5)) u ( t − 5)

4. e −a(t −b )u ( t − b ) + u ( t − 2 ) 5. ( t − 1) e −a(t −1)u ˜( t − 1) 6. 10e −2(t −2) u ( t − 2 ) 2

7. 2˛ ( t − 2 ) + 3˛ ( t − 4 ) 8. e −3t u ( t ) +

t 5 −10t e u ( t ) + u ( t − 5) 5!

233

234

Continuous Signals and Systems with MATLAB®

EOCP 5.2 Find the Laplace transform of the derivative for each of the following signals. 1. tu ( t ) 2. tsin(t )u(t )

( ) 4. ( cos(wt ) + sin (wt ) ) u(t )˜ + ˜10u(t ) 3. e −3t ˜ + sin ( t ) u ( t )

EOCP 5.3 Find the Laplace transform for each of the following signals, where * indicates convolution. 1. e −t u ( t ) * e −t u ( t ) 2. [ sin˜( t ) u ( t ) * u ( t )] * u ( t ) −t −2t 3. ˝e ˙ u ( t ) + e u ( t ) ˇˆ * sin ( t ) u ( t )

4. e −3t u ( t ) * u ( t )] + u ( t ) * u ( t )

5. ˛ ( t ) * sin (10t ) u ( t ) − ˛ ( t − 1) * u ( t )

EOCP 5.4 Consider the following systems represented by the differential equations. x(t) is the input, and y(t) is the output. Find the total solution. 1.

d y + 2y = sin ( t ) u ( t ) , dt

2.

d2 d y + 3 y + 2y = u ( t ) , dt dt

3.

d2 d y + 3 y = e −t u ( t ) , dt dt

4.

d2 y + 5y = e −t u ( t ) , dt

5.

d2 d y + y + y = ˙ (t ) , dt dt

y(0) = 1 ˜ y ( 0 ) = 2, y ( 0 ) = −1, y ( 0 ) = 0, y ( 0 ) = 2,

d y(0) = 0 dt d y(0) = 1 dt

d y ( 0 ) = −3 dt d y(0) = 1 dt

The Laplace Transform and Linear Systems

235

EOCP 5.5 Given the following Laplace transforms for some signals, what are the time-domain signals? 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

1 1 + s + 2 s + 3˜ 1 s 2 + 7s + 10 1 s 2 + 5s + 6 1 s 2 + 4s + 4 e −s s 2 s + 4s + 4 e −s s + s s 2 + 4s + 4 s s 2 + 7s + 10 s2 s 2 + 7s + 10 s3 + 1 s 2 + 7s + 10 s3 + s 2 + 1 s 2 + 7s + 10

EOCP 5.6 Use the Laplace transform to fnd y(t), a particular solution, in each of the systems shown in Figures 5.26–5.30.

FIGURE 5.26 System for EOCP 5.6.

FIGURE 5.27 System for EOCP 5.6.

236

Continuous Signals and Systems with MATLAB®

FIGURE 5.28 System for EOCP 5.6.

FIGURE 5.29

System for EOCP 5.6.

FIGURE 5.30 System for EOCP 5.6.

EOCP 5.7 What is the Laplace transform for each of the signals shown in Figures 5.31–5.34?

FIGURE 5.31 Signal for EOCP 5.7.

237

The Laplace Transform and Linear Systems

FIGURE 5.32 Signal for EOCP 5.7.

FIGURE 5.33 Signal for EOCP 5.7.

x(t)

2 1

3

4

t

–1

FIGURE 5.34

Signal for EOCP 5.7.

EOCP 5.8 Use the series and parallel models to draw the block diagram for each transfer function. 10 s −4 10 2. 2 2s − 32 1.

2

238

Continuous Signals and Systems with MATLAB®

1 s 3 + s 2 − 9s − 9 s +1 4. 2 s + s − 20 s2 + s + 1 5. 3 s + 3s 2 − s + 3 3.

EOCP 5.9 Draw the block diagram using integrators, summers, and gain blocks for each of the following systems: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

s s +1 2s + 1 s −1 2s 2 + s + 1 s2 − 1 1 s 2 + 2s + 10 s s ( s + 1) 100 2s2 − 4 10 3s 2 − 16 10 2 3s + 2s 2 − 9s − 9 s2 + s + 1 s 2 + s − 20 s2 + s + 1 5s 2

EOCP 5.10 Find the initial and fnal values for each system using the fnal and the initial value theorem when applicable. 1.

d2 d y ( t ) + 3 y ( t ) + 4y ( t ) = e −t u ( t ) dy dt

2.

d2 d y ( t ) + 3 y ( t ) − 4y ( t ) = sin ( t ) u ( t ) dy dt

The Laplace Transform and Linear Systems

3.

d3 d y ( t ) + 3 y ( t ) + 4y ( t ) = e −2t u ( t ) dy dt

4.

d d3 y ( t ) − y ( t ) = cos ( t ) u ( t ) dy dt

5.

d2 d d3 y (t ) + y (t ) + y (t ) = u (t ) y (t ) + dy dt dt

239

EOCP 5.11 Consider the circuit in Figure 5.35. 1. Find the output voltage y(t), for t > 0, using the Laplace transform method. Assume that 10 volts are applied at t = 0 seconds. 2. Find the current in the resistor R using the Laplace method.

EOCP 5.12 Consider the mechanical system described by the differential equation and shown in Figure 5.36. M

d d2 y ( t ) + B y ( t ) + ky ( t ) = x ( t ) dt dt

The rod to the left of the mass M can be modeled by a translational spring with spring constant k in parallel with a translational damper of constant B. 1. If x(t) is an impulse of strength 10, use the Laplace transform method to fnd the displacement y(t). Assume no friction and no stored energy. 2. Repeat if x(t) is a sinusoidal shaking of magnitude 10 and period 1 second.

FIGURE 5.35 Circuit for EOCP 5.11.

240

Continuous Signals and Systems with MATLAB®

FIGURE 5.36 System for EOCP 5.12.

EOCP 5.13 Consider the circuit in Figure 5.37. 1. If the 10 volts are applied at t = 0 seconds, fnd y(t) using the Laplace transform method. 2. Repeat part 1 but calculate the current in the capacitor. 3. Draw a block diagram of the system using the basic blocks. 4. What are the fnal and the initial values of the output y(t) and the current in the capacitor?

EOCP 5.14 Consider the mechanical system described in Figure 5.38. The masses were initially displaced. The rod to the left of the mass M1 can be modeled by a translational spring with spring constant k1. The rod to the right of the mass M1 can be modeled by a translational spring with spring constant k2. The rod to the right of the mass M2 can be modeled by a translational spring with spring constant k3. Both masses M1 and M2 move smoothly on the fxed surfaces.

FIGURE 5.37 Circuit for EOCP 5.13.

The Laplace Transform and Linear Systems

FIGURE 5.38

241

System for EOCP 5.14.

The two differential equations describing the system are M1

d2 y1 + k1 y1 + k2 y1 − k2 y2 = 0 dt

M2

d2 y2 − k2 y1 + k2 y2 + k3 y2 = 0. dt

1. Use the Laplace transform method to fnd the outputs, y1(t) and y2(t). 2. Draw the block diagram for the entire system.

EOCP 5.15 Consider the dynamic system shown in Figure 5.39 and represented by the differential equation M

d d2 y ( t ) + ( B1 − B2 ) y ( t ) + ( k1 − k2 ) y ( t ) = x ( t ) . dt dt

The rod to the left of the mass M can be modeled by a translational spring with spring constant k1, in parallel with a translational damper of constant B1. The rod to

FIGURE 5.39 System for EOCP 5.15.

242

Continuous Signals and Systems with MATLAB®

the right of the mass M can be modeled by a translational spring with spring constant k2, in parallel with a translational damper of constant B2. The mass M moves freely on the fxed surface. 1. Draw the block diagram for the system. 2. Find the displacement y(t) if a. x(t) is an impulse of unity magnitude b. x(t) is a unit step force 3. Find the initial and the fnal values for y(t). 4. Find the initial and the fnal values for the velocity of the mass M.

EOCP 5.16 Consider the dynamic system as represented by the differential equation below and shown in Figure 5.40.

J

d2 ˛ ( t ) + k˛ ( t ) = T ( t ) dt

This is a rod attached to a fxed end. Assume that the rod can be represented as a rotational spring with spring constant k, and the mass of the rod is concentrated and modeled by the moment of inertia J. 1. Draw the block diagram representing the system. 2. If the torque is represented as a unit step signal, what is the angular rotation in radians? 3. Find the fnal and the initial values for θ(t).

FIGURE 5.40 System for EOCP 5.16.

The Laplace Transform and Linear Systems

243

FIGURE 5.41 System for EOCP 5.17.

EOCP 5.17 A dynamic system is given in Figure 5.41. The differential equations representing the system are d 1 ˙ 1 ˘ T1 = x ( t ) − ( T1 − T2 ) ˇ dt C1 ˆ R1  d 1 ˙1 1 ˘ T2 = ( T1 − T2 ) − ( T2 − T ) , dt C2 ˆˇ R1 R2  where T1 and T2 are the temperatures in the two containers as indicated in Figure 5.41. C1 and C2 represent the capacitance in each container. R1 and R2 are the resistances of the two separators. 1. Draw the block diagram for the system. 2. If x(t) is a unit step fow of unity magnitude, what are the temperatures T1(t) and T2(t)?

REFERENCES Bequette, B.W. Process Dynamics, Englewood Cliffs, NJ: Prentice-Hall, 1998. Brogan, W.L. Modern Control Theory, 3rd ed., Englewood Cliffs, NJ: Prentice-Hall, 1991. Close, M. and Frederick, K. Modeling and Analysis of Dynamic Systems, 2nd ed., New York, NY: Wiley, 1995. Cogdell, J.R. Foundations of Electrical Engineering, 2nd ed., Englewood Cliffs, NJ: PrenticeHall, 1996. Denbigh, P. System Analysis and Signal Processing, Reading, MA: Addison-Wesley, 1998. Driels, M. Linear Control System Engineering, New York, NY: McGraw-Hill, 1996. Golubitsky, M. and Dellnitz, M. Linear Algebra and Differential Equations Using MATLAB, Stamford, CT: Brooks/Cole, 1999. Harman, T.L., Dabney, J., and Richert, N. Advanced Engineering Mathematics with MATLAB, Stamford, CT: Brooks/Cole, 2000. Kuo, B.C. Automatic Control System, 7th ed., Englewood Cliffs, NJ: Prentice-Hall, 1995. Lewis, P.H. and Yang, C. Basic Control Systems Engineering, Englewood Cliffs, NJ: Prentice-Hall, 1997. Moore, H. MATLAB for Engineers, Upper Saddle River, NJ: Prentice-Hall, 2007.

244

Continuous Signals and Systems with MATLAB®

Nilson, W.J. and Riedel, S.A. Electrical Circuits, 6th ed., Englewood Cliffs, NJ: Prentice-Hall, 2000. Nise, N.S. Control Systems Engineering, 2nd ed., Reading, MA: Addison-Wesley, 1995. Ogata, K. Modern Control Engineering, 3rd ed., Englewood Cliffs, NJ: Prentice-Hall, 1997. Ogata, K. System Dynamics, 3rd ed., Englewood Cliffs, NJ: Prentice-Hall, 1998. Phillips, C.L. and Parr, J.M. Signals, Systems, and Transforms, 2nd ed., Englewood Cliffs, NJ: Prentice-Hall, 1999. The MathWorks. The Student Edition of MATLAB, Englewood Cliffs, NJ: Prentice-Hall, 1997. Woods, R.L. and Lawrence, K.L. Modeling and Simulation of Dynamic Systems, Englewood Cliffs, NJ: Prentice-Hall, 1997. Wylie, R.C. and Barrett, C.L. Advanced Engineering Mathematics, 6th ed., New York, NY: McGraw-Hill, 1995. Ziemer, R.E., Tranter, W.H., and Fannin, D.R. Signals Systems Continuous and Discrete, 4th ed., Englewood Cliffs, NJ: Prentice-Hall, 1998.

6

State-Space and Linear Systems

6.1 INTRODUCTION As the interest in many scientifc felds increased, modeling systems using linear time-invariant differential equations and tools like transfer functions were not adequate. The state-space approach is superior to other classical methods of modeling. This modern approach can handle systems with nonzero initial conditions (modeling using transfer functions requires that initial conditions be set to zero), as well as time-variant systems. It can also handle linear and nonlinear systems. Up to this point, we have been considering systems with single-input/single-output. The statespace approach can handle multiple-input multiple-output systems. The state-space approach can also be used to represent or model linear timeinvariant single-input/single-output systems. These are the systems we considered in the previous chapters. Systems can have many variables. An example is an electrical circuit where the variables are the inductor current, the capacitor voltage, and the resistor voltage, among others. Using the state-space approach, we will use differential equations to solve for a selected set of these variables. The other variables in the circuit system can be found using the solution for the selected variables. In using the state-space approach, we will follow the procedure detailed below. We will select specifc variables in the system and call them state variables. No state variable selected can be written as a linear combination of the other state variables. Linear combination means that if z1 ( t ) = 3z3 ( t ) + 2z2 ( t ) where z1(t), z2(t), and z3(t) are state variables, we say that z1(t) is a linear combination of z2(t) and z3(t). If we have a frst-order differential equation, we will have only one state variable. If the differential equation is second-order, we will have only two state variables. Similarly, if we have an nth-order differential equation, we will have only n state variables. Once we select or decide on the state variables in the system under consideration, we will write a set of frst-order simultaneous differential equations, where the right side of these equations is a function only of the state variables (no derivatives) and the inputs to the system, and the number of these equations is determined by the number of state variables selected. We will call this set the state equations set. These state equations will be solved for the selected state variables. All other variables in the system under consideration can be solved using the solutions of these selected state variables and the input to the system. We can use any approach we desire to solve for these selected states. The equations we write to fnd the other variables in the system are called output equations. 245

246

6.2

Continuous Signals and Systems with MATLAB®

A REVIEW OF MATRIX ALGEBRA

What follows is a brief review of some of the concepts and defnitions we need in this chapter. We will discuss second-order systems when we deal with hand solutions. For matrices of higher dimensions you can consult any linear algebra book.

6.2.1 DEFINITION, GENERAL TERMS, AND NOTATIONS A matrix is a collection of elements arranged in a rectangular or square array. The size of the matrix is determined by the number of rows and the number of columns in the matrix. A matrix A of m rows and n columns is represented as Am×n. If m = 1 then A is a row vector and written as A1×n. If n = 1 then A is a column vector and written as Am×1. If n = m then A is a square matrix and we write it as An×n or Am×m. If all elements in the matrix are zeros we say A is a null matrix or a zero matrix.

6.2.2 THE IDENTITY MATRIX The identity matrix is the square matrix, where elements along the main diagonal are ones and elements off the main diagonal are zeros. A 2 × 2 identity matrix is ° 1 I 2× 2 = ˝ ˛ 0

0 ˙ . 1 ˇˆ

(6.1)

6.2.3 ADDING TWO MATRICES If ° a A=˝ ˛ c

b ˙ d ˇˆ

° e B=˝ ˝˛ g

f ˙ ˇ, h ˇ ˆ

and

then ˛ a+e A+ B = ˙ c+g ˝˙

b+ f ˆ ˘. d+h ˘ ˇ

(6.2)

To add two matrices they must be of the same size. If the matrices are of higher order, the procedure is the same; we add the corresponding entries.

247

State-Space and Linear Systems

6.2.4

SUBTRACTING TWO MATRICES

If ° a A=˝ ˛ c

b ˙ d ˇˆ

° e B=˝ ˝˛ g

f ˙ ˇ, h ˇ ˆ

and

then ˛ a−e A− B = ˙ c−g ˝˙

b− f ˆ ˘. d−h ˘ ˇ

(6.3)

To subtract two matrices they must be of the same size. If the matrices are of higher order, the procedure is the same; we subtract the corresponding entries.

6.2.5 MULTIPLYING A MATRIX BY A CONSTANT If ° a A=˝ ˛ c

b ˙ d ˇˆ

and k is any given constant, then ˜ a k˛ ° c

b ˝ ˜ ka = d ˆ˙ ˛° kc

kb ˝ . kd ˆ˙

(6.4)

If the matrix A is of higher order, then k is multiplied by each entry in A.

6.2.6 DETERMINANT OF A 2 × 2 MATRIX Consider the A2×2 matrix ° a A2× 2 = ˝ ˛ c

b ˙ d ˇˆ

The determinant of A is det ( A ) = ad − bc.

(6.5)

248

Continuous Signals and Systems with MATLAB®

6.2.7 TRANSPOSE OF A MATRIX If ° a A=˝ ˛ c

b ˙ , d ˇˆ

then the transpose of A is given by ° a AT = ˝ ˛ b

c ˙ . d ˇˆ

(6.6)

This works for higher order matrices as well, where the frst column in A becomes the frst row in AT and so on.

6.2.8

INVERSE OF A MATRIX

If ° a A=˝ ˛ c

b ˙ , d ˇˆ

then the inverse of A is A−1 =

and since

1 ˛ d ˙ ad − bc ˝ −c

−b ˆ , a ˘ˇ

1 is a constant, we can write the inverse as ad − bc ˛ d ˙ ad − bc A−1 = ˙ −c ˙ ˙ ad − bc ˝

−b ad − bc a ad − bc

ˆ ˘ ˘. ˘ ˘ ˇ

(6.7)

The inverse of a square matrix exists if the determinant of the matrix is not zero. Also, to fnd an inverse of a certain matrix, that matrix has to be square. The procedure above for fnding the inverse is only for a 2 × 2 matrix. For higher order matrices, the procedure is different and is found in any linear algebra book.

6.2.9

MATRIX MULTIPLICATION

We can multiply two matrices A and B if the number of columns in A is equal to the number of rows in B.

249

State-Space and Linear Systems

If Am×n is to be multiplied by Br×p then n must be equal to r and the resulting matrix should have m rows and p columns. If ° a A=˝ ˛ c

b ˙ d ˇˆ

° e B=˝ ˝˛ g

f ˙ ˇ h ˇ ˆ

and

then if we multiply A by B and let matrix C hold the resulting product. The size of C is 2 × 2. We could multiply A by B because the number of columns in A, which is two, is equal to the number of rows in B, which is also two. The multiplication of A by B is C and it is ° a C = AB = ˝ ˛ c

b ˙° e ˝ d ˇˆ ˝ g ˛

˛ ae + bg C = AB = ˙ ˙˝ ce + dg

f ˙ ˇ h ˇ ˆ

af + bh ˆ ˘. cf + dh ˘ ˇ

(6.8)

We multiply the frst row of A, element by element, by all the columns of B. Similarly, we take the second row of A and multiply it by all the columns of B. Note that in general AB is not the same as BA. The rules for multiplication have to be observed.

6.2.10

DIAGONAL FORM OF A MATRIX

A matrix A is in diagonal form if all elements in the matrix that are off the diagonal are zeros. If A is not diagonal, we can make it diagonal by fnding the matrix P that contains the eigenvectors of A. So if A is not a diagonal matrix, then (P −1AP) will transform A into a diagonal matrix.

6.2.11

EXPONENT OF A MATRIX

If A is a square matrix and t is a time variable, then e At = I + At +

( At )2 ( At )3 ( At )4 2!

+

3!

+

where I is the identity matrix with the same size as A.

4!

+

(6.9)

250

Continuous Signals and Systems with MATLAB®

If ° a A=˝ ˛ 0

0 ˙ , b ˆˇ

a diagonal matrix, then ° e at e At = ˝ ˛˝ 0

0 e bt

˙ ˇ. ˇˆ

This is true for matrices of bigger sizes, provided that A is a diagonal matrix. If ° 0 A=˝ ˛ 0

0 ˙ , 2 ˇˆ

a diagonal matrix also, then ° e 0t = 1 e At = ˝ 0 ˝˛

˙ 0 ˇ. 2t e ˇˆ

6.2.12 A SPECIAL MATRIX Let ° 0 A=˝ ˛ 0

a ˙ , 0 ˆˇ

then ° 0 A2 = ˝ ˛ 0

a ˙° 0 ˜ 0 ˇˆ ˝˛ 0

a ˙ ° 0 = 0 ˇˆ ˝˛ 0

and ° 0 A3 = ˝ ˛ 0

0 ˙ . 0 ˇˆ

A4, A5, and so on will have the same value as A2.

0 ˙ , 0 ˇˆ

251

State-Space and Linear Systems

6.2.13 OBSERVATION Let ° a A=˝ ˛ 0

b ˙ . a ˆˇ

A can be written as ° a A=˝ ˛ 0

0 ˙ ° 0 + a ˆˇ ˛˝ 0

b ˙ 0 ˆˇ

and

( At )

e

e

( At )

=e =e

˝ a ˆ ˙ 0

b ˇ t a ˘

˝ a ˆ ˙ 0

0 ˇ ˝ 0 t ˆ a ˘ ˙ 0

=e

 ˝ a ˆ  ˙ 0

e

0 ˇ ˝ 0 + ˆ a ˘ ˙ 0

b ˇ  t 0 ˘ 

b ˇ  t. 0 ˘

But as we saw earlier, if A is a matrix with all zeros except for the upper right element, then e(At) = I + (At). Knowing this we can fnish evaluating the above expression as ° e at e( At ) = ˝ ˛˝ 0

0 ˙  ° 1 ˇ ˝ e at ˇˆ  ˛ 0

° e at e( At ) = ˝ ˛˝ 0

0 e at

˙° 1 ˇ˝ ˇˆ ˛ 0

0 ˙ ° 0 + 1 ˇˆ ˝˛ 0

bt ˙   0 ˇˆ

bt ˙ , 1 ˇˆ

and fnally, ° e at e( At ) = ˝ ˝˛ 0

bte at ˙ ˇ. e at ˆˇ

The above result is very important when we solve state-space frst-order equations in real time.

6.2.14 EIGENVALUES OF A MATRIX The eigenvalues of a matrix A are the roots of the determinant of (λI − A), where I is the identity matrix and λ is a variable.

252

6.2.15

Continuous Signals and Systems with MATLAB®

EIGENVECTORS OF A MATRIX

The eigenvectors of a matrix A are the roots of the homogeneous matrix equation (˜I − A) p = 0, where p is a column vector that represents the eigenvector for a certain eigenvalue. Example 6.1 Consider the frst-order differential equation d y (t ) + 2y (t ) = x (t ) , dt where y(0 −) = 0, the initial condition for the output y(t). Let the input to this system be x(t) = u(t), a unit step input. Find the output y(t) for t ≥ 0. SOLUTION This is a frst-order differential equation and therefore we will have one state variable. Let us call that state variable z1(t). Next we let z1 (t ) = y (t ) , and then d d z1 (t ) = y (t ) . dt dt Rewriting the given differential equation as a function of the state variables we get d z1 = 2z1 + x, dt where again when we write x we mean x(t), the input to the system. In state-space representation we can write d z1 = 2z1 + x dt as d z = Az + Bx , dt

253

State-Space and Linear Systems where z,

d z, and x are vectors such that dt z = [ z1] ,

d ˝d ˇ z = ˆ z1  and˜ x = ˜[ x ]. dt ˙ dt ˘

A and B are matrices, where A = [2] and B = [1]. 1. The Laplace method We can use the Laplace transform to solve this last matrix differential equation by taking the Laplace transform of d z = Az + Bx dt and putting it in a simple algebraic equation in the variable s and write

( )

− ˆ ˝ ˙ sZ ( s ) − z 0 ˇ = AZ ( s ) + BX ( s ) ,

with z(0 −) = z1(0 −) = y (0 −) = 0 and X(s) = 1/s, since x(t) is a unit step input. Rearranging terms we get

( )

˛˝ sZ ( s ) ˆ˙ = AZ ( s ) + BX ( s ) + z 0 − , which is a Laplace representation of a frst-order single-input singleoutput system and therefore is one-dimensional. To take Z(s) as a common factor in the last equation, s Z(s) must be written as s I Z(s), where I is the 1 × 1 identity matrix. Now we write the last equation as

[ sI − A] Z ( s ) = BX ( s ) + z (0− ) . By multiplying the above equation by [sI − A]−1 to solve for Z(s), and substituting for the initial conditions we get

( )

Z ( s ) = [ sI − A] BX ( s ) + [ sI − A] z 0 − −1

−1

Z ( s ) = [ s − 2] X ( s ) + [ s − 2] −1

−1

[ 0 ].

Since [s − 2] is a 1 × 1 square matrix, its inverse is just its reciprocal. Therefore,

{

}

Z ( s ) = 1/ [ s − 2] X ( s ) . With X(s) = U(s), the unit step in the Laplace domain, U(s) = 1/s. Then

{

}

Z ( s ) = 1/ [ s − 2] {1/s} .

254

Continuous Signals and Systems with MATLAB® Using partial fraction expansion we have Z ( s ) = [1] / ˇs ˘ ( s − 2)  = [ −1/ 2] / [ s ] + [1/ 2] / [ s − 2]. Taking the inverse Laplace transform and solving for z(t) we get z (t ) = [ −1/ 2] u (t ) + [1/ 2] e 2tu (t ) , or z (t ) = 1/ 2 ˙ˆ e 2t − 1ˇ˘ u (t ) . z(t), which is a 1 × 1 column vector, is the same as y(t) as defned previously. 2. Real-time method If we have a differential equation of the form d y (t ) + ay (t ) = x (t ) dt with initial condition y(0) = y0, then the solution to this equation will have two parts: a solution due to the initial conditions with x(t) = 0, the homogeneous part, and a solution due to the input x(t), the particular solution. The solution due to the initial conditions will have the form y ic (t ) = y h (t ) = e −at y0 , and the solution due to the input x(t) involves the convolution integral t

˜

y p (t ) = e −a(t −˙ ) x ( ˙ ) d˙. 0

The state-space equation in this example is d z = Az + Bx , dt d d ˝d ˇ z, and x are vectors such that z = [ z1] , ˜z = ˆ z1  dt dt ˙ dt ˘ and x = [x]. A and B are matrices, where A = [2] and B = [1]. The total solution for where again,˜ z ,

d z = Az + Bx dt

255

State-Space and Linear Systems with the initial condition vector z(0 −) is t

˜

z (t ) = exp [ At ] z ( 0 ) + exp  A (t −  )  Bu (  ) d, t0

where t0 in our example is 0 and u(t) is unity in the range from zero to infnity. Notice that A is a 1 × 1 matrix and therefore is already in a diagonal form. Therefore, the solution with z(0 −) = 0 becomes t

t

˜

˜

z (t ) = exp 2 (t − ˘ )  d˘ = exp ( 2t ) exp [ −2˘ ] d˘ 0

0

z (t ) = exp ( 2t )

exp [ −2ˇ ] 1 = exp ( 2t ) ˘exp ( −2) − 1 , −2 −2 0 t

and fnally, z (t ) =

1 ˙exp ( 2t ) − 1ˇ˘ u (t ) , 2ˆ

which is the same solution we get using the Laplace transform technique. We really do not need to use the state-space approach to solve frst-order single-input single-output systems. This example is just to introduce you to the steps needed to deal with problems using the state-space approach. You will start to feel the power of the state-space approach with the following example.

Example 6.2 Consider the following single-input/single-output linear second-order differential equation d2 d y (t ) + 3 y (t ) + 2y (t ) = x (t ) dt dt with x(t) = u(t) and initial conditions

( )

( )

d y 0 − = y 0 − = 0. dt Find the output y(t) for t ≥ 0.

256

Continuous Signals and Systems with MATLAB® SOLUTION

In transforming this second-order differential equation into state-space form we need to defne two state variables, since the differential equation is given in second order. Let z1 = y (t ) and z2 =

d y (t ) . dt

Next, we take derivatives of the two states and write d d z1 = y (t ) dt dt and d d2 z2 = y (t ) . dt dt d Substituting for y(t) and y (t ) in the above state equations we get the state dt equations d z1 = z2 dt d z2 = −2z1 − 3z2 + x. dt These are the two simultaneous state equations. Putting them in state-space matrix form with x(t) = u(t), we get d z = Az + Bx , dz where

˙ 0 A= ˇ ˆ −2

˙ d z1 ˇ ˘ ˙ ˘ d 1 dt 0  ,˜B = ˇ  ,˜ z = ˇˇ −3  d ˆ 1  dt z2 ˇ ˆ dt

˘   ˜z = ˙ z1 ˘ ,˜and˜˜ x = [ x ]. ˇ   ˆ z2   

The frst row in A is obtained by reading the coeffcients of z1 and z2 in the frst state equation. The second row is obtained in a similar way. The frst row in B is

257

State-Space and Linear Systems

the coeffcient of the input x(t) in the frst state equation, and the second row is obtained similarly. 1. The Laplace method We now try to solve this matrix state equation using the Laplace transform approach. Taking the Laplace transform of the matrix state equation we get

( )

˝ sZ ( s ) − z 0 − ˆ = AZ ( s ) + BX ( s ) . ˙ ˇ z(0 −) = 0, where 0 is a vector of zeros (initial conditions vector). To take Z(s) as a common factor we need to write sZ(s) as sI Z(s), where I is the 2 × 2 identity matrix to get

[ sI − A] Z ( s ) = BX ( s ) + z (0− ) . [sI − A] is a 2 × 2 matrix. To solve for Z(s) we need to multiply the last equation by the inverse of [sI − A] and get

( )

Z ( s ) = [ sI − A] BX ( s ) + [ sI − A] z 0 − . −1

−1

Substituting for A, B, and z(0 −) we get  ˝ 1 Z ( s ) = s ˆ  ˙ 0

−1

−1 ˇ  ˝ 0 ˇ ˝ 1 ˇ .  ˆ  −3 ˘  ˙ 1 ˘ ˆ˙ s ˘

0 ˇ ˝ 0 −ˆ 1 ˘ ˙ −2

This last equation simplifes to ˆ s Z (s) = ˘ ˇ 2

−1

−1  ˆ 0   ˘ . s + 3  ˇ 1/s 

Finding the inverse and rewriting we get Z (s) =

ˆ s+3 1 ˘ s + 3s + 2 ˇ −2 2

1 ˆ 0  ˘  s  ˇ 1/s 

or ˆ s+3 ˘ 2 s + 3s + 2 Z (s) = ˘ ˘ −2 ˘ 2 ˇ s + 3s + 2

1 s 2 + 3s + 2 s s 2 + 3s + 2

 ˆ   ˘ 0 .  ˇ 1/s   

258

Continuous Signals and Systems with MATLAB® Finally, ˙ 1 ˇ 2 ˇ s s + 3s + 2 Z (s) = ˇ 1 ˇ 2 ˇ s + 3s + 2 ˆ

(

)

(

)

˘   .   

Using partial fraction expansion on the transfer function elements in the above matrix, we have ˙ a b c + + ˇ s s +1 s + 2 Z (s) = ˇ ˇ e f + ˇ s +1 s + 2 ˆ

˘  .   

which after calculating the constants gives ˆ 1/ 2 −1 1/ 2 + + ˘ s s + 1 s +2 Z (s) = ˘ ˘ 1 −1 + ˘ s +1 s + 2 ˇ

  .   

Taking the inverse Laplace transform of the above vector, we get

˝ Z1 (t ) z (t ) = ˆ ˆ Z 2 (t ) ˙

˝ ˇ ˆ 1 u (t ) − e −tu (t ) + 1 e −2tu (t ) =ˆ 2 2  ˆ e −tu (t ) − e −2tu (t ) ˘ ˙

ˇ  .  ˘

Our goal is to solve for y(t), the output of the system. In this example, y(t) d was assigned to the state variable z1 (t ) . y (t ) was assigned to the other dt state variable z (t). Therefore,

2

y (t ) =

1 1 u (t ) − e −tu (t ) + e −2tu (t ) 2 2

or 1 ˆ1  y (t ) = ˘ − e −t + e −2t  u (t ) . ˇ2  2

259

State-Space and Linear Systems 2. Real-time method The state-space equation is d z = Az + Bx, dt where

˙ 0 A= ˇ ˆ −2 ˙ z1 z=ˇ ˇˆ z2

˙ d z1 ˇ ˙ 0 ˘ d 1 ˘ dt z=ˇ , B = ˇ , ˇ d −3  ˆ 1  dt z2 ˇ ˆ dt

˘  ,   

˘  , and ˜ x = [ x ] , 

with z(t0) = z(0) = 0, and x(t) = u(t). The frst thing we do here is to notice that A is not in a diagonal form. Hence, we need to diagonalize it. Let us transform the whole system into a new system, where A is transformed into a diagonal matrix P−1AP. Let z = P w, where w is a new state vector. Take the derivative to get d d z = P w. dt dt By substituting in the state equation d z = Az + Bx , dt we get P

d w = APw + Bx dt

or d w = P −1APw + P −1Bx. dt Now this is a new state-space equation. The last equation is obtained by multiplying the equation that precedes it by P−1. The initial condition vector can be transformed into the new space by manipulating the equation z = Pw. Evaluating this equation at t = 0 and multiplying it by P−1 we arrive at w ( 0 ) = P −1z ( 0 ) .

260

Continuous Signals and Systems with MATLAB®

The total solution now can be written as t

˜

w (t ) = exp ˙ˆP −1APt ˘ˇ w ( 0 ) + exp ˆ˙P −1AP (t −  ) ˇ˘ P −1Bu (  ) d. 0

We need to fnd P−1 AP to substitute in the total solution equation. We start frst by fnding the eigenvalues of A. We look at the roots of det(λI − A).  ˆ 1 det ( ˛I − A) = det ˛ ˘  ˇ 0

0  ˆ 0 −˘ 1  ˇ −2

 ˇ ˛ det ( ˛I − A) = det ˛   ˘ 2

−1 ˛+3

1    −3 

    

which simplifes to det ( ˛I − A) = ˛ ( ˛ + 3) − 2( −1) det ( ˛I − A) = ˛ 2 + 3˛ + 2. The roots of det(λI − A) are λ1 = −1 and λ2 = −2. Now it is time to fnd the two eigenvectors that correspond to each of the eigenvalues: −1 and −2. To fnd these vectors we need to fnd a solution for the equation

( ˛I − A) p = 0 for each value of the eigenvalues. For λ1 = − 1 ˆ −1 ˇ 2

( ˛I − A) p = ˘

ˆ −1 −1  p = ˘ 2  ˇ 2

The two equations to solve are

( −1) p1 + ( −1) p2 = 0 and 2p1 + 2p2 = 0.

−1  ˘ˆ p1  2  ˘ p2 ˇ

  = 0. 

261

State-Space and Linear Systems

These two equations are the same (divide the second by −2 to get the frst). To solve them we let p1 = c, then p2 = −c. Therefore, the frst eigenvector p1 will be ˛ 1 ˆ p1 = c ˙ ˘. ˝ −1 ˇ Choosing c to have a value of 1 will give ˛ 1 ˆ p1 = ˙ ˘, ˝ −1 ˇ which is the frst eigenvector of the matrix P. For λ2 = −2 ˆ −2 ˇ 2

( ˛I − A) p = ˘

−1  ˆ˘ p1  1  ˘ p2 ˇ

ˆ −2 −1  p = ˘ 1  ˇ 2

  = 0, 

and the two equations to solve are

( −2) p1 + ( −1) p2 = 0 and 2p1 + 1p2 = 0. These two equations are the same (multiply the second by −1 to get the frst). To solve them we let p1 = c, then p2 = −2c. Therefore, the second eigenvector p2 will be ˛ 1 ˆ p2 = c ˙ ˘. ˝ −2 ˇ Choosing c to have a value of 1 will give ˛ 1 ˆ p2 = ˙ ˘. ˝ −2 ˇ And the matrix P of the two eigenvectors is ° 1 P = °˛ p1˜p2 ˝˙ = ˇ ˛ −1

1 ˝ ˘ −2 ˙

262

Continuous Signals and Systems with MATLAB®

and

P −1 =

1 ˙ −2 ˇ det ( P ) ˆ 1

˙ −2 −1 ˘  = −1ˇ 1  ˆ 1

−1 ˘ ˙ 2 =ˇ 1  ˆ −1

1 ˘ . −1 

Now let us look at P−1AP and see if it is really a diagonal matrix. ˛ 2 P −1AP = ˙ ˝ −1

1 ˆ˛ 0 ˘˙ −1 ˇ ˝ −2

1 ˆ˛ 1 ˘˙ −3 ˇ ˝ −1

1 ˆ ˘ −2 ˇ

By carrying out the matrix multiplication we arrive at ˛ 2 P −1AP = ˙ ˝ 2

−1 ˆ ˛ 1 ˘˙ 2 ˇ ˝ −1

1 ˆ ˛ −1 ˘=˙ −2 ˇ ˝ 0

0 ˆ ˘. −2 ˇ

Notice that the eigenvalues of A are the same as the eigenvalues of P−1 AP (check that out). This means that the shape of the transients is not affected by the transformations we made when we went from the z to the w space. Now go back to the equation that should give us a solution for w(t) and notice that u(t) is the step signal that is unity from time t = 0 until infnity. The solution now can be written as t

˜

w (t ) = exp ˙ˆP −1APt ˇ˘ w ( 0 ) + exp ˆ˙P −1AP (t −  ) ˘ˇ P −1Bu (  ) d 0

w (t ) =

t

˜ 0

˙ − (t −  ) ˇ e ˇˆ 0

˘˙ ˘  ˇ 1  d = −2(t − ) −1  e  ˆ 0

t

˜ 0

− (t −  ) ˙ ˇ e −2(t − ) ˆˇ e

We can integrate element by element to get

w (t ) =

t

˜ 0

− (t −  ) ˙ ˇ e ˇˆ e −2(t − )

t ˙ e −t ˆ˙ e  ˘ ˇ ˘ 0  d = ˇ −2t ˇ − e ˙ e 2 ˘t  ˇ 2 ˆ 0 ˆ

˘  .   

This simplifes to ˙ e −t ˆ˙ et − 1ˇ˘  w (t ) =  1  e −2t ˙ˆ e 2t − 1ˇ˘ ˆ −2

ˇ ˙ 1− e −t   =   1 −2t ˙ e − 1ˇ˘   2ˆ ˘ ˆ

ˇ  .  ˘

˘  d. 

263

State-Space and Linear Systems This is the solution for w(t). We need a solution for z(t) and therefore we write z (t ) = Pw (t ) ˙ 1 z (t ) = Pw (t ) = ˇ ˆ −1

˙ 1− e −t 1 ˘ˇ  1 −2t −2  ˇ ˆ˙ e − 1˘ ˇ ˆ 2

ˆ 1 1 − e −t + e −2t ˘ 2 z (t ) = Pw (t ) = ˘ 2 ˘ e −t − e −2t u (t ) ˇ˘

(

)

˘    

  ,  

from which y(t) is y (t ) =

1 1 − e −t + e −2t . 2 2

These solutions agree with the solutions obtained using the Laplace transform approach taken earlier in the example.

Example 6.3 Consider the series RLC circuit shown in Figure 6.1, where x(t) is the input. We are interested in fnding the output vR(t), the voltage across the resistor with R = 1 ohm, C = 1 farad, and L = 1 henry. Let x(t) be an impulse input with unity strength. SOLUTION This case is different from the case of a linear constant-coeffcient differential equation, where the number of states was set to the order of the differential equation at hand. Now we have a real physical system, the RLC circuit. How do we

FIGURE 6.1

Circuit for Example 6.3.

264

Continuous Signals and Systems with MATLAB®

select the number of states? The system in this example has two energy storage elements (the resistor does not store energy). This means that we will need a second-order differential equation to solve for all variables in the system. Thus, we will have two states. We will select the voltage across the capacitor as one state, and the current in the inductor as the second state, because they relate to the storage elements. We also select the voltage in the capacitor because we know from circuit transient analysis that the voltage in the capacitor does not change instantaneously. We select the current in the inductor because it also does not change instantaneously. Notice that other variables in the circuit were not selected as states. The reason is that the only two variables in the circuit that are linearly independent are the voltage in the capacitor and the current in the inductor. Take, for example, the voltage in the resistor vR (t ) = RiL (t ) , where iL(t) is the current in the inductor as seen in the circuit. vR(t) is a linear combination of the current in the inductor. Thus, it is not selected and its value can be calculated easily after we fnd the current in the inductor. For a circuit that has many resistors, n capacitors that cannot be combined, and m inductors that also cannot be combined, we will have n + m states, where the n states are the n voltages across the capacitors, and the m states are the m currents in the inductors. Therefore, our two states in this example are the voltage in the capacitor and the current in the inductor, vC(t) and iL(t). In the storage elements, L

d iL (t ) = vL (t ) dt

and C

d vC (t ) = iC (t ) . dt

Remember that the right side of the above state equations must be in terms of the state variables and the input x(t) only. A loop equation in the circuit in Figure 6.1 will yield the following equations vL (t ) = −RiL (t ) − vC (t ) + x (t ) and iC (t ) = iL (t ) , which can be written as L

d iL (t ) = −RiL (t ) − vC (t ) + x (t ) dt

265

State-Space and Linear Systems and

C

d vC (t ) = iL (t ) . dt

We will let z1(t) = iL(t) and z2(t) = vC(t). Rewriting the above state equations with L = 1H, C = 1F, and R = 1 ohm we get d z1 (t ) = − z1 (t ) − z2 (t ) + x (t ) dt and d z2 (t ) = z1 (t ) . dt Assuming zero initial conditions, we can put the two simultaneous state equations in state-space matrix form as d z = Az + Bx, dt where

˛ −1 A= ˙ ˝ 1

˛ 1 ˆ −1 ˆ ˘, ˘, B = ˙ 0 ˇ ˝ 0 ˇ

˛ d z1 ˙ d dt z=˙ ˙ d dt z2 ˙ ˝ dt

ˆ ˘ ˛ ˆ ˘ , and˜ z = ˙ z1 ˘ . ˘ ˙˝ z2 ˘ˇ ˘ ˇ

Following the procedure in the second example, and after taking the Laplace transform of the time-domain state matrix equations, we get

( )

Z ( s ) = [ sI − A] BX ( s ) + [ sI − A] z 0 − . −1

−1

Substituting we get

 ˆ 1 Z ( s ) = s ˘  ˇ 0

0  ˆ −1 −˘ 1  ˇ 1

−1

−1   ˆ 1   ˘  [1] , 0  ˇ 0 

266

Continuous Signals and Systems with MATLAB®

which simplifes to ˆ s +1 Z (s) = ˘ ˇ −1 Z (s) =

−1

1  ˆ 1   ˘  s  ˇ 0 

ˆ s 1 ˘ s2 + s + 1ˇ 1

ˆ s ˘ 2 + s +1 s Z (s) = ˘ ˘ 1 ˘ 2 ˇ s + s +1

−1  ˆ 1  ˘  s +1 ˇ 0  −1 s + s +1 s +1 s2 + s + 1 2

   ˘ˆ 1  . ˇ 0   

Finally, ˙ s ˇ 2 s + s +1 Z (s) = ˇ ˇ 1 ˇ 2 ˆ s + s +1

˘  .   

Taking the inverse Laplace transform of the above state-space Laplace matrix representation we get 1  − t 1 ˙ 3 ˘ ˙ 3 ˘ − t  −1 4 2 2 cos e sin t u t + e ( )  2 3 ˇ 4  ˇ 4 t  u (t ) ˆ  ˆ   z (t ) =  1 − t  ˙ 3 ˘ 4 2 e sin ˇ t  u (t )  3 ˆ 4  

The states are 1 4 z1 (t ) = − e 2 3

1 − t 2

1 ˙ 3 ˘ ˙ 3 ˘ − t sin ˇ t  u (t ) + e 2 cos ˇ t  u (t ) ˆ 4  ˆ 4 

and z2 ( t ) =

4 e 3

1 − t 2

˝ 3 ˇ sin ˆ t  u (t ) . ˙ 4 ˘

z1(t) = iL(t) and z2(t) = vC(t). But we were asked to fnd vR(t), which is vR (t ) = RiL (t ) .

    .   

267

State-Space and Linear Systems Therefore, −1 4 vR (t ) = e 2 3

1 − t 2

1 ˙ 3 ˘ ˙ 3 ˘ − t sin ˇ t  u (t ) + e 2 cos ˇ t  u (t ) . ˆ 4  ˆ 4 

So the input to the system was x(t) = δ(t), and the output to calculate was y(t) = vR(t). This example demonstrates how a variable in a system like vR(t) can be computed from the selected independent states z1(t) = iL(t) and z2(t) = vC(t). Knowing the states z1(t) = iL(t) and z2(t) = vC(t), we can fnd any variable in the circuit. Actually, we can fnd the following variables: 1. The current in the resistor R: iR(t) = iL(t) d iL (t ) dt d 3. The current in the capacitor C: iC (t ) = C vC (t ) dt 2. The voltage in the inductor L: vL (t ) = L

Example 6.4 Consider the following mechanical system with the input x(t) as an impulsive force of unity strength δ(t) and initial conditions

( )

( )

d y 0 − = y 0 − = 0. dy The system is shown in Figure 6.2. The rod to the left of the mass M can be modeled by a translational spring with spring constant K, in parallel with a translational damper of constant B. x(t) is the input force, and y(t) is the output translation measured from a specifc reference as indicated in Figure 6.2. For M = 1 kg, B = 1 newton/meter/second (N.s/m), K = 1 newton/meter. With x(t) = δ(t), fnd the output displacement y(t).

FIGURE 6.2

System for Example 6.4.

268

FIGURE 6.3

Continuous Signals and Systems with MATLAB®

Free-body diagram for Example 6.4. SOLUTION

A free-body diagram is constructed to help us write the equations of motion. This diagram is shown in Figure 6.3. Since we are interested in the output y(t), and if we choose not to use statespace techniques, we can Laplace-transform the free-body diagram in Figure 6.3 and obtain the diagram in Figure 6.4. Summing the forces using the Laplace-transformed free-body diagram we get KY ( s ) + BsY ( s ) + Ms 2Y ( s ) = X ( s ) . For illustrative purposes only, assuming M = 1 kg, B = 1 N.s /m, K = 1 newton/ meter, and with x(t) = δ(t), we can write Y ( s ) + sY ( s ) + s 2Y ( s ) = 1 Y ( s ) ˙˝ s 2 + s + 1ˇˆ = 1. Finally the output is Y ( s ) = 1/ ˆ˙ s 2 + s + 1ˇ˘ = 1.

FIGURE 6.4

Free-body diagram for Example 6.4.

269

State-Space and Linear Systems Taking the inverse Laplace transform of Y(s) we get y (t ) =

4 e 3

1 − t 2

˝ 3 ˇ sin ˆ t  u (t ) . ˙ 4 ˘

But we are interested in using the state-space approach in solving for the output y(t). We will consider the free-body diagram in the time domain and sum the forces acting on the object of mass M to get M

d2 d y (t ) + B y (t ) + Ky (t ) = x (t ) . dt dt

In transforming this second-order differential equation into state-space form, we need to defne two state variables, since the differential equation given is second order. Let z1 = y (t ) and z2 =

d y (t ) . dt

Next, we take derivatives of the two states to get d d y (t ) z1 = dt dt and d d2 z2 = y (t ) . dt dt In terms of state variables and inputs to the system we have d z1 = z2 dt and d z2 = −z1 − z2 + x dt These are the two simultaneous state equations. Putting them in state-space matrix form with x(t) = δ(t) we get d z = Az + Bx, dt

270

Continuous Signals and Systems with MATLAB®

where

˙ 0 A= ˇ ˆ −1

˙ d z1 ˇ ˙ ˘ ˘ d dt 1 0  ,˜ z = ˇˇ , B = ˇ d −1  ˆ 1  dt z2 ˇ dt ˆ

˘  ,   

˙ z1 z=ˇ ˆˇ z2

˘  ,˜ 

and˜ x = [ x ].

Up to this point we are still in the time domain. We now try to solve this matrix state equation using the Laplace transform approach. Notice that this system is similar to the system in Example 6.3. We can use the same procedure to get ˙ ˇ ˇ Z (s) = ˇ ˇ ˇ ˆ

(

1 s + 3s + 2

(

s s 2 + 3s + 2

2

) )

˘   .   

Taking the inverse Laplace transform on the above state-space Laplace matrix representation, we get 1  − t ˝ 3 ˇ  4 2 e sin ˆ t  u (t )  3 ˙ 4 ˘  z (t ) =  1 − t 1  −1 4 2 ˝ 3 ˇ ˝ 3 ˇ − t t u (t ) e sin ˆ t  u (t ) + e 2 cos ˆ  2 3 4 4 ˘ ˙ ˘ ˙ 

    .   

Therefore, the states are

z1 (t ) =

4 e 3

1 − t 2

˝ 3 ˇ sin ˆ t  u (t ) ˙ 4 ˘

and −1 4 e z2 ( t ) = 2 3

1 − t 2

1 ˙ 3 ˘ ˙ 3 ˘ − t sin ˇ t  u (t ) + e 2 cos ˇ t  u (t ) . ˆ 4  ˆ 4 

d y (t ), which is the velocity of the displacement y(t). dt Notice that Examples 6.3 and 6.4 are two different systems in the sense that one is electrical and the other is mechanical, and yet the solutions are similar. The reason is that both systems were modeled mathematically as differential equations.

z1(t) = y(t) and z2 (t ) =

271

State-Space and Linear Systems

6.3

GENERAL REPRESENTATION OF SYSTEMS IN STATE SPACE

We will consider systems not only with single-input/single-output, but our study will be general and we will generalize to systems of multiple-inputs/multiple-outputs. We also have indicated that the states we select among the many variables in the system under consideration must be linearly independent. This means that no selected state can be written as a linear combination of the others. A linear combination of n states zk, where k = 1 to n can be represented as k =n

˜° z

k k

= °1 z1 + ° 2 z2 + ° 3 z3 + …+ ° n zn ,

(6.10)

k =1

where the α’s are constants. Further, the selected states are linearly independent if the sum k =n

˜° z

k k

= °1 z1 + ° 2 z2 + ° 3 z3 + …+ ° n zn

k =1

is equal to zero only if all the α’s are zero and no selected state is zero. System variables are the variables in the system where, when an input is applied to the system, they will have a response whether this input is an actual external input or an internal input (initial condition). The state variables of the system are the minimum linearly independent set of variables in the same system. When we express the output variables in the system as a linear combination of the state variables, these output variables are called output equations for the system. In a similar way, we say that the set of the frst-order differential equations that describe the system completely are called state equations. When we group our state variables in a vector form, we will call them state vectors. The n-dimensional space whose variables are the state variables is called the state-space. Multiple-input/ multiple-output systems can be represented in state space as the two state-space matrix equations d z = A z + Bx dt

(6.11)

y = C z + Dx . In the above equation, z is the state vector, A is the system coeffcient matrix, B is the input matrix, C is the output matrix, and D is the feed-forward matrix. The frst of the equations above is called the state equation, and the second is called the output equation.

272

6.4

Continuous Signals and Systems with MATLAB®

GENERAL SOLUTION OF STATE-SPACE EQUATIONS USING THE LAPLACE TRANSFORM

Given the state-space matrix equations in the time domain as d z = Az + Bx dt y = C z + Dx , the solution for these equations in the Laplace domain is Z ( s ) = ( sI − A ) z ( 0 ) + ( sI − A ) BX ( s ) −1

−1

(6.12)

Y ( s ) = CZ ( s ) + DX ( s ) .

6.5 GENERAL SOLUTION OF THE STATE-SPACE EQUATIONS IN REAL TIME Given the state-space matrix equations in the time domain as d z = Az + Bx dt y = C z + Dx , we will examine the two cases, where the matrix A can have two different forms. If A is a diagonal matrix, then exp(At) is straightforward and explained in the examples above. The solution for the states in this case is t

˜

(6.13)

y ( t ) = Cz ( t ) + Dx ( t ) .

(6.14)

z ( t ) = exp [ At ] z ( 0 ) + exp [ A ( t −  )] Bx (  ) d, 0

and for the outputs it is

If A is not a diagonal matrix, it can be diagonalized using the techniques explained in the previous examples, and the representation in state space can be transformed to a new space w(t) as a result. The solution for the states is then z ( t ) = Pw ( t ) ,

(6.15)

y ( t ) = CPw ( t ) + Dx ( t ) ,

(6.16)

and for the outputs it is

273

State-Space and Linear Systems

where t

˜

w ( t ) = exp ˆ˙P APt ˘ˇ w ( 0 ) + exp ˆ˙P −1 AP ( t −  ) P −1 Bx (  ) d.ˇ˘ −1

(6.17)

0

P is the transformation matrix that transforms A into P−1AP, the diagonalized matrix.

6.6

WAYS OF EVALUATING eAt

There are many ways of evaluating the exponent of the matrix A. We will consider six of them in this chapter.

6.6.1

FIRST METHOD: A IS A DIAGONAL MATRIX

If A is diagonal square matrix, then eAt is a square matrix, too. It is calculated by leaving alone all elements in A, which are zeros and using the other elements multiplied by t as exponents. As an example: If ° a A=˝ ˛ 0

0 ˙ b ˇˆ

is a diagonal matrix, then ° e at e At = ˝ ˛˝ 0

6.6.2

0 e bt

˙ ˇ. ˇˆ

(6.18)

˜ a SECOND METHOD: A IS OF THE FORM ˛ ° 0

b ˝ ˆ a ˙

This was shown previously and is presented here for completeness as ˝ e at exp ( At ) = ˆ ˆ˙ 0

6.6.3

bte at e at

ˇ . ˘

(6.19)

THIRD METHOD: NUMERICAL EVALUATION, A OF ANY FORM

From Taylor’s series, we can write the exponent of the matrix A as e At = I + At +

( At )2 ( At )3 ( At )4 2!

+

3!

+

4!

+…

This method is not desirable if a complete closed form solution is sought.

(6.20)

274

6.6.4

Continuous Signals and Systems with MATLAB®

FOURTH METHOD: THE CAYLEY–HAMILTON APPROACH

Using the Cayley–Hamilton theorem, we can write e At = a0 I + a1 A + a2 A2 + a3 A3 +  + an−1 An−1 ,

(6.21)

where a0 through an−1 are to be calculated, and n is the size of the matrix A. Let us denote the eigenvalues for A as λ1 through λn, and substitute A by each of the eigenvalues to get the following set of equations e ˛1t = a0 + a1˛1 + a2 ˛12 +  + an−1˛1n−1 e ˛ 2t = a0 + a1˛ 2 + a2 ˛ 22 +  + an−1˛ n−1 2 e ˛3t = a0 + a1˛ 3 + a2 ˛ 32 +  + an−1˛ 3n−1  e ˛ n t = a0 + a1˛ n + a2 ˛ 2n +  + an−1˛ n−1 n

(6.22)

If the eigenvalues of A are distinct, we will have n simultaneous equations to solve for the coeffcients a0 through an−1. If the eigenvalues of A are not distinct, then the above set of equations will be dependent. If an eigenvalue has, for example, a multiplicity of two, then we will need an extra equation involving the derivative of the equation corresponding to that particular eigenvalue with respect to the eigenvalue itself. As an example, consider ˛ −2 A=˙ ˝ 0

0 ˆ . −2 ˘ˇ

The characteristic equation (det(λI − A) = 0) is ˜ 2 + 4˜ + 4 = 0. The roots are at λ = −2 and λ = −2. Using the general equations presented before, we get e ˛t = a0 + ˛a1 and its derivative te °t = a1 .

275

State-Space and Linear Systems

With the eigenvalues both at −2, the above equations become e −2t = a0 − 2a1 te −2t = a1 . Therefore, a1 = te −2t a0 = 2te −2t + e −2t . Since A is a 2 × 2 matrix, we have e At = a0 I + a1 A ˝ a0 − 2a1 e At = a0 I + a1 A = ˆ 0 ˆ˙

0 a0 − 2a1

ˇ ˝ e −2t =ˆ ˘ ˙ˆ 0

0 e −2t

As another example, let ˛ 0 A=˙ ˝ −6

1 ˆ . −5 ˇ˘

We will frst fnd the eigenvalues for A. The characteristic equation is ˜ 2 + 5˜ + 6 = 0. The roots are at λ = −2 and λ = −3. Using the general equations presented before, we write e −2t = a0 − 2a1 e −3t = a0 − 3a1 . Solving these simultaneous equations leads to a0 = −2e −3t + 3e −2t a1 = e −2t − e −3t .

ˇ . ˘

276

Continuous Signals and Systems with MATLAB®

Since A is a 2 × 2 matrix we have e At = a0 I + a1 A ˝ a0 e At = a0 I + a1 A = ˆ ˆ˙ −6a1

6.6.5

ˇ ˝ 3e −2t − 2e −2t a1 =ˆ a0 − 5a1 ˘ ˆ −6e −2t + 6e −3t ˙

ˇ . ˘

e −2t − e −3t −2e −2t + 3e −3t

FIFTH METHOD: THE INVERSE LAPLACE METHOD

e is known as the state-transition matrix and usually denoted as Φ(t). Let us look at the Laplace transform solution of the state equations At

Z ( s ) = ( sI − A ) z ( 0 ) + ( sI − A ) BX ( s ) , −1

−1

and for comparison, let us give the time-domain solution for the same equations t

˜

z ( t ) = exp [ At ] z ( 0 ) + exp [ A ( t −  )] Bx (  ) d. 0

A close look at these equations tells us that eAt is the inverse Laplace transform of (sI − A)−1. Or mathematically, we write −1 e At = L−1 ˙ˆ( sI − A ) ˇ˘ .

(6.23)

As an example, let ˛ −2 A=˙ ˝ 0

0 ˆ . −2 ˘ˇ

Then

( sI − A)

−1

ˆ s+2 =˘ ˇ 0

ˆ 1 ˘ ( sI − A)−1 = ˘ s + 2 ˘ 0 ˘ ˇ

−1

 1 ˆ s+2 0 = ˘  s+2  ( s + 2 )2 ˇ 0   . 1  s + 2  0

 0 s + 2 

277

State-Space and Linear Systems

Taking the inverse transform we get ˛ e −2t ˙ ˝˙ 0

0 e

−2t

ˆ ˘ = e At =  ( t ) . ˘ˇ

Before we go into the sixth method of fnding eAt, we will look at some important properties of the state-transition matrix. We know that for systems with zero input z ( t ) = ˝ ( t ) z ( 0 ). Let t = 0. Then z ( 0 ) = ˝ ( 0 ) z ( 0 ). says that ˛ ( 0 ) = I, which is the identity matrix. Let us differentiate z (t ) = ˝ (t ) z ( 0 ) with respect to time. We will get d d z ( t ) = ˝ ( t ) z ( 0 ) = Az ( t ) . dt dt Let us set t = 0 in the last equation to get d ˛ ( 0 ) z ( 0 ) = Az ( 0 ). dt This last equation tells us that d ˛ ( 0 ) = A. dt

6.6.6

SIXTH METHOD: USING THE GENERAL FORM OF Φ(t) = eAt AND ITS PROPERTIES

We also noted that each term in the transition matrix is generated by the system poles. So, in general, for a 2 × 2 system with poles λ1 and λ2, the form of the transition matrix is ˆ a e 1t + a e  2t 1 2 ˛ (t ) = ˘ 1t ˘ a5e + a6 e  2t ˇ

a3e 1t + a4 e  2t  , a7 e 1t + a8 e  2t 

where the constants a1 through a8 are to be determined.

278

Continuous Signals and Systems with MATLAB®

Let us consider an example to illustrate the procedure. Let ˛ 0 A=˙ ˝ −8

1 ˆ . −6 ˇ˘

Since A is of dimension 2 × 2, ˆ ˘ ˛ (t ) = ˘ ˘ ˇ

a1e 1t + a2 e  2t

a3e 1t + a4 e  2t

a5e 1t + a6 e  2t

a7 e 1t + a8 e  2t

  .  

(6.24)

We will use the properties of the transition matrix to fnd the constants a1 to a8. ˆ a1 + a2 ˛(0) = ˘ ˇ˘ a5 + a6

a3 + a4  ˆ 1 = a7 + a8  ˇ˘ 0

ˇ ˙ a e ˙1t + ˙ a e ˙ 2t d 1 1 2 2 ˛ (t ) =  ˙ t 1 dt  ˙1a5e + ˙ 2 a6 e ˙ 2t ˘

0  1 

(6.25)

˙1a3e ˙1t + ˙ 2 a4 e ˙ 2t   ˙1a7 e ˙1t + ˙ 2 a8 e ˙ 2t 

(6.26)

Evaluating at t = 0, we get ˇ ˙1a1 + ˙ 2 a2 d ˛(0) =  dt ˘ ˙1a5 + ˙ 2 a6

˙1a3 + ˙ 2 a4  ˇ 0 = ˙1a7 + ˙ 2 a8  ˘ −8

1  . −6 

We will have eight algebraic equations to solve. These equations are a1 + a2 = 1 a3 + a4 = 0 a5 + a6 = 0

(6.27)

a7 + a8 = 1 and ˜1a1 + ˜ 2 a2 = 0 ˜1a3 + ˜ 2 a4 = 1 ˜1a5 + ˜ 2 a6 = −8 ˜1a7 + ˜ 2 a8 = −6.

(6.28)

279

State-Space and Linear Systems

With λ1 and λ2 both at −2 and −4, we can solve Equation 1 of set (Equation 6.27) and Equation 1 of set (Equation 6.28) and so forth to get all the constant terms. The constants are a1 = 2, a2 = −1, a3 = 0.5, a4 = −0.5, a5 = −4, a6 = 4, a7 = −1, and a8 = 2. Finally, the transition matrix Φ(t) is ˇ 2e 1t − e  2t ˛ (t ) =  ˘ −4e 1t + 4e  2t

0.5e 1t − 0.5e  2t −e 1t + 2e  2t

 . 

Example 6.5 Consider the state-space system represented as ˛ 0 d z=˙ dt ˝ −6

1 ˆ ˘z −5 ˇ

for the states, and ° 0 y=˝ ˛ 1

1 ˙ ˇz 0 ˆ

for the outputs. With the initial conditions ˝ 0 ˇ z (0) = ˆ , ˙ 1 ˘ what are the outputs, y1 and y2? Calculate the state-transition matrix using the methods presented neglecting the numerical method. SOLUTION 1. Using the Cayley–Hamilton method Note that this A matrix is the same matrix we used when we presented the Cayley–Hamilton method. We will present the transition matrix here for completeness. e At = a0I + a1A which is fnally ˝ 3e −2t − 2e −3t e At = ˆ −2t −3t ˙ˆ −6e + 6e

ˇ e −2t − e −3t . −2t −3t −2e + 3e ˘

280

Continuous Signals and Systems with MATLAB® 2. Using the inverse transform method First we fnd −1

ˆ s ˇ 6

ˆ s+5 1 −1   = 2 ˘ s+5  s + 5s + 6 ˇ −6

( sI − A)−1 = ˘

(

1  , s 

)

which simplifes to ˆ ˘ −1 ˘ ( sI − A) = ˘ ˘ ˇ˘

s+5 ( s + 2)( s + 3) −6

( s + 2)( s + 3)

1

( s + 2)( s + 3) s

( s + 2)( s + 3)

   .  

Using partial fraction expansion, we can write ˆ ˘ −1 ( sI − A) = ˘˘ ˘ ˇ˘

3 2 − ( s + 2) ( s + 3) −6

+

6

( s + 2) ( s + 3)

 1 1 −  ( s + 2) ( s + 3)  . −2 3  + ( s + 2) ( s + 3) 

Taking the inverse transform using partial fraction expansion, we will get Φ(t) as ˇ 3e −2t − 2e −3t ˛ (t ) =  −2t −3t ˘ −6e + 6e

 e −2t − e −3t . −2e −2t + 3e −3t 

3. Using the general form of the transition matrix and its properties. Since A is of dimension 2 × 2, ˆ a e 1t + a e  2t 1 2 ˛ (t ) = ˘ ˘ a5e 1t + a6e  2t ˇ

a3e 1t + a4 e  2t  . a7e 1t + a8e  2t 

By evaluating at t = 0 we get ˆ a1 + a2 ˛ (0) = ˘ ˇ˘ a5 + a6

a3 + a4  ˆ 1 =˘ a7 + a8  ˇ 0

0   1 

and ˆ ˝1a1 + ˝ 2a2 d ˛ (0) ˘ dt ˘ˇ ˝1a5 + ˝ 2a6

˝1a3 + ˝ 2a4  ˆ 0 =˘ ˝1a7 + ˝ 2a8  ˇ −6

1  . −5 

281

State-Space and Linear Systems Again, we will have eight algebraic equations to solve. These equations are a1 + a2 = 1 a3 + a4 = 0

(6.29)

a5 + a6 = 0 a7 + a8 = 1 and ˜1a1 + ˜ 2a2 = 0 ˜1a3 + ˜ 2a4 = 1

(6.30)

˜1a5 + ˜ 2a6 = −6 ˜1a7 + ˜ 2a8 = −5. With λ1 and λ2 both at −2 and −3, we can solve Equation 1 of set (Equation 6.29) and Equation 1 of set (Equation 6.30) and so forth to get all the constant terms. In doing that we fnd a1 = 3, a2 = −2, a3 = 1, a4 = −1, a5 = −6, a6 = 6, a7 = −2, and a8 = 3. With these values the transition matrix Φ(t) is obtained as ˆ a e 1t + a e  2t 1 2 ˛ (t ) = ˘ ˘ a5e 1t + a6e  2t ˇ

a3e 1t + a4 e  2t   a7e 1t + a8e  2t 

ˆ 3e 1t − 2e  2t =˘ 1t  2t ˇ˘ −6e + 6e

 e 1t − e  2t  −2e 1t + 3e  2t 

The solution for the states is ˝ 3e −2t − 2e −3t z=ˆ −2t −3t ˙ˆ −6e + 6e

e −2t − e −3t −2e −2t + 3e −3t

ˇ˝ 0 ˇ ˆ  1 ˘ ˘ ˙

˝ e −2t − e −3t ˇ =ˆ , −2t −3t ˘ ˙ˆ −2e + 3e and for the outputs ° 0 y=˝ ˛ 1

1 ˙° e −2t − e −3t ˇ˝ 0 ˆ ˝ −2e −2t + 3e −3t ˛

˙ ° −2e −2t + 3e −3t ˇ=˝ e −2t − e −3t ˇˆ ˝˛

˙ ˇ. ˇˆ

For hand examples, the inverse Laplace method is the fastest for secondorder systems.

282

6.7

Continuous Signals and Systems with MATLAB®

SOME INSIGHTS: POLES AND STABILITY

The objective of this chapter was to represent linear systems in state-space form and to look for ways of solving for the states. The process was to represent an nth-order system (nth-order differential equation) as n frst-order differential equations and arrange these equations in what we call state-space representation as d z = Az + Bx dt y = C z + Dx , where x is the input vector (assuming multiple inputs), and y is the output vector (assuming multiple outputs). The z vector is the vector that contains the states of the system. The A matrix is the matrix that contains the parameters that control the dynamics of the system. As we saw in previous chapters, in every system representation there was a way to fnd the eigenvalues of the system. In statespace representation, the roots of the determinant of the matrix, (sI − A), where I is the identity matrix, are the eigenvalues of the system, the poles. And as we mentioned before, these poles determine the shape of the transients of the system under investigation. Consider the following single-input/single-output linear second-order differential equation that we discussed in Example 6.2 earlier in this chapter d2 d y ( t ) + 3 y ( t ) + 2y ( t ) = x ( t ) dt dt with x(t) = u(t) and initial conditions d y ( 0 − ) = y ( 0 − ) = 0. dt Putting this differential equation in state-space matrix form with x(t) = u(t), we get d z = A z + Bx , dt where

˙ 0 A=ˇ ˆ −2

˙ d z1 ˇ ˘ ˙ ˘ d 1 dt 0 z=ˇ , B=ˇ ,   −3  ˇ d ˆ 1  dt z2 ˇ ˆ dt

˘  ˙  , z = ˇ z1  ˇˆ z1  

˘  ,˜and˜ x = [ x ]. 

283

State-Space and Linear Systems

The roots of the determinant of (sI − A) are calculated as ˛ 1 sI − A = s ˙ ˝ 0

0 ˆ ˛ 0 − 1 ˘ˇ ˙˝ −2

1 ˆ ˛ s = −3 ˘ˇ ˙˝ 2

−1 ˆ . s + 3 ˘ˇ

The determinant of the above matrix is s 2 + 3s + 2 = ( s + 1)( s + 2 ). The roots of the above equation are at s = −1 and at s = −2. These are the eigenvalues or the poles of the system. Therefore, as we mentioned earlier, we expect a solution that contains the terms c1e−1t + c2e−2t. As you can see, this solution is stable (eigenvalues are all negative). Let us look at the solution we arrived at earlier 1 ˆ  y ( t ) = ˘ 1 + e −t − e −2t  u ( t ) . ˇ  2 You can see that c1 = 1/2 and c2 = −1. These coeffcients have no effect on the stability of the system. The extra term in the output y(t) is the term u(t). This term is due to the input x(t). So if the input is bounded, and the eigenvalues are all negative, the output has to be stable; it dies as time progresses or settles at a certain bounded value, in this case u(t). To summarize, if the system is given in state-space form, the stability of the system is determined by fnding the roots of det[sI − A]. If the roots are all negative (in case of complex roots we look at the real part of the roots), the system is stable. If one of the roots is positive, the system is unstable. And again, the roots will determine the shape of the transients.

6.8 END-OF-CHAPTER EXAMPLES EOCE 6.1 Consider the following two matrices: ˛ −14 A= ˙ 1 ˝

4 ˆ ˘ −18 ˇ

and ° 2 B=˝ ˛ 3

1 ˙ ˇ. 0 ˆ

We will utilize MATLAB to fnd each of the following: A + B, B − A, 23A, 2(A + B), AB, BA, 2AB, transpose(A), and inverse(A).

284

Continuous Signals and Systems with MATLAB® SOLUTION

Let us write the script EOCE6_1. The output is then sum_A_and_B=

−12 4

5 −18

16 2

−3 18

Diff_B_A=

A_times_23=

−322 23

92 −414

−24 8

10 −36

−16 −52

−14 1

−27 −42

−10 12

−32 −104

−28 2

A_plus_B_times_2=

A_times_B=

B_times_A=

Two_times_A_times_B=

285

State-Space and Linear Systems Transpose_A=

−14 4

1 −18

Inverse_A=

−0.0726 −0.0040

−0.0161 −0.0565

In the above example, notice that AB is not equal to BA. This is to say that multiplication may not commute.

EOCE 6.2 Consider the two matrices given in EOCE 6.1 again. ˛ −14 A= ˙ ˝ 1

˛ 2 4 ˆ ˘ and˜B =˜ ˙ −18 ˇ ˝ 3

1 ˆ ˘. 0 ˇ

Find the eigenvalues and eigenvectors of the above two matrices using MATLAB. SOLUTION To do that we write the script EOCE6_2. The output is VA=

0.9792 0.2028

−0.6380 0.7701

DA=

−13.1716 0

0 −18.8284

VB=

0.7071 0.7071

−0.3162 0.9487

286

Continuous Signals and Systems with MATLAB®

DB = 3 0

0 −1

As we can see, the eigenvalues for A are −13.17 and −18.82, and the eigenvectors are ˜ .97 ˝ ˜ −.63 ˝ ˛ ˆ and ˛ ˆ. .2 ˛° ˆ˙ ° .77 ˙

EOCE 6.3 Consider matrix B as given in EOCE 6.2. Find eBt. SOLUTION B is not diagonal. As discussed in this chapter, we need to fnd the matrix P that contains the eigenvectors of B, then we will have e Bt = Pe p

−1

BPt

P −1

We can use MATLAB to fnd P−1BP, as in the EOCE6_3 script with the output VB= 0.7071 0.7071

−0.3162 0.9487

DB= 5 0

0 1

Inverse_of_P= 1.0607 −0.7906

0.3536 0.7906

Diagonal_form_of_B= 5 0

0 1

287

State-Space and Linear Systems We can see that the diagonal form of B is ° 5 P −1BP = ˝ ˛ 0

0 ˙ ˇ, 1 ˆ

and

eP

−1

BPt

° e 5t =˝ ˝˛ 0

e Bt = Pe p

−1

BPt

0 et

˙ ˇ ˇˆ −.3162 ˆ ˛ e 5t ˘˙ .9487 ˇ ˙ 0 ˝

˛ .7071 P −1 = ˙ ˝ .7071

˛ .7071e 5t e Bt = ˙ ˙˝ 7071e 5t

−.3162et .9487et

ˆ ˛ 1.0607 ˘˙ ˘ˇ ˝ −.7906

0 et

ˆ ˛ 1.0607 ˘˙ ˘ˇ ˝ −.7906

.3536 ˆ ˘ .7906 ˇ

.3536 ˆ ˘. .7906 ˇ

And fnally, ˝ .75e 5t + .25et e Bt = ˆ ˆ˙ .75e 5t − .75et

.25e 5t − .25et .25e 5t + .75et

ˇ . ˘

EOCE 6.4 Consider the following state equations. d z1 = z2 dt d z2 = 6z2 − 5z1. dt We can see that these state equations are a result of a second-order system with zero input, since no inputs appear to the right side of the two equations. Assume that the initial conditions are z1(0) = 1 and z2(0) = −1. What are the states of this system? SOLUTION 1. Using the Laplace domain The general state-space solution in the Laplace domain is Z ( s ) = ( SI − A) z ( 0 ) + ( sI − A) BX ( s ) , −1

−1

288

Continuous Signals and Systems with MATLAB® where A is the dynamic matrix of the system, B is the input matrix (B = [0], no inputs), X is the input vector, and Z is the state vector. In this example ˛ 0 A= ˙ ˝ −5

˛ 0 ˆ 1 ˆ ˘ and˜B = ˙ ˘, 6 ˇ ˝ 0 ˇ

with the initial conditions ˙ 1 ˘ z (0) = ˇ . ˆ −1  Substituting these values in the state equation we get

ˆ s−6 1 Z (s) = 2 ˘ s − 6s + 5 ˇ −5

ˆ s−7 ˘ 2  ˆ  1 s 6s + 5 − 1 ˘ =˘ s  ˇ −1  ˘ −5 − s ˘ 2 ˇ s − 6s + 5

  .   

Finally, the states are ˆ ˘ Z (s) = ˘ ˘ ˘ ˇ

−1/ 2 + s−5 −5/ 2 + s−5

3/ 2 s −1 3/ 2 s −1

  .   

If we take the inverse transform we get ˝ z1 (t ) z (t ) = ˆ ˆ z2 ( t ) ˙

ˇ ˝ 5t  = ˆ −0.5e  ˆ −2.5e 5t ˘ ˙

+˜1.5et +˜1.5et

ˇ t  0. ˘

2. Using the time domain Since A is not in the diagonal form we need to use the following form of the solution t

˜

w (t ) = exp ˙ˆP −1APt ˇ˘ w ( 0 ) + exp ˙ˆP −1AP˜(t −  ) ˇ˘ P −1Bx (  ) d, 0

where z(t) = Pw(t) and w(0) = P−1 z(0). Since B is a zero matrix z (t ) = Pexp ˝˙P −1APt ˆˇ P −1z ( 0 ) . To solve for z(t) we need to fnd P, P−1, and P−1AP. We do that using the MATLAB script EOCE6_4.

289

State-Space and Linear Systems The output is P = −0.7071 −0.7071

−0.1961 −0.9806

−1.7678 1.2748

0.3536 −1.2748

Pinverse =

PinverseAP = 1.0000 0

0.0000 5.0000

Therefore, the solution for the states is ˙ −0.7071 Z (t ) = ˇ ˆ −0.7071

−0.1961 ˘ ˙ et ˇ −0.9806  ˇ 0 ˆ

˙ −0.7071 Z (t ) = ˇ ˆ −0.7071

−0.1961 ˘ ˙ −2.1213et ˇ −0.9806  ˇ 2.5495e 5t ˆ

0 e 5t

˘ ˙ −2.1213 ˘ ˇ  2.5495   ˆ ˘ t  0. 

Finally, ˛ z (t ) ˙ 1 ˙ z (t ) ˝ 2

ˆ ˛ t ˘ = ˙ 1.5e ˘ ˙ 1.5et ˇ ˝

− −

EOCE 6.5 Consider the mechanical system in Figure 6.5.

FIGURE 6.5

System for EOCE 6.5.

0.5e 5t 2.5e 5t

ˆ ˘t  0. ˘ˇ

290

Continuous Signals and Systems with MATLAB®

The rod to the left of the mass M can be modeled by a translational spring with spring constant K, in parallel with a translational damper of constant B. Assume the mass moves freely. As seen before, the differential equation representing the system is M

d d2 y (t ) + B y (t ) + Ky (t ) = x (t ) . dt dt

In a general form we can write the above equation as x (t ) d d2 . y (t ) + 2˝w n y (t ) + w n2y (t ) = dt dt M The characteristic equation is m2 + 2°w nm + w n2 = 0, with roots at m1,2 = −˛w n ± w n ˛ 2 − 1. We call ξ the damping ratio, where ˜=

B . 2 KM

In our example wn =

K . M

We have critical damping if ξ = 1, underdamping if ξ is less than one and greater than zero, and overdamping if ξ > 1. Let M = 1 kg and K = 40 newton/meter. K = 6.3246. For critical damping, ξ = 1, and w n = M For an underdamped case, let ξ = 0.5, while keeping the same value for wn. For the overdamped case let ξ = 2, while keeping the same value for wn as well. Assume zero initial conditions and plot the displacement y(t) vs. time for all cases above if x(t) is a constant force of 1 newton. SOLUTION We will use state equations to solve this problem using MATLAB. d y (t ) to get the state equations as Let z1(t) = y(t) and z2 (t ) = dt ˆ 0 d z (t ) = ˘ 2 dt ˘ˇ −w n

ˆ 0   1 ˘   z (t ) + ˘ 1  x (t ) , −2˙w n   ˘ˇ M 

291

State-Space and Linear Systems with the matrices ˝ 0 A= ˆ 2 ˆ˙ −w n

˝ 0 ˇ ˇ 1 ˆ   ˜and˜B = ˆ 1  , −2˛w n  ˘ ˆ˙ M ˘

and the initial conditions ˝ 0 ˇ z (0) = ˆ . ˙ 0 ˘ A MATLAB function will be used to defne the state equation as eoce5.m. Then the script EOCE6_5 is used that we will call the “ode23” function, which is a MATLAB function with initial conditions and initial and fnal values for the time needed for the simulation. The plots are given in Figure 6.6.

FIGURE 6.6

Plots for EOCE 6.5.

292

Continuous Signals and Systems with MATLAB®

EOCE 6.6 Consider the system in Figure 6.7. The rod to the left of the mass M1 can be modeled by a translational spring with spring constant k1. The rod to the right of the mass M1 can be modeled by a translational spring with spring constant k 2. The rod to the right of the mass M2 can be modeled by a translational spring with spring constant k3. Find the displacements y1(t) and y2(t) for different initial conditions. SOLUTION The system has two degrees of freedom (movement of M1 and M2) and it will have two coupled second-order differential equations. Each differential equation can be represented as two frst-order differential equations. Hence, the system given is a system with four state variables. We can use Newton’s law to write the two coupled differential equations as M1

M2

d2 y1 + k1y1 + k2y1 − k2y 2 = 0 dt

d2 y 2 − k2y1 + k2y 2 + k3y 2 = 0. dt

If we let all the spring constants be 1 and the values of the masses be 1, we will have d2 y1 + y1 + y1 − y 2 = 0 dt d2 y 2 − y1 + y 2 + y 2 = 0. dt If we now let z1 = y1 z2 = y 2

FIGURE 6.7

System for EOCE 6.6.

293

State-Space and Linear Systems and z3 =

d y1 dt

z4 =

d y2 dt

then the following state equation is obtained ° ˝ ˝ ˝ ˝ d z=˝ dt ˝ ˝ ˝ ˝ ˝ ˛

d z1 dt d z2 dt d z3 dt d z4 dt

˙ ˇ ˇ ˇ ° 0 ˇ ˝ ˇ=˝ 0 ˇ ˝ −2 ˇ ˝ 1 ˇ ˛ ˇ ˇ ˆ

0 0 1 −2

1 0 0 0

0 1 0 0

˙ ˇ ˇ z. ˇ ˇ ˆ

We will let the system vibrate at its natural frequencies with specifed initial conditions. The natural frequencies can be calculated by using the MATLAB command to fnd the eigenvalues of the system as A= [0 0 1 0; 0 0 0 1; −2 1 0 0;1 −2 0 0]; poles=eig (A) with the output poles = 0.0000+ 0.0000− 0.0000+ 0.0000−

1.7321i 1.7321i 1.0000i 1.0000i

Thus, the natural frequencies are at 1 and 1.7321 rad/sec. We will use MATLAB to study the response of the system for different initial conditions. We will start writing the function that defnes the system as eoce6.m. Next, we write the script EOCE6_6 that will call the MATLAB “ode23” function and the function that defnes the system. Since we will have different initial conditions, we will write a very general script that will communicate with the user. We will frst run the script above and let the masses M1 and M2 move two units to the right. In this case, the motions of M1 and M2 are in-phase. The following is a sample dialogue obtained by typing EOCE6_6 at the MATLAB prompt Initial time for simulation = 0 t_initial = 0 Final time for simulation = 10

294

Continuous Signals and Systems with MATLAB®

t_final = 10 [z1(t_initial) z2(t_initial) dz1(t_initial) dz2 (t_initial)] = [2 2 0 0] z0 = 2 2 0 0 Title = The two movements are in-phase: Ml and M2 are moved each 2 units to the right. plot_title = The two movements are in-phase: M1 and M2 are moved each 2 units to the right. The plots are shown in Figure 6.8. In this frst case, the central spring with the spring constant k 2 is not stretched or compressed. Since the initial displacements are equal, the output displacements are in-phase and the fourth-order system behaves as a second-order system. Now let us try moving M1 two units to the right and moving M2 two units to the left at the same time and then release the masses. This is done by setting z1(0) = 2 and z2(0) = −2. This is another dialogue with MATLAB and we initiate it by typing EOCE6_6 at the MATLAB prompt. Initial time for simulation = 0 t_Initial = 0 Final time for simulation = 10 t_final =

FIGURE 6.8

Plots for EOCE 6.6.

State-Space and Linear Systems

295

10 z1(t_initial) z2 (t_initial) dz1 (t_initial) dz2 (t_initial)] = [2 −2 0 0] z0 = 2 −2 0 0 Title = The out-of-phase movements: M1 two units right, M2 two units left. plot_title = The out-of-phase movements: M1 two units right, M2 two units left. The plots are shown in Figure 6.9. In this second case, the central spring is compressed and all spring constants are involved. This example is constructed for equal k and M values. You may experiment with the functions presented using various values for the masses, the spring constants, and the initial conditions.

EOCE 6.7 Consider the system in Figure 6.10. The rod to the left of the mass M can be modeled by a translational spring with spring constant k1, in parallel with a translational damper of constant B1. The rod to the right of the mass M can be modeled by a translational spring with spring constant k 2, in parallel with a translational damper of constant B2. Find the displacement y(t) due to an input x(t).

FIGURE 6.9

Plots for EOCE 6.6.

296

FIGURE 6.10

Continuous Signals and Systems with MATLAB®

System for EOCE 6.7. SOLUTION

The free-body diagram that describes the system is shown in Figure 6.11, where x(t) is the input displacement and y(t) is the output displacement. k1 and k 2 are the stiffness elements and B1 and B2 are the friction elements. The differential equation describing the system is M

d2 d y + ( B1 + B2 ) y + ( k1+ k 2) y = x. dt dt

If we let k = k1 + k 2 and B = B1 + B2, the differential equation becomes M

d2 d x + B x + kx = x. dt dt

This system is similar to the system given previously in EOCE 6.5. Let M = 1, k = 40, d and B = 12. Let z1(t) = y(t) and z2 (t ) = y (t ). Therefore, the state equation is dt ˙ d 0 z (t ) = ˇ dt ˆ −40

˙ 0 ˘ 1 ˘  z (t ) + ˇ  x (t ) , −12  ˆ 1 

and the output equation is y = ˝˙ 1

FIGURE 6.11

˝ z1 ˆ  + [0] x , 0 ˆˇ ˘ ˙˘ z2 ˇ

Free-body diagram for EOCE 6.7.

297

State-Space and Linear Systems with the matrices ˙ 0 A= ˇ −40 ˆ

˙ 0 ˘ 1 ˘  ,˜B =˜ ˇ  ,˜C = ˆ˙ 1 −12  ˆ 1 

0 ˘ ,˜and˜D =˜[ 0 ] ,

and the initial condition vector ˝ 0 ˇ z (0) = ˆ , ˙ 0 ˘ where we assumed that the system is relaxed (zero initial conditions). The solution for the state equation is t

˜

z (t ) = exp ˇ˘ A (t − ˆ )  Bx ( ˆ ) dˆ, 0

where eAt is the inverse Laplace transform of (sI − A) −1. ˆ

s 40 ˇ

( sI − A)−1 = ˘

ˆ ˘ ˘ −1 ( sI − A) = ˘ ˘ ˘ ˇ

ˆ s + 12 1 −1  = 2 ˘ s + 12  s + 12s + 40 ˇ −40

(

(

s + 12 s 2 + 12s + 40

(

−40 2 s + 12s + 40

)

) (

1 s 2 + 12s + 40

)

) (

s 2 s + 12s + 40

)

1   s 

   .   

Finally, ˆ ˘ ˘ ( sI − A)−1 = ˘ ˘ ˘ ˇ

s+6+6

( s + 6)2 + 22 −40

( s + 6)2 + 22

1

( s + 6)2 + 22 s+6−6

( s + 6)2 + 22

   .   

The inverse transform of the last matrix is ˙ e −6t ˜cos 2t + 3e −6t sin 2t ( ) ( ) ˇ ˇ −6t ˜ −20e sin ( 2t ) ˆˇ

(

1/ 2 e −6t ˜ sin ( 2t )

)

e −6t ˜ cos ( 2t ) − 3e −6t ˜ sin ( 2t )

˘  = e At =  (t ) .  

298

Continuous Signals and Systems with MATLAB®

Therefore, using the transition matrix we can write the solution for the state vector as t

˜

z (t ) = exp ˘ˇ A (t − ˆ )  Bx ( ˆ ) dˆ 0

z (t ) =

t

˜ 0

(

)

(

˘ −6( t −ˆ )cos 2 t − ˆ + 3e −6(t −ˆ )sin 2 t − ˆ ( ) ( )  e  −20e −6(t −ˆ )sin 2 (t − ˆ ) 

(

)

)

   ˆ dˆ,  ( ) 

and fnally ˆ e −6t cos ( 2t ) + 3e −6t sin ( 2t ) z (t ) = ˘ ˘ −20e −6t sin ( 2t ) ˇ

 .  

The last result was obtained using the sifting property of the impulse function. The output equation y(t) is y = ˙˝ 1

˝ z1 0 ˇˆ ˘ ˘˙ z2

ˆ  = ˝˙ e −6t cos ( 2t ) + 3e −6t sin ( 2t ) ˆˇ u (t ) . ˇ

We can see that the system is stable because the real part of the poles is negative at −6. We can use MATLAB to fnd the impulse response of the system and compare it with the analytical solution that we just found. To do that we write the script EOCE6_7. The output is shown in Figure 6.12.

FIGURE 6.12

Plots for EOCE 6.7.

299

State-Space and Linear Systems

FIGURE 6.13

System for EOCE 6.8.

EOCE 6.8 Consider the system shown in Figure 6.13. Where θ(t) is the rotational angle, J represents the moment of inertia, where the mass of the rod is concentrated, k is the stiffness coeffcient, w is the angular velocity, and τ is the torque applied. Assume the system was relaxed before applying the torque. Find the rotational angle resulting from the applied torque. SOLUTION The free-body diagram is shown in Figure 6.14. The differential equation describing this rotational system is J

d w (t ) + k˝ (t ) = ˆ (t ) . dt

Rewriting as a function of θ(t), the equation becomes J

d2 ˛ (t ) + k˛ (t ) = ˆ (t ) . dt

This is a second-order differential equation in θ(t), where τ(t) is the input torque. d ˝ (t ), then we can write the system in state-space as If we let z1 = θ(t), and z2 = dt ˙ 0 d z (t ) = ˇ dt ˇˆ −k / J

FIGURE 6.14

1 0

˘ ˙ 0  z (t ) + ˇ  ˇˆ 1/ J

Free-body diagram for EOCE 6.8.

˘  x (t ) , 

300

Continuous Signals and Systems with MATLAB®

and the output equation as ˝ z1 0 ˇˆ ˘ ˘˙ z1

y = ˙˝ 1

ˆ  + [ 0 ] x. ˇ

The initial condition vector is ˝ 0 ˇ z (0) = ˆ . ˙ 0 ˘ If the input torque is an impulse of unity strength, J = 1 kg.m2, and k = 1 newton. meter/rad, we can fnd the displacement angle θ(t). For the given values the system state equation becomes ˙ 0 d z (t ) = ˇ dt ˆ −1

˙ 0 ˘ 1 ˘  z (t ) + ˇ  x (t ) , 0  ˆ 1 

and the output equation becomes ˝ z1 0 ˇˆ ˘ ˘˙ z2

y = ˙˝ 1

ˆ  + [0] x , ˇ

with the initial conditions ˝ 0 ˇ z (0) = ˆ . ˙ 0 ˘ eAt is the inverse Laplace transform of (sI − A) −1 and is calculated next. −1

1 ˙ s −1 ˘  = 2 ˇ s  s + 1 ˆ −1

˙ s ˆ 1

( sI − A)−1 = ˇ

ˆ ˘ ˘ −1 ( sI − A) = ˘ ˘ ˘ ˇ

(

)

(

s s +1

1 s +1

(

−1 s2 + 1

s s2 + 1

)

      

cos (t )

 .  

2

) ( ) (

ˆ cos (t ) e At = ˝ (t ) = ˘ ˘ −sin (t ) ˇ

2

sin (t )

)

1 ˘  s 

301

State-Space and Linear Systems The solution for the states now is calculated as t

˜

z (t ) = exp ˇ˘ A (t − ˆ ) Bx ( ˆ ) dˆ.  0

With Φ(t) as calculated above z (t ) =

t

˜ 0

z (t ) =

t

˜ 0

ˇ cos (t − ˆ )   −sin (t − ˆ ) ˜ ˘ ˇ sin (t − ˆ )   cos (t − ˆ ) ˘

sin (t − ˆ )

cos (t − ˆ )

ˇ    0   ( ˆ ) dˆ ˘ 1  

   ( ˆ ) dˆ.  

Using the sifting property we have the displacement and the velocity angles as ˙ ˝ (t ) ˇ z (t ) = ˇ d ˇ dt ˝ (t ) ˆ

˘ ˙ sin (t )   = ˇˇ cos (t )  ˆ 

˘ .  

We can use MATLAB to display the angular displacement and the angular velocity by writing the script EOCE6_8. The output plot is shown in Figure 6.15.

FIGURE 6.15

Plots for EOCE 6.8.

302

Continuous Signals and Systems with MATLAB®

EOCE 6.9 Consider the thermal system shown in Figure 6.16, where x(t) is the rate at which heat is supplied to the left capacitor. R1 and R 2 are the thermal resistors, T1 and T2 are the temperatures in the two sections as shown, and ambient is the outside temperature. Assume, excluding R1 and R 2, that the system is insulated. Let T1 and T2 be the two state variables. Find T1 and T2. SOLUTION Using the general relation d 1 T = ( rate _ heat _ in − rate _ heat _ out ) , dt C we can write 1˙ 1 d ˘ T1 = x (t ) − (T1 − T2 )  dt C1 ˇˆ R1  and d 1 ˙1 1 ˘ T2 = (T1 − T2 ) − (T2 − T )  . C2 ˇˆ R1 R2 dt  As you may notice, this system has two inputs, T and x(t). Let z1 = T1 and z2 = T2. Then the state equation is ˆ −1 ˘ C1R1 d z (t ) = ˘˘ dt 1 ˘ C ˘ˇ 1R1

1 C1R1

− (R2 + R1) C2R2R1

   z t + ˆ 1/ C1  ( ) ˘ 0 ˘ˇ  

0 1/ R2C2

and the output equation is y = ˙˝ 1

FIGURE 6.16 System for EOCE 6.9.

˝ z1 ˆ  + [0] x , 0 ˇˆ ˘ ˙˘ z2 ˇ

 ˆ x (t ) ˘  ˘ˇ T

 , 

303

State-Space and Linear Systems with the initial condition ˝ z1 ( 0 ) z (0) = ˆ ˆ z2 ( 0 ) ˙

ˇ .  ˘

For the purpose of simulation only, let R1 = R 2 = 1 ohm, T = 104 kelvin, C1 = C2 = 1, and x(t) = 0. Assume zero initial conditions. The state equations become ˙ −1 d z (t ) = ˇ dt ˆ 1

˙ 0 ˘ 1 ˘ ,  z (t ) + ˇ −2  ˆ 104 

and the output becomes ˝ z1 ˆ  + [0] x , 0 ˇˆ ˘ ˙˘ z2 ˇ

y = ˝˙ 1 with the initial conditions

˝ 0 ˇ z (0) = ˆ . ˙ 0 ˘ The eigenvalues of this system are found by setting (det (sI − A)) = 0), or by using MATLAB as in the following. A= [−1 1 ; 1 −2]; eig(A) The output is then − 0.3820 − 2.6180 eAt is the inverse Laplace transform of (sI − A)−1 and is needed to fnd the solution of the state equation. ˆ s +1 ˇ −1

( sI − A)−1 = ˘ ˆ ˘ ˘ −1 ( sI − A) = ˘ ˘ ˘ ˇ

−1

ˆ s+2 1 −1   = 2 ˘ 1 s+2  s + 3s + 1 ˇ

(

)

(

s+2 s 2 + 3s + 1

1 s 2 + 3s + 1

(

1 2 s + 3s + 1

s +1 2 s + 4s + 1

) ( ) (

) )

      

1   s +1 

304

Continuous Signals and Systems with MATLAB®

Using partial fraction expansion we get ˆ 0.2764 0.7236 + ˘ −1 s + 2.618 s + 0.382 ˘ ( sI − A) =˜ ˘ −0.4472 0.4472 + ˘ s + 2.618 s + 0.382 ˇ

−0.4472 0.4472 + s + 2.618 s + 0.382 0.7236 0.2764 + s + 2.618 s + 0.382

  .   

The inverse transform of the last matrix is the state-transition matrix. −4472e −2.618t + 0.4472e −0.382t ˘  = e At =  (t ) 0.7236e −2.618t + 0.274e −0.382t 

˙ 0.2764e −2.618t + 0.7236e −0.382t ˇ −2.618t + 0.4472e −0.382t ˆˇ −0.4472e The state solution is t

˜

z (t ) = exp ˇ˘ A (t − ˆ )  Bx ( ˆ ) dˆ. 0

With Φ(t) substituted in the above convolution integral we have

z (t ) =

t

˜ t

( (

ˇ −2.618(t − ) + 0.4472e −0.382(t − )  104 −0.4472e  −2.618(t − ) + 0.2764e −0.382(t − )  104 0.7236e ˘

)

)

   d  

˙ −2.618t ˙ − 1 − 1.1707 e −0.382t − 1 ˇ˘  104 ˆ0.1708 e z (t ) =˜   104 ˙ˆ −0.2764 e −2.618t − 1 − 0.7236 e −0.382t −1 ˇ˘ ˆ

(

)

(

(

)

) )

(

ˇ  ,  ˘

where

(

(

)

(

))

z1 (t ) = T1 (t ) = 104 0.1708 e −2.618t − 1 − 1.1707 e −0.382t − 1 . We can plot the temperature in the frst capacitor using MATLAB by writing the script EOCE6_9. The output is shown in Figure 6.17.

EOCE 6.10 Consider the circuit in Figure 6.18. Find the voltages in the capacitors and the resistors as well as the current in the inductor with x(t) as a step input of unity magnitude. Use MATLAB to verify the results. What are the poles of the system? What can you say about its stability?

305

State-Space and Linear Systems

FIGURE 6.17

Step response for EOCE 6.9.

FIGURE 6.18

Circuit for EOCE 6.10. SOLUTION

We will use the state-space approach and let the voltages in the capacitors be represented by the states z1 and z2. We will also let the third state be the current in the inductor and call it z3. The voltages in the resistors will be calculated after we fnd the three independent states. Since our system has three independent energy storage elements, we will only have these three states. Remember that resistors are not storage elements to start with.

306

Continuous Signals and Systems with MATLAB®

Using nodal analysis as well as some loop equations, we come up with the following equations: d d z1 + z2 − z3 = 0 dt dt z1 = z2 + x = 10z3 +

d z2 dt

d z3 + z1. dt

We can rearrange the equations above to get d z1 = −z1 + z2 + z3 dt d z2 = z1 − z2 dt d z3 = −z1 − 10z3 + x. dt In the state-space form we write the above system as ˜ d z1 ˛ ˛ dt ˛ d z2 ˛ ˛ dt ˛ d ˛ dt z3 °

˝ ˆ ˆ ˜ −1 ˆ ˛ ˆ=˛ 1 ˆ ˛ −1 ˆ ° ˆ ˙

1 −1 0

1 0 −10

˝ ˜ z1 ˆ˛ ˆ ˛ z2 ˆ˙ ˛ z3 °

1 −1 0

1 0 −10

˝ ˜ 0 ˝ ˆ ˛ ˆ ˆ + ˛ 0 ˆ x, ˆ ˛ 1 ˆ ˙ ˙ °

where ˛ −1 A = ˙˙ 1 ˙˝ −1

ˆ ˘ ˘ ˘ˇ

and ° 0 ˙ B = ˝˝ 0 ˇˇ . ˝˛ 1 ˇˆ Since A is not in the diagonal form, we need to diagonalize it in order to arrive at the analytical solution for the states.

307

State-Space and Linear Systems The real-time solution in this case is t

˜

w (t ) = exp ˙ˆP −1APt ˇ˘ w ( 0 ) + exp ˆ˙P −1AP (t −  ) ˇ˘ P −1Bx (  ) d, 0

with z(t) = Pw(t), where P is the matrix that diagonalizes A. Since w(0) = P−1z(0), and because z(0) = 0, and w(0) = 0, we get t

˜

w (t ) = exp ˘ˇP −1AP (t − ˆ )  P −1Bx ( ˆ ) dˆ. 0

We will start by fnding the matrix P that diagonalizes A. P is the matrix that contains the eigenvectors of A. We will use MATLAB to fnd the eigenvalues and eigenvectors of A. Knowing the eigenvalues of A, we can determine the stability of the system. If the real parts of the eigenvalues are all negative, then the system is stable. We will write the following script in MATLAB to do that. A = [−1 1 1 ; 1 −1 0 ; −1 0 −10] ; [VA, DA] = eig (A); P = VA Pinverse = inv (P) PinverseAP = inv (P) *A*P The output is P = −0.6875 −0.7229 0.0691

−0.7259 0.6816 0.0915

−0.1132 0.0127 0.9935

−0.6941 −0.7383 0.1163

−0.7299 0.6932 −0.0131

−0.0698 −0.0930 1.0200

−0.0490 0.0000 0.0000

0.0000 −2.0650 0.0000

0.0000 0.0000 −9.8860

Pinverse =

PinverseAP =

308

Continuous Signals and Systems with MATLAB®

Since the eigenvalues are all negative, the system is stable. To fnd w(t), we need the following matrices frst. ˛ −0.0698 ˆ ˙ ˘ P −1B = ˙ −0.0930 ˘ ˙˝ 1.0200 ˘ˇ

e

e

e

P −1APt

° e −.049t ˝ =˝ 0 ˝ 0 ˛

° e −.049(t − ) ˝ P B=˝ 0 ˝ 0 ˛˝

P −1AP (t − )

−1

0 e

e −9.886t

0 0

˙° ˙ ˇ ˝ −0.069 ˇ ˇ −0.093 0 ˝ ˇ ˇ e −9.886(t − ) ˆˇ ˝˛ 1.02 ˇˆ 0

e −2.065(t − ) 0 ˆ ˘ ˘ ˘ ˇ˘

˛ −0.069e −.049(t − ) ˙ P B = ˙ −0.093e −2.065(t − ) ˙ −9.886(t − ) ˙˝ 1.02e

P −1AP (t − )

˙ ˇ ˇ ˇ ˆ

0 0

−2.065t

−1

The new state solution is

t

˜

w (t ) =

0

ˆ −0.069e −.049(t − ) ˘ ˘ −0.093e −2.065(t − ) ˘ −9.886(t − ) ˘ˇ 1.02e

( (

) )

   .   

ˆ 1.408 e −0.049t − 1  ˘  ˘ −2.065t = −1 d  ˘ 0.045 e  ˘ −9.886t  −1 ˘ −0.1032 e ˇ

(

)

With z(t) = Pw(t) z (t ) = ˝ −0.049t ˝ − 1 ˆ − 0.7259 ˝0.045 e −2.065t − 1 ˆ − 0.1132 ˝ −0.1032 e −9.886t − 1 ˆ  −0.6875 ˙1.408 e ˇ ˙ ˇ ˙ ˇ  − 0.049 t −2.065 t − 9.886 t ˝ ˝ ˆ ˆ ˝  −0.7229 1.408 e − 1 + 0.6816 0.045 e − 1 + 0.0127 −0.1032 e −1 ˆ ˙ ˙ ˇ ˇ ˙ ˇ   −0.049t −2.065t −9.886t ˝ ˆ ˆ ˝ ˆ ˝ − 1 + 0.0915 0.045 e − 1 + 0.9935 −0.1032 e −1  0.069 ˙1.408 e ˙ ˇ ˇ ˙ ˇ ˙

( (

(

) )

)

( (

(

) )

)

( (

) )

(

)

or ˛ z1 (t ) ˙ ˙ z2 ( t ) ˙ ˙ z3 (t ) ˝

ˆ ˛ −0.049t − 0.0327e −2.065t + 0.0117e −9.886t + 1 ˘ ˙ −0.968e ˘ = ˙ −1.0294e −0.049t + 0.0307e −2.065t − 0.0013e −9.886t + 1 ˘ ˙ 0.0973e −0.049t + 0.0041e −2.065t − 0.1025e −9.886t ˘ ˇ ˝

ˆ ˘ ˘. ˘ ˇ

ˆ   ,    ˇ

State-Space and Linear Systems

309

Notice that as time becomes large, the two capacitors will have the same voltage. We will demonstrate that using plots. Now let us write the following MATLAB function that we will use to compare the output from MATLAB and the output using the results just obtained. We start with the function that defnes the system and call it eoce10.m. Next we write the script EOCE6_101 that calls the functions eoce10.m and ode23. The plots are shown in Figure 6.19. If we increase the simulation time we see that the voltages in the two capacitors approach the input step signal of unity magnitude, as shown in Figure 6.20. Now we write the MATLAB script EOCE6_102 that simulates the hand calculations we obtained. The plots are shown in Figure 6.21. If we increase the simulation time to 100 seconds, we obtain the plots in Figure 6.22.

FIGURE 6.19

Plots for EOCE 6.10.

310

Continuous Signals and Systems with MATLAB®

FIGURE 6.20

Plots for EOCE 6.10.

FIGURE 6.21

Plots for EOCE 6.10.

311

State-Space and Linear Systems

FIGURE 6.22

Plots for EOCE 6.10.

EOCE 6.11 Consider the following differential equation. d2 d y (t ) + 7 y (t ) + 12y (t ) = 10x (t ) dt dt 1. 2. 3. 4. 5.

Find the impulse response representation. Find the transfer function representation. Find the block diagram representation. Find the state-space representation Find the step and the impulse response of the system. SOLUTION

1. The impulse response representation We can calculate the impulse response in many ways. Graphically, the impulse response representation is calculated using the MATLAB script num = [10]; den = [1 7 12] ; impulse (num, den) The output plot is shown in Figure 6.23.

312

Continuous Signals and Systems with MATLAB®

FIGURE 6.23

Plot for EOCE 6.11.

Using MATLAB symbolic toolbox function “dsolve,” we can write the script EOCE6_111. The output is impulse = −10/exp(t)^4 + 10/exp(t)^3 and the plot is shown in Figure 6.24. Using partial fraction expansion with MATLAB, we write the script num = [10]; den = [1 7 12] ; [R, P, K] = residue (num, den) The output is R = − 10 10 P = − 4 − 3 K = [ ]

313

State-Space and Linear Systems

FIGURE 6.24

Plot for EOCE 6.11.

In this case H (s) =

−10 10 + s+4 s+3

and

(

)

h (t ) = −10e −4t + 10e −3t u (t ) which if plotted against time will produce the same fgure as Figure 6.24. 2. The transfer function representation We can Laplace transform the differential equation with zero initial conditions to get s 2Y ( s ) + 7sY ( s ) + 12Y ( s ) = 10X ( s ) with the transfer function H (s) =

Y (s) 10 = X ( s ) s 2 + 7s + 12

314

Continuous Signals and Systems with MATLAB®

FIGURE 6.25

Block for EOCE 6.11.

3. The block diagram representation The block diagram can be drawn directly from H(s) as shown in Figure 6.25. 4. The state-space representation d We will let z1(t) = y(t) and z2 (t ) = y (t ). Then dt d z1 (t ) = z2 (t ) dt d z2 (t ) = −12z1 (t ) − 7z2 (t ) + 10x (t ) dt and the state matrix equation is d z = Az + Bx dt with ˙ 0 A= ˇ ˆ −12

˙ 0 ˘ ˙ 0 ˘ 1 ˘  ,˜and˜z ( 0 ) = ˇ   ,˜B =˜ ˇ −7  ˆ 10  ˆ 0 

5. The step and the impulse responses To accomplish that we use the MATLAB script EOCE6_112. The output is shown in Figure 6.26.

EOCE 6.12 Consider the block diagram representation shown in Figure 6.27. Represent the system using the other representations discussed previously. SOLUTION 1. The differential equation representation

315

State-Space and Linear Systems

FIGURE 6.26

Plots for EOCE 6.11.

The output of the second integrator is y. Let the input to the second integrator be A. Let the output of the frst integrator be B. The input to the frst integrator is (x − 12y). But

( x − 12y ) = dtd B and A= x+B=

FIGURE 6.27

System for EOCE 6.12.

d y dt

316

Continuous Signals and Systems with MATLAB® Also d d d d d2 A= x+ B= x + x − 12y = y dt dt dt dt dt The differential equation representing the system is then d2 d x (t ) y (t ) + 12y (t ) = x (t ) + dt dt 2. The transfer function representation Let us Laplace transform the differential equation with zero initial conditions to get s 2Y ( s ) + 12Y ( s ) = X ( s ) + sX ( s ) with the transfer function Y (s) s +1 = = H (s) X ( s ) s 2 + 12 Let us work with the block diagram directly. From the diagram Y ( s ) = 1/s [ A] = 1/s ˇ˘ X ( s ) + B Substituting for B we get Y ( s ) = 1/s ˆˇ X ( s ) + 1/s ˇˆ X ( s ) − 12Y ( s ) ˘ ˘ or ˝1 1 ˇ ˝ 12 ˇ Y ( s ) ˆ1+ 2  = X ( s ) ˆ + 2  s ˘ ˙s s ˘ ˙ Y ( s ) ˆˇ s 2 + 12˘ = X ( s ) [ s + 1] The transfer function fnally is H (s) =

Y (s) s +1 = X ( s ) s 2 + 12

3. The impulse response representation The impulse response representation can be calculated graphically and analytically. Graphically it can be found using the MATLAB command Impulse ([1 1], [1 0 12]);

317

State-Space and Linear Systems The plot is shown in Figure 6.28. Analytically H (s) =

s +1 s 1 = + s 2 + 12 s 2 + 12 s 2 + 12

Using the table for the Laplace transform we can write h(t) as h (t ) = cos

(

)

12t u (t ) +

1 sin 12

(

)

12t u (t )

This h(t) agrees with Figure 6.28. 4. The state-space representation We will use MATLAB to fnd the state-space representation. Let us create the following script in MATLAB. num = [1 1] ; den = [1 0 12] ; t = tf (num, den) % create the transfer function model ssr = ss (t) % create the state-space representation

FIGURE 6.28

Plot for EOCE 6.12.

318

Continuous Signals and Systems with MATLAB® The output is Transfer function s + 1 -------s^2 + 12 a = ˜ x1 x2

x1 0 4.00000

x2 −3.00000 0

b = ˜ x1 x2

u1 1.00000 0

c = ˜ y1

x1 1.00000

x2 0.25000

d = ˜ y1

u1 0

This indicates that ˙ 0 A= ˇ ˆ 4

˙ 1 ˘ −3 ˘  ,B = ˇ  ,˜C = ˙ˆ 1 0  ˆ 0 

0.25 ˘ ,˜and˜D = [ 0 ]

If we do not use MATLAB and try to write the state-space representation, d y (t ) − x (t ). we will let z1(t) = y(t) and z2 (t ) = From the differential equationsdt d d z1 (t ) = y (t ) = z2 ( t ) + x ( t ) dt dt d d2 d z2 ( t ) = y (t ) − x (t ) = x (t ) − 12z1 (t ) dt dt dt the state and the output matrix equations are d z = Az + Bx dt y = Cz + Dx

319

State-Space and Linear Systems with ˇ 0 A=  ˘ −12 C = ˇ˘ 1

ˇ 0  ˇ 1  1   ,˜  ,˜B =˜   , z (0) =  0  1 ˘  ˘ 0  0  ,˜and˜D =˜[ 0 ]

with C as given, y = z1(t). You also can see that the two state-space models or representations are different. Let us plot the output y(t) in both cases and then we will make a conclusion. For both models we frst defne the system in MATLAB by writing the function eoce12.m. For the model we derived we write the MATLAB script EOCE6_121. The plot is shown in Figure 6.29. For the MATLAB model the script EOCE6_122 is used The plot is shown in Figure 6.30. It is clear that the two plots are identical and therefore, the statespace representations for the same system are not unique. We can also obtain the state-space representation directly from the block diagram. Let the output of the second integrator be z1 and the output of the frst integrator be z2.

FIGURE 6.29

Plot for EOCE 6.12.

320

Continuous Signals and Systems with MATLAB®

FIGURE 6.30

Plot for EOCE 6.12.

In this case y = z1 By differentiating we get d z1 = z2 + x dt Also d z2 = x − 12z1 dt The resulting state matrices are ˙ 0 A= ˇ ˆ −12

˙ 1 ˘ 1 ˘  ,˜B =˜ ˇ  ,˜C =˜ ˆ˙ 1 0  ˆ 1 

0 ˘ ,˜and˜D =˜[ 0 ]

321

State-Space and Linear Systems

EOCE 6.13 Consider the impulse response of a certain system as h (t ) = 10e −2tu (t ) − 10e −4tu (t ) Derive the other representations. SOLUTION 1. The transfer function representation The inverse Laplace transform of the impulse response gives the transfer function. Laplace transform the given h(t) to get H (s) =

10 10 − s+2 s+4

or H (s) =

10 ( s + 4 ) − 10 ( s + 2) 20 = 2 s 2 + 6s + 8 s + 6s + 8

2. The differential equation representation Remember that the impulse response is obtained by setting the initial conditions to zero. H (s) =

Y (s) 20 = X ( s ) s 2 + 6s + 8

or we can write Y ( s ) ˇˆ s 2 + 6s + 8 ˘ = X ( s ) [ 20 ] Let us now inverse transform term by term to get d2 d y (t ) + 6 y (t ) + 8y (t ) = 20x (t ) dt dt 3. The block diagram representation The block diagram is shown in Figure 6.31. 4. The state-space representation First we will use MATLAB to do that. Here is the MATLAB script. num = [20]; den = [ 1 6 8 ] ; t = tf(num, den); % create the transfer function model ssr = ss(t) % create the state-space representation

322

Continuous Signals and Systems with MATLAB®

FIGURE 6.31

Block for EOCE 6.13.

The output is a = ˜ x1 x2

x1 −6.00000 4.00000

x2 −2.00000 0

b = ˜ x1 x2

u1 2.00000 0

c = ˜ y1

x1 0

x2 2.50000

˜ y1

u1 0

d =

The state-space matrices are then ˙ −6 A= ˇ ˆ 4

˙ 2 ˘ −2 ˘  ,˜B = ˇ  ,˜C = ˙ˆ 0 0  ˆ 0 

2.5 ˘ ,˜and˜D = [ 0 ]

The output is

(

y (t ) = Cz + Dx = 2.5 z2 (t )

)

323

State-Space and Linear Systems Second, we can fnd the state-space model in another way. Let us defne the states as d d z1 (t ) = y (t ) = z2 ( t ) dt dt d d2 z2 ( t ) = y (t ) = 20x (t ) − 8z1 (t ) − 6z2 (t ) dt dt and the state and output matrix equations are then d z = Az + Bx dt y = Cz + Dx with ˇ 0 A=  ˘ −8 C = ˇ˘ 1

ˇ 0  ˇ 0  1   ,˜B =   ,˜z ( 0 ) =   ,˜ −6  ˘ 20  ˘ 0  0  ,˜and˜D = [ 0 ]

The output is y (t ) = Cz + Dx = z1 (t ) You can see that the two models are not the same by comparing the matrices that we obtained in both cases. But the plots will show that the two models produce the same response. The script to create the plots is EOCE6_13. The function that defnes the system is the same as the function in the last example. The plot is shown in Figure 6.32.

EOCE 6.14 Consider the single-input single-output system in state-space. ˙ 0 A= ˇ ˆ −8

˙ 0 ˘ 1 ˘  ,˜B = ˇ  ,˜C = ˙ˆ 1 −6  ˆ 20 

0 ˘ ,˜and˜D = [ 0 ]

Derive the other representations. SOLUTION 1. The transfer function representation We will do that in two ways: one is analytical and the other is by using MATLAB.

324

Continuous Signals and Systems with MATLAB®

FIGURE 6.32

Plots for EOCE 6.13.

Analytically, consider the solutions of the state-space model in the Laplace domain Z ( s ) = ˜( sI − A) BX ( s ) −1

and Y ( s ) =˜CZ ( s ) + DX ( s ) Substituting for Z(s) in Y(s) to get Y ( s ) = ˜C ( sI − A) BX ( s ) + DX ( s ) −1

and the transfer function is Y (s) −1 = C ( sI − A) B + D X (s)

325

State-Space and Linear Systems We will substitute for the matrices and get

H ( s ) = ˙˝ 1

˝ s+6  2 6s + 8 s +  0 ˇˆ  −8  2 ˙ s + 6s + 8

1 s + 6s + 8 s s 2 + 6s + 8 2

ˆ ˝ ˆ  0   ˙ 20 ˇ  ˇ

And fnally, the transfer function is H (s) =

20 s 2 + 6s + 8

Using MATLAB, we write the MATLAB script A= [0 1; −8 −6]; B = [0; 20]; C = [1 0]; D = 0; [num, den] = ss2tf (A,B,C,D) The output is num = 0

0

20.0000

den = 1

6

8

Therefore, the transfer function is H (s) =

0s 2 + 0s + 20 20 = 2 1s 2 + 6s + 8 s + 6s + 8

2. The block diagram representation The system is second order and hence we need two integrators. The diagram is shown in Figure 6.33.

FIGURE 6.33

Block for EOCE 6.14.

326

Continuous Signals and Systems with MATLAB® 3. The differential equation representation The state equation is ˙ 0 d z=ˇ dt ˆ −8

1 ˘ ˙ z1 ˇ −6  ˇˆ z2

˘ ˙ 0 ˘ +ˇ  x (t )  ˆ 20 

where d z1 (t ) = 0z1 + 1z2 (t ) + 0x (t ) dt d z2 (t ) = −8z1 (t ) − 6z2 (t ) + 20x (t ) dt If we let z1(t) = y(t) and z2 (t ) =

d y (t ) then dt

d d y (t ) z1 (t ) = dt dt d d2 z2 ( t ) = y (t ) dt dt Now substitute in for the second derivative of y to get d z2 (t ) = −8z1 (t ) − 6z2 (t ) + 20x (t ) dt or fnally d d2 y (t ) = −8y (t ) − 6 y (t ) + 20x (t ) dt dt

6.9 END-OF-CHAPTER PROBLEMS EOCP 6.1 Consider the following matrices. ° 1 A=˝ ˛ 0

° 3 0 ˙ ,B = ˝ 2 ˇˆ ˛ 0

° 1 0 ˙ ,C = ˝ 4 ˇˆ ˛ 1

° 1 1 ˙ ,˜and˜ D = ˝ 2 ˇˆ ˛ 0

Find the following. 1. (A + B), (A − B), (A − C), and (A + C) 2. AB, BA, AC, CA, ABC, and CBA 3. det (A), det (B), det (C), det (AB), and det (AC)

1 ˙ . 2 ˇˆ

327

State-Space and Linear Systems

4. 5. 6. 7. 8. 9. 10. 11.

A−1, B−1, C−1, (AB)−1, (BA)−1, A−1 B−1, and (ABC)−1 The transpose: A′, B′, C′, (AB)′, (ABC)′, A′B′, and (AB)′C′ Eigenvalues for A and B Eigenvectors for A and B eAt and eBt Diagonalize C and D as P1 and P2, respectively P1−1CP1 and P2−1 DP2 Eigenvalues for C, P1−1CP1, D, and P2−1 DP2

EOCP 6.2 Let ° 11 A=˝ ˛ 0

2 ˙ 1 ˆˇ

° 2 B=˝ ˛ 1

5 ˙ . 6 ˇˆ

and

Use the six methods described in this chapter to fnd 1. eAt and eBt 2. eABt and eBAt EOCP 6.3 Consider the following systems. 1.

d y ( t ) + ay ( t ) = x ( t ) dt

2.

d d2 y ( t ) + a y ( t ) + by ( t ) = x ( t ) dt dt

3.

d d2 y (t ) + a y (t ) = x (t ) dt dt

4.

d2 y ( t ) + by ( t ) = x ( t ) dt

5.

d2 d d3 y (t ) + a y ( t ) + b y ( t ) + cy ( t ) = x ( t ) dt dt dt

6.

d2 d d3 y (t ) + a y (t ) + b y (t ) = x (t ) dt dt dt

328

Continuous Signals and Systems with MATLAB®

7.

d3 d2 y (t ) + a y (t ) = x (t ) dt dt

8.

d3 d y (t ) + b y (t ) = x (t ) dt dt

9.

d3 y ( t ) + cy ( t ) = x ( t ) dt

Write the state equations for each system but do not solve for the states. d2 d Assume y(0) = y00, y ( 0 ) = y01, and y ( 0 ) = y02 . Under what conditions are the dt dt above systems stable? EOCP 6.4 Consider the system shown in Figure 6.34. Let R1 = R2 = 1 ohm, L1 = 0 henry, L2 = 1 henry, and C = 1 farad. Solve for the output y(t) using state variables in the time domain and the Laplace domain if the input is an impulse of unity strength. Is the system stable? EOCP 6.5 Consider the system shown in Figure 6.35. The rod to the left of the mass M can be modeled by a translational spring with spring constant k. The rod to the right of the mass M can be modeled by a translational damper of constant B. Let M = 1 kg, k = 10 N/m, and B = 5 N/m/sec. The equation describing the system is d2 d y ( t ) = −10 y ( t ) + x ( t ) . dt dt Solve for the output y(t) using state variables in the time domain and the Laplace domain if the input is an impulse of unity strength. Is the system stable?

FIGURE 6.34

System for EOCP 6.4.

State-Space and Linear Systems

FIGURE 6.35

329

System for EOCP 6.5.

EOCP 6.6 Consider the system in Figure 6.36. Let R1 = R2 = 1, and C = 1 farad. Solve for the output y(t) using state variables in the time domain and the Laplace domain if the input is a unit step signal. Is the system stable? EOCP 6.7 Consider the system in Figure 6.37. The rod above the mass M1 can be modeled by a translational spring with spring constant k1, in parallel with a translational damper of constant B1. The rod above the mass M2 can be modeled by a translational spring with spring constant k2, in parallel with a translational damper of constant B2. Ignore the effect of gravity and let k1 = k2 = 1 N/m, B1 = B2 = 2 N/m/sec, x(t) = sin(t), and M1 = M2 = 1 kg. The equation describing the system is d4 d3 d2 d d2 d y (t ) + 6 y (t ) + 7 y (t ) + 4 y (t ) + y (t ) = x ( t ) + 4 x ( t ) + 2x ( t ) . dt dt dt dt dt dt Solve for the output y(t) using state variables in the time domain. Is the system stable?

FIGURE 6.36

System for EOCP 6.6.

330

FIGURE 6.37

Continuous Signals and Systems with MATLAB®

System for EOCP 6.7.

EOCP 6.8 Consider the system in Figure 6.38. If R1 = R2 = 1 ohm, C1 = C2 = 1 farad, and x(t) is the impulse function, solve for the output y(t) using state variables in the time domain and the Laplace domain. Is the system stable? EOCP 6.9 Consider the system in Figure 6.39. The differential equation describing the system is d3 d ˛ ( t ) = − ( B /J ) ˛ ( t ) + (1/J ) T ( t ) . dt dt The rod is attached to a fxed end and can be represented as a rotational damper only. The moment of inertia J represents the concentration of the mass M. A torque T is applied and it produces the angular rotation.

FIGURE 6.38

System for EOCP 6.8.

State-Space and Linear Systems

331

FIGURE 6.39 System for EOCP 6.9.

With T(t) = 10 N.m, solve for the output θ(t) using state variables in the time domain and the Laplace domain. Is the system stable? EOCP 6.10 Consider the system in Figure 6.40. If R = 1 ohm, C = 1 farad, L = 1 henry, and x(t) = 10cos(2t), solve for the output y(t) using state variables in the time domain and the Laplace domain. Is the system stable? EOCP 6.11 Consider the system in Figure 6.41. Two rods with different masses will give rise to the two moments of inertia J1 and J2. If J1 = J2 = J = 10 kg.m2, k = 5 N.m/rad, and the torque is applied for a very short

FIGURE 6.40

System for EOCP 6.10.

FIGURE 6.41

System for EOCP 6.11.

332

Continuous Signals and Systems with MATLAB®

time that can be represented as an impulse, the relation between θ(t) and T(t) can be described by the differential equation J

d2 d4 ˛ ( t ) + 2kJ ˛ ( t ) = kˆ ( t ) . dt dt

Find θ(t) using the real-time state solution. Is the system stable? EOCP 6.12 Consider the system in Figure 6.42. If R1 = R2 = 1 ohm, C = 1 farad, L = 1 henry, and x(t) is u(t), solve for the output y(t) using state variables in the time and the Laplace domains. Is the system stable? EOCP 6.13 Consider the following rotational system. 2

d3 d ˛ ( t ) + ˛ ( t ) + 2˛ ( t ) = ˆ ( t ) dt dt

Find θ(t) using the real-time state equation solution. Is the system stable? EOCP 6.14 Consider the system shown in Figure 6.43. If R1 = R2 = 1 ohm, C1 = C2 = 1 farad, and x(t) is u(t), solve for the output y(t) using state variables in the time domain and the Laplace domain. Is the system stable?

FIGURE 6.42

System for EOCP 6.12.

State-Space and Linear Systems

FIGURE 6.43

System for EOCP 6.14.

FIGURE 6.44

System for EOCP 6.15.

333

EOCP 6.15 Consider the system in Figure 6.44. With Jload = Jmotor = J = 2 kg.m2, k = 10 N/m, and T(t) = u(t), the dynamics that relate the angular rotation at the load side and the torque are given as 2

d5 d2 ˛load + 20 ˛load = 10u ( t ) . dt dt

Find the angular rotation at the load using the state equations in real time. Is the system stable? EOCP 6.16 Consider the system in Figure 6.45.

FIGURE 6.45

System for EOCP 6.16.

334

Continuous Signals and Systems with MATLAB®

The transfer function relating the input voltage x(t) to the output angular rotation is ˛(s) k1 / ( RJ ) = x ( s ) s s + (1/J )( D + ( k1 k2 /R ))

(

)

where k1 and k2 are proportionality constants, and D and J are the viscosity and the inertia, respectively. 1. 2. 3. 4.

Find the differential equation representation. Obtain the state-space representation. Draw the block diagram. Give values to the parameters shown in the transfer function. Obtain the impulse response representation. 5. Is the system stable? 6. Repeat by choosing other values for the parameters and obtain the impulse response until the system is stabilized.

EOCP 6.17 Consider the circuit in Figure 6.46. 1. Find the transfer function relating X(s) to the current in the inductor fowing to the right. 2. Derive the differential equation representing the transfer function. 3. Obtain the state-space model. 4. Obtain the impulse response representation. 5. Use any representation to fnd y(t) due to a step input of unity magnitude. 6. Draw the block diagram.

FIGURE 6.46

System for EOCP 6.17.

State-Space and Linear Systems

335

REFERENCES Bequette, B.W. Process Dynamics, Englewood Cliffs, NJ: Prentice-Hall, 1998. Brogan, W.L. Modern Control Theory, 3rd ed., Englewood Cliffs, NJ: Prentice-Hall, 1991. Close, M. and Frederick, K. Modeling and Analysis of Dynamic Systems, 2nd ed., New York, NY: Wiley, 1995. Cogdell, J.R. Foundations of Electrical Engineering, 2nd ed., Englewood Cliffs, NJ: PrenticeHall, 1996. Denbigh, P. System Analysis and Signal Processing, Reading, MA: Addison-Wesley, 1998. Driels, M. Linear Control System Engineering, New York, NY: McGraw-Hill, 1996. Golubitsky, M. and Dellnitz, M. Linear Algebra and Differential Equations Using MATLAB, Stamford, CT: Brooks/Cole, 1999. Harman, T.L., Dabney, J., and Richert, N. Advanced Engineering Mathematics with MATLAB, Stamford, CT: Brooks/Cole, 2000. Kuo, B.C. Automatic Control System, 7th ed., Englewood Cliffs, NJ: Prentice-Hall, 1995. Lewis, P.H. and Yang, C. Basic Control Systems Engineering, Englewood Cliffs, NJ: PrenticeHall, 1997. Moore, H. MATLAB for Engineers, Upper Saddle River, NJ: Prentice Hall, 2007. Nilson, W.J. and Riedel, S.A. Electrical Circuits, 6th ed., Englewood Cliffs, NJ: PrenticeHall, 2000. Nise, N.S. Control Systems Engineering, 2nd ed., Reading, MA: Addison-Wesley, 1995. Ogata, K. Modern Control Engineering, 3rd ed., Englewood Cliffs, NJ: Prentice-Hall, 1997. Ogata, K. System Dynamics, 3rd ed., Englewood Cliffs, NJ: Prentice-Hall, 1998. Phillips, C.L. and Parr, J.M. Signals, Systems, and Transforms, 2nd ed., Englewood Cliffs, NJ: Prentice-Hall, 1999. The MathWorks. The Student Edition of MATLAB, Englewood Cliffs, NJ: Prentice-Hall, 1997. Woods, R.L. and Lawrence, K.L. Modeling and Simulation of Dynamics Systems, Englewood Cliffs, NJ: Prentice-Hall, 1997. Wylie, R.C. and Barrett, C.L. Advanced Engineering Mathematics, 6th ed., New York, NY: McGraw-Hill, 1995. Ziemer, R.E., Tranter, W.H., and Fannin, D.R. Signals Systems Continuous and Discrete, 4th ed., Englewood Cliffs, NJ: Prentice-Hall, 1998

Index Note: Page numbers in italics indicate fgures and bold indicate tables in the text. Φ(t) = eAt, 277–281

A AC voltage source, 21 Adder block diagram, 77, 77; see also Block diagrams Addition; see also Subtraction complex numbers, 119 of two matrices, 246 Algebraic equation, 67, 72–73, 278, 281; see also Equations auxiliary, 84 variable s, 209, 253 Analytical solutions, 8 Angular frequency, 4; see also Frequency Anti-aircraft gun, 22 Approximation; see also Equations Fourier series, 130–131 impulses, 21 signals, 129, 139 Auxiliary equations, 71 algebraic, 84 characteristic, 82 Average power, 6, 39, 147–148

B Band-limited signals, 186; see also Signals Basis functions, Fourier series, 124–125 BIBO, see Bounded-input bounded-output (BIBO) Bilateral Laplace transform, 191 Block diagrams adder, 77, 77 differential equations, 78, 78–81, 80–81 Laplace transform and linear systems, 198, 198–203 parallel systems, 198–199, 199 series systems, 199, 199–200 transfer function, 200–202, 200–203 representation of linear systems, 76–77 adder block diagram, 77, 77 integrator block diagram, 76, 76 multiplier block diagram, 77, 77 subtractor block diagram, 77, 77 three-integrators, 202, 202 Bounded-input bounded-output (BIBO), 55–56 Bounded magnitudes, 136; see also Magnitude

C Capacitance, 45 Capacitors charging and discharging, 1 current, 267 terminal, 1 voltage, 304–305 Causal systems, 52–53, 53 Cayley–Hamilton theorem, 274–276, 279 Characteristic equations, 274–275, 290; see also Equations auxiliary, 82 coeffcients, 73 complex roots, 67–68 continuous systems, 73–76 examples, 100–103 Circuit differential equation, 180 energy, 44, 44 output, 44, 44 single-phase, 30–31, 30–31 Coeffcients characteristic equation, 73 constant, 66, 84 Fourier series, 136, 141 of s2, 203 stiffness, 299 Combination signals, 3; see also Signals Complex conjugate functions, 164 Complex numbers, 119–122 addition, 119 defned, 119 division, 120–121 magnitude, 137 multiplication, 119–120 polar form, 120, 122, 148–149 from polar to rectangular, 121–122 rectangular form, 121, 149 from rectangular to polar, 121 subtraction, 119 Complex roots; see also Roots characteristic equation, 67–68 negative roots, 283 Compressed signals, 12; see also Signals Constants coeffcients, 66, 84 force, 20, 22 numbers, 164

337

338 particular solution, 69 speed, 16 velocity, 16 Contents, frequency, 136, 153, 191 Continuous signals, 1–2, 2, 38; see also Signals Continuous systems, 47–116; see also Systems block diagram representation of linear systems, 76–77 adder block diagram, 77, 77 integrator block diagram, 76, 76 multiplier block diagram, 77, 77 subtractor block diagram, 77, 77 calculating, 83–85 eigenvalues, 84 stability and eigenvalues, 84–85 characteristic equation, 73–76 convolution, 56–58 differential equations, 66 to block diagrams, 79–81, 80–81 from block diagrams to, 78, 78–79 homogeneous, 66–68 nonhomogeneous, 68–72 examples, 85–108 graphical convolution, 61–65, 61–66 impulse response, 81–83 input signals, 47, 48 output signals, 47, 48 particular solution, 69, 69–72 problems, 109–116 simple block diagrams, 58–59, 58–61, 61 systems causal, 52–53, 53 inverse, 54–55, 54–55 linear continuous, 47–50, 48 physical, 66 stability of linear discrete, 73–76 stable, 55–56 time-invariant, 50–52 without memory, 52 Continuous wave, 1 Convolution continuous systems, 56–58 equation, 60, 132 Fourier transform, 162 frequency domain, 166, 167 graphical, 61–65, 61–66, 92–96 integrals, 57, 60, 64, 88, 304 property, 60, 163 time domain, 165 Coupled second-order differential equations, 292; see also Differential equations Critical damping, 290 Currents, 1, 30 capacitor, 267 inductor, 45 resistor, 44–45, 267

Index D Damping; see also Underdamping critical, 290 ratio, 290 Delta function, sifting property, 41 Demodulation, 166 Determinant of 2 × 2 matrix, 247 Diagonal matrix, 249–250, 262, 272–273 Diagrams, see Block diagrams Differential equations, 66, 103, 133; see also Equations block diagrams, 78, 78–81, 80–81 circuit, 180 frst-order, 78, 82, 206, 245, 252, 271 Fourier transform, 181 Laplace transform, 205–207, 316 nonhomogeneous, 68–72 nth-order, 245, 282 physical systems and, 66 rotational system, 299 second-order, 67, 81, 83, 207, 209, 245, 256, 269, 292, 299 single-input/single-output linear secondorder, 255, 282 system, 78 third-order, 67, 83, 201 zero initial conditions, 221 Discontinuous signals, 1, 14, 18; see also Signals Division, complex numbers, 120–121 Domain Fourier frequency, 154–155 Fourier transform, 154 frequency, 147, 156 Dynamic matrix, 288

E Eigenvalues, 260, 262, 274–275, 283, 285–286, 293, 307–308 continuous systems, 84 of matrix, 251 negative, 100 stability and, 84–85 systems, 67 Eigenvectors, 249, 252, 260–261, 285–286, 307 Electric circuit, 14 signals, 47 switch, 14, 21–22 waves, 1 Electromagnetic signals, 1; see also Signals Elevator system, 47 End of transmission, 166 Energy calculation, 6 circuit, 44, 44

Index fnite, 28 inductor current, 45 infnite, 6 of nonperiodic signals, 167–168 signals, 5–6, 7, 27, 27–28, 38 spectral density, 167–168 storage element, 67 Equations; see also specifc equations algebraic, 67, 72–73, 84, 209, 253, 278, 281 auxiliary, 71 characteristic, 274–275, 290 auxiliary, 82 coeffcients, 73 complex roots, 67–68 continuous systems, 73–76 examples, 100–103 convolution, 60, 132 differential, 66–67, 78, 78–79, 133 coupled second-order, 292 frst-order, 78, 82–83, 206, 245, 252, 271 nonhomogeneous, 68–72 nth-order, 245, 282 second-order, 81, 83, 207, 209, 245, 256, 269, 299 single-input/single-output linear secondorder, 255, 282 system, 78, 103 third-order, 67, 83, 201 homogeneous matrix, 252 of motion, 268, 268 output, 245, 271, 298, 300, 302 output matrix, 318–319 state, 245 state-space, 254, 259 Error, Fourier series, 130–131 Even signals, 10–11, 11–12, 23, 25–26, 26, 40; see also Signals Exponential form, Fourier transform, 172–173 Exponent of matrix, 249–250; see also Matrix

F Feed-forward matrix, 271 Filter, low-pass, 167, 167 Final value theorem, 208, 219 Finite discontinuities, 136 Finite energy, 28 First-order differential equations, 67, 78, 82–83, 206, 245, 252, 271 First-order single-input single-output system, 253 Fluid-based system, 14; see also Systems Force constant, 22 impulsive, 21 magnitude, 21 signals, 45, 45

339 Formulae, Fourier transform and linear systems, 168–169 Fourier frequency domain, 154–155 Fourier series, 119–150 approximation and resulting error, 130–131 basis functions, 124–125 coeffcient, 136, 141 complex numbers, 119–122 addition, 119 defned, 119 division, 120–121 multiplication, 119–120 polar form, 120, 122 from polar to rectangular, 121–122 rectangular form, 121 from rectangular to polar, 121 subtraction, 119 conditions for writing signal, 124 examples, 137–148 formula for fnding y(t) when x(t) is periodic, 134–136 frequency components, 136 magnitude spectra, 126 no exact sinusoidal representation for x(t), 136 nonperiodic signals, 153 orthogonal functions, 122–123 Parseval equation, 131–132 periodic signals, 124, 124 phase spectra, 126 problems, 148–150 representation, 124, 130, 133–134 sin and cos functions, 126–129, 127–129, 138 steady-state response, 134–136 sum of, 159 systems with periodic inputs, 132–134, 134 Fourier transform bilateral Laplace transform, 191 differential equation, 181 domain, 154 signals, 157, 183–184 Fourier transform and linear systems, 153–189 defned, 153 energy of nonperiodic signals, 167–168 energy spectral density of linear system, 168 examples, 170–183 formulae, 168–169 infnite periodic signal, 153, 154 overview, 153–154 pairs, 154–167, 155, 165–167 periodic signal, 153, 154 problems, 183–189 Free-body diagram, 268, 268, 296, 296, 299 Frequency angular, 4 components of Fourier series, 136 contents, 136 domain, 147, 156

340 convolution, 166, 167 multiplication, 175–176 time domain, 179–180 natural, 293 power, 31 radian, 21 voltage, 31

G Graphical convolution; see also Convolution continuous systems, 61–65, 61–66 examples, 92–96 Graphical solutions, see Solutions Gulf War, 21

H Homogeneous difference equation and solution, 66–68 case when roots are all distinct, 67 case when two roots are complex, 67–68 case when two roots are real and equal, 67 Homogeneous matrix equation, 252

I Identity matrix, 246, 249, 251, 257, 277, 282; see also Matrix Impulses approximation, 21 function, 34 input, 92 integrals, 35 modeling, 21 response, 316–317, 321 continuous systems, 81–83 function, 168 inverse transform, 203, 204 linear time-invariant (LTI) systems, 60 systems, 58, 96–99, 162–163 signals, 18, 18–19 frequency domain, 156 Laplace transform, 194 mathematical abstraction, 20–21, 20–21 scaling property, 18 shifted, 59 sifting property, 56, 156–157 usage of MATLAB to simulate, 35, 36 weighted, 57 Impulsive force, 21, 267 Impulsive input, 224 Inductor current, 45 voltage, 267 Infnite energy, 6 Infnite magnitude, 18, 21

Index Infnite periodic signal, 153, 154 Initial conditions, 69, 71–73, 104, 300 Initial value theorem, 208 Input; see also Output bounded, 55–56 impulse, 92 integrator, 79 phase angle, 134 ramp, 224 RC circuit, 22 signals, 22, 49–50 continuous systems, 47, 48 electrical, 47 step, 304 systems, 54, 57, 66, 72 unit step, 91–92 voltage, 334 zero, 73 Instantaneous power, 6, 31, 44 Integrals convolution, 57, 60, 64, 88, 304 evaluating, 34 Fourier transform, 170, 178 impulse, 35 Laplace transform, 194 for orthogonal functions, 123 sifting property, 19, 159 systems, 52 Integrand, 34 Integrator block, 76, 76, 80 input, 79 output, 78 Intermediate output, 91 Inverse Laplace method, 276–277 Inverse Laplace transform, 193–198, 212, 254, 258, 269, 300, 303, 321 Inverse of matrix, 248 Inverse systems, 54–55, 54–55 Inverse transform, 157, 164, 203–204, 288 Isolated pulse, 168

L Laplace domain, 272 Laplace method, inverse, 276–277 Laplace transform bilateral, 191 defned, 191 differential equations, 316 impulse signal, 194 integrals, 194 inverse, 193–198, 212, 254, 258, 269, 300, 303, 321 matrix differential equation, 253 matrix state equation, 257 properties, 193

Index second derivative, 210 solving state-space equations using, 272 third derivative, 211 unilateral, 191–192 Laplace transform and linear systems, 191–243 bilateral Laplace transform, 191 block diagram, 198, 198–203 parallel systems, 198–199, 199 series systems, 199, 199–200 transfer function, 200–202, 200–203 examples, 209–233 fnal value theorem, 208 initial value theorem, 208 inverse Laplace transform, 193–198 poles and zeros, 208–209 poles of system, 209 stability of system, 209 zeros of system, 209 problems, 233–243 solving differential equations using, 205–207 solving LTI systems using, 203–205, 204–205 unilateral Laplace transform, 191–192 Linear combination, 245, 271 Linear systems, 57, 136; see also Laplace transform and linear systems; State-space and linear systems analysis, 153 block diagram representation of, 76–77, 76–77 continuous, 47–50, 48 discrete continuous systems, 73–76 energy spectral density of, 168 examples, 85–86 Linear time-invariant (LTI) systems, 57, 60, 66, 84, 132, 168–169 Laplace transform, 203–205, 204–205 output, 207 transfer function, 198 Load resistor, 20, 39 Low-pass flter, 167, 167 LTI, see Linear time-invariant (LTI) systems

M Magnitude bounded, 136 complex number, 137 force, 20–21 functions, 64 infnite, 18, 21 output, 56 of signals, 2, 2, 4 spectra, 126, 165–166, 186 of step signal, 14, 14 voltage of constant, 20

341 MATLAB® eigenvectors, 286 function roots, 73 impulse responses, 315 magnitude, 138 to plot signals, 29, 29–30 roots, 100–102 script, 31, 31, 76, 90, 92, 94–97, 99, 105, 107, 139, 142, 221, 229, 232 to simulate signals, 35 state-space representation, 317 sum of odd and even signals, 26, 27 Matrix (2 × 2), 275–276 defned, 246 diagonal, 249–250, 262, 272–273 dynamic, 288 eigenvalues of, 251 exponent of, 249–250 feed-forward, 271 identity, 246, 249, 251, 257, 277, 282 inverse of, 248 multiplication, 248–249, 262 output equations, 318–319 roots of homogeneous equation, 252 state-space Laplace representation, 270 state-transition, 277 transition, 279 transpose of, 248 Matrix algebra, state-space and linear systems, 246–270 addition of two matrices, 246 determinant of 2 × 2 matrix, 247 diagonal form of matrix, 249 eigenvalues of matrix, 251 eigenvectors of matrix, 252 exponent of matrix, 249–250 identity matrix, 246 inverse of matrix, 248 matrix multiplication, 247–249 observation, 251 special matrix, 250 subtraction of two matrices, 247 transpose of matrix, 248 Mean squared error (MSE), 130–131 Memory, systems without, 52 Modeling impulse, 21 Modeling systems, 245 Modulation, 165 Moment of inertia, 299 Motion rotational, 47 translational, 47 Multiple-input/multiple-output systems, 245, 271 Multiplication complex numbers, 119–120 frequency domain, 175–176

342 integrand, 34 matrix, 247–249, 262 Multiplier block diagram, 77, 77

N Natural frequencies, 293 Negative eigenvalues, 100 Negative roots, 85 Noncausal systems, 53 Nonhomogeneous differential equations and solution, 68–72 Nonperiodic signals, 2–3 energy of, 167–168 Fourier series, 153 time-domain, 153 Nth-order differential equation, 245, 282; see also Differential equations Numbers; see also Complex numbers constant, 164 rational, 3, 5, 29 Numerical evaluation, 273

O Odd signals, 10–11, 11–12, 23, 25–26, 26, 40 Oil spill, 21 Operation refection, 8, 8–9, 10 shifting, 7, 7–8, 24 Orthogonal functions, Fourier series, 122–123 Oscillations, 1 Output; see also Input bounded, 55–56 circuit, 44, 44 equations, 245, 271, 298, 300, 302 initial value of, 224 integrator, 78 intermediate, 91 LTI system, 207 magnitude, 56 matrix equations, 318–319 s-domain, 218 signals of continuous systems, 47, 48 stable, 83 steady-state, 169 systems, 50, 52, 54, 57–59, 66, 71, 84, 87–92, 104–105 voltage, 47–48

P Pairs Fourier transform and linear systems, 154–167, 155, 165–167 Laplace transform, 192 Parallel systems, 198–199, 199; see also Systems

Index Parseval equation, 131–132; see also Equations Parseval theorem, 148 Partial fraction expansion, 176, 188, 205, 254 Fourier transform, 163 inverse transform, 280, 304 roots are not complex, 197 roots of denominator, 196 time domain, 219 transfer function, 258 Particular solution, continuous systems, 69, 69–72 Periodic inputs, systems with, 132–134, 134 Periodicity, 2 Periodic signals, 2–3, 5–6, 29, 38, 44; see also Signals Fourier series, 124, 124 Fourier transform and linear systems, 153, 154 infnite, 153, 154 Phase angle, input, 134 Phase spectra, 126 Physical systems, 16 continuous systems, 66 differential equations and, 66 Polar form, complex numbers, 120, 122, 148–149 Polar to rectangular, complex numbers, 121–122 Poles, 67 stability of state-space and linear systems, 282–283 of system, 209 zeros and, 208–209 Positive roots, 85; see also Roots Power average, 6, 39, 147–148 frequency, 31 instantaneous, 6, 31, 44 signals, 5–6, 7, 27, 27 Property, see Sifting property; Symmetry property Pulse signals, 21; see also Signals

R Radar system, 1, 22 Radian frequency, 21; see also Frequency Ramp input, 224 Ramp signals, 16–17, 17; see also Signals in real world, 22, 22 usage of MATLAB to simulate, 35, 37 Rational numbers, 3, 5, 28 Rectangular form, complex numbers, 121, 149 Rectangular pulse signals, 15, 15–16 Rectangular to polar, complex numbers, 121 Refection operation, 8, 8–9, 10 Resistors current, 267 currents, 44–45

Index load, 20, 39 thermal, 302 voltage, 44, 47, 304–305 RLC circuit, 263, 263–267 Roots algebraic equation, 67 complex, 67–68, 197, 283 of det(λI − A), 260 distinct, 67, 70 of homogeneous matrix equation, 252 negative, 85 positive, 85 real and equal, 67, 70 Rotational motion, 47 Rotational system, 299; see also Systems Routh array, 73, 73–75, 107 Routh test, 73, 107

S Sampling signals, 17, 17; see also Signals Scaling, 25 property, 18 time, 12–14, 12–14, 24 Second-order differential equations; see also Differential equations block diagram, 81 input, 207, 299 output, 83, 207, 209 roots real and equal, 67 state variables, 245, 256, 269 Sending end of transmission, 165, 165 Series systems, 199, 199–200; see also Systems Shifted impulse signals, 59 Shifted signal, 171–172 Shifting operation, 7, 7–8, 24 Shock, 20 Sifting property, 18, 59, 59, 88 delta function, 41 displacement and velocity angles, 301 impulse function, 298 impulse signal, 56, 156–157 integrals, 19, 159 Signals approximation, 129, 139 band-limited, 186 combination, 3 compressed, 12 continuous, 1–2, 2, 38 discontinuous, 1, 14 electrical, 14, 47 as electric waves, 1 electromagnetic, 1 energy, 5–6, 7, 27, 27–28, 38 energy of nonperiodic, 167–168 even, 10–11, 11–12, 23, 25–26, 26, 40 force, 45, 45

343 Fourier transform, 183–184 impulses, 18, 18–19 frequency domain, 156 Laplace transform, 194 mathematical abstraction, 20–21, 20–21 scaling property, 18 shifted, 59 sifting property, 56, 156–157 usage of MATLAB to simulate, 35, 36 infnite periodic, 153, 154 input, 22, 47, 48, 49–50 continuous systems, 47, 48 electrical, 47 magnitude of, 2, 2, 4 nonperiodic, 2–3, 153 nonperiodic time-domain, 153 odd, 10–11, 11–12, 23, 25–26, 26, 40 output, 47, 48 periodic, 2–3, 5–6, 29, 38, 44, 136 power, 5–6, 7, 27, 27 pulse, 21 ramp, 16–17, 17 rectangular pulse, 15, 15–16 representation, 1–45 continuous signal, 1–2, 2 energy and power signals, 5–6, 7 even and odd signals, 10–11, 11–12 examples, 22–37 impulse signal, 18, 18–19 periodic and nonperiodic signals, 2–3 problems, 38–45 ramp signals, 16–17, 17 in real world, 20–22 refection operation, 8, 8–9, 10 sampling signal, 17, 17 shifting operation, 7, 7–8 signum signal, 16, 16 sinusoidal signal, 4, 4–5 time scaling, 12–14, 12–14 unit step signal, 14–15, 14–16 sampling, 17, 17 shifted impulse, 59 shock, 20 signum, 16, 16 sinc, 17, 17 sinusoidal, 4, 4–5 time, 157 triangular voltage, 22 types, 1 unit step, 14–15, 14–16, 32–33, 42, 42 velocity, 45 voltages as, 1 Signum signals, 16, 16 Simple block diagrams, 58–59, 58–61, 61; see also Block diagrams Sin and cos functions, 126–129, 127–129, 138 Sinc signals, 17, 17

344 Single-input/single-output, 245, 255, 271, 282 Single-phase circuit, 30–31, 30–31 Sinusoidal signals, 4, 4–5; see also Signals mathematical abstraction, 21, 21 representation for x(t), Fourier series, 136 usage of MATLAB to simulate, 35, 37 Solutions, 8 Solving state-space equations in real time, 272–273 Solving state-space equations using Laplace transform, 272 Sound wave, 1 Special matrix, 250; see also Matrix Speed, constant, 16 s-plane, 196 Stability eigenvalues and, 84–85 of linear discrete systems, 73–76 systems, 55–56, 84–85, 209 State equations, 245; see also Equations State-space approach, 245 equation, 254, 259 Laplace matrix representation, 270 State-space and linear systems, 245–334 evaluating eAt, 273–281 Cayley–Hamilton theorem, 274–276 diagonal matrix, 273 general form of Φ(t) = eAt, 277–281 inverse Laplace method, 276–277 numerical evaluation, 273 examples, 283–326 matrix algebra, 246–270 addition of two matrices, 246 determinant of 2 × 2 matrix, 247 diagonal form of matrix, 249 eigenvalues of matrix, 251 eigenvectors of matrix, 252 exponent of matrix, 249–250 identity matrix, 246 inverse of matrix, 248 matrix multiplication, 248–249 multiplication of matrix by constant, 247 observation, 251 special matrix, 250 subtraction of two matrices, 247 transpose of matrix, 248 overview, 245 poles and stability, 282–283 problems, 326–334 representation of systems in state space, 271 solving state-space equations in real time, 272–273 solving state-space equations using Laplace transform, 272

Index State-transition matrix, 277 State variables, 271 Steady-state output, 169 Steady-state response, 134–136 Step input, 304 Step signal discontinuous, 18 magnitude of, 14, 14 mathematical abstraction, 20, 20 usage of MATLAB to simulate, 35, 36 Stiffness coeffcient, 299 Subtraction; see also Addition block diagram, 77, 77 complex numbers, 119 of two matrices, 247 Superposition principle, 135 systems, 57 Symmetry property, 180 Systems; see also Fourier transform and linear systems block diagram representation of linear, 76–77, 76–77 causal, 52–53, 53 continuous, see Continuous systems defned, 47 differential equations, 78, 103 eigenvalues, 67 elevator, 47 frst-order, 67 frst-order single-input single-output, 253 impulse response, 58, 96–99, 162–163 input, 54, 57, 66, 72 integrals, 52 inverse, 54–55, 54–55 invertible, 56 linear, 57, 136 linear continuous, 47–50, 48 linear time-invariant (LTI), 57, 60, 66, 84, 132, 168–169 modeling, 245 multiple-input multiple-output, 245, 271 noncausal, 53 output, 50, 52, 54, 57–59, 66, 71, 84, 87–92, 104–105 parallel, 198–199, 199 with periodic inputs, Fourier series, 132–134, 134 physical, 16, 66 poles of, 209 representation in state space, 271 series, 199, 199–200 with single-input/single-output, 245 stable, 55–56, 84–85, 209 superposition, 57 time-invariant, 50–52, 57, 86–87 transfer function, 133–134, 150

345

Index transient, 83 variables, 271 without memory, 52 zeros of, 209

T Theorem of Parseval, 131–132, 168, 179 Thermal resistors, 302 Thermal system, 302 Third-order differential equations, 67, 83, 201; see also Differential equations Three-integrators block diagram, 202, 202; see also Block diagrams Time domain, 270, 330 convolution, 165 frequency domain, 179–180 inverse Laplace method, 276 state-space matrix equations, 272 invariant systems, 50–52, 57, 86–87 scaling, 12–14, 12–14, 24 shifting property, 160 signal, 157 Transfer function, 200–202, 200–203, 321 input voltage, 334 linear time-invariant (LTI) systems, 198 partial fraction expansion, 258 in s-domain, 198 systems, 133–134, 150 Transient systems, 83; see also Systems Transition matrix, 279; see also Matrix Translational damper, 290, 295, 329 Translational motion, 47 Translational spring, 292 Transmission media, 167 Transpose of matrix, 248 Triangular voltage signal, 22

U Underdamping, 290 Unilateral Laplace transform, 191–192 Unit step function, 88 Unit step input, 91–92 Unit step signals, 14–15, 14–16, 32–33, 42, 42

V Variables algebraic equation, 209, 253 state, 271 systems, 271 Velocity constant, 16 mass, 44 signals, 45 Voltages, 1 across 1-Ohm resistor, 6 AC source, 21 capacitors, 304–305 of constant magnitude, 20 divider circuit, 47–48, 48 frequency, 31 inductor, 267 output, 47–48 resistor, 44, 47, 304–305 source, 31 triangular signals, 22

W Wave, see specifc wave Weighted impulses, 57; see also Impulses Wind wave, 1 Writing signal in Fourier series, 124

Z Zero input, 73 Zeros of system, 209

Discrete Signals and

Systems with MATLAB®

Electrical Engineering Textbook Series Discrete Signals and Systems with MATLAB®, Third Edition Volumes in the series: Volume I – Continuous Signals and Systems with MATLAB® Taan S. ElAli Volume II – Discrete Signals and Systems with MATLAB® Taan S. ElAli

Discrete Signals and

Systems with MATLAB®

Third Edition

Authored by

Taan S. ElAli

Embry-Riddle Aeronautical University

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 par­ ticular pedagogical approach or particular use of the MATLAB® software. First edition published 2003 by CRC Press 6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 and by CRC Press 2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN © 2021 Taan S. ElAli CRC Press is an imprint of Taylor & Francis Group, LLC Reasonable efforts have been made to publish reliable data and information, but the author and pub­ lisher 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 here­ after 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, access www.copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact [email protected] Trademark notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. ISBN: 978-00-367-53993-1 (hbk) ISBN: 978-1-003-08859-2 (ebk) Typeset in Times LT Std by Cenveo® Publisher Services Visit the Routledge/eResources: www.routledge.com/9780367539931

Dedication This book is dedicated first to the glory of Almighty God. It is dedicated next to my beloved parents, father Saeed and mother Shandokha. May Allah have mercy on their souls. It is dedicated then to my wife Salam; my beloved children, Nusayba, Ali and Zayd; my brothers, Mohammad and Khaled; and my sisters, Sabha, Khulda, Miriam and Fatma. I ask the Almighty to have mercy on us and to bring peace, harmony, and justice to all. – Taan ElAli

Contents

Preface.................................................................................................................... xiii

About the Author ..................................................................................................... xv

Acknowledgment ...................................................................................................xvii

Chapter 1

Signal Representation ...........................................................................1

1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18

1.19 1.20 1.21

1.22 1.23 Chapter 2

Introduction ...............................................................................1

Why Do We Discretize Continuous Systems? ..........................3

Periodic and Nonperiodic Discrete Signals ...............................3

Unit Step Discrete Signal ..........................................................4

Impulse Discrete Signal ............................................................4

Ramp Discrete Signal ................................................................ 5

Real Exponential Discrete Signal ..............................................6

Sinusoidal Discrete Signal......................................................... 7

Exponentially Modulated Sinusoidal Signal ........................... 10

Complex Periodic Discrete Signal ........................................... 12

Shifting Operation................................................................... 13

Representing a Discrete Signal Using Impulses...................... 15

Reflection Operation ................................................................ 16

Time Scaling............................................................................ 17

Amplitude Scaling ................................................................... 18

Even and Odd Discrete Signal ................................................. 19

Does a Discrete Signal Have a Time Constant? ...................... 21

Basic Operations on Discrete Signals...................................... 22

1.18.1 Modulation ................................................................. 22

1.18.2 Addition and Subtraction............................................ 22

1.18.3 Scalar Multiplication .................................................. 22

1.18.4 Combined Operations................................................. 23

Energy and Power Discrete Signals......................................... 25

Bounded and Unbounded Discrete Signals ............................. 27

Some Insights: Signals in the Real World ............................... 27

1.21.1 Step Signal..................................................................28

1.21.2 Impulse Signal ............................................................28

1.21.3 Sinusoidal Signal ........................................................28

1.21.4 Ramp Signal ...............................................................28

1.21.5 Other Signals ..............................................................28

End-of-Chapter Examples ....................................................... 29

End-of-Chapter Problems ........................................................46

Discrete System .................................................................................. 51

2.1 2.2

Definition of a System ............................................................. 51

Input and Output...................................................................... 51

vii

viii

Contents

2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11

2.12 2.13

2.14

2.15 2.16 2.17 2.18 2.19 2.20 2.21 Chapter 3

Linear Discrete Systems .......................................................... 52

Time Invariance and Discrete Signals..................................... 54

Systems with Memory ............................................................. 56

Causal Systems........................................................................ 56

Inverse of a System .................................................................. 57

Stable System........................................................................... 58

Convolution.............................................................................. 59

Difference Equations of Physical Systems .............................. 63

Homogeneous Difference Equation and Its Solution .............. 63

2.11.1 Case When Roots Are All Distinct ............................66

2.11.2 Case When Two Roots Are Real and Equal ..............66

2.11.3 Case When Two Roots Are Complex .........................66

Nonhomogeneous Difference Equations and Their

Solutions ............................................................................... 67

2.12.1 How Do We find the Particular Solution? .................. 69

Stability of Linear Discrete Systems:

The Characteristic Equation .................................................... 70

2.13.1 Stability Depending on the Values of the Poles ......... 70

2.13.2 Stability from the Jury Test ........................................ 70

Block Diagram Representation of Linear

Discrete Systems ..................................................................... 73

2.14.1 Delay Element ............................................................ 73

2.14.2 Summing/Subtracting Junction .................................. 73

2.14.3 Multiplier .................................................................... 74

From the Block Diagram to the Difference Equation ............. 75

From the Difference Equation to the Block Diagram:

A Formal Procedure ................................................................ 76

Impulse Response .................................................................... 79

Correlation ............................................................................... 81

2.18.1 Cross-Correlation ....................................................... 81

2.18.2 Auto-Correlation ........................................................ 82

Some Insights .......................................................................... 83

2.19.1 How Can We Find These Eigenvalues?...................... 83

2.19.2 Stability and Eigenvalues ...........................................84

End-of-Chapter Examples .......................................................84

End-of-Chapter Problems ...................................................... 118

Fourier Series and the Fourier Transform of Discrete Signals ........ 125

3.1 Introduction ........................................................................... 125

3.2 Review of Complex Numbers ................................................ 125

3.2.1 Definition .................................................................. 125

3.2.2 Addition.................................................................... 126

3.2.3 Subtraction ............................................................... 126

3.2.4 Multiplication ........................................................... 127

3.2.5 Division .................................................................... 127

ix

Contents

3.3 3.4 3.5

3.6 3.7 3.8

3.9 3.10 3.11 3.12 3.13 Chapter 4

3.2.6 From Rectangular to Polar ....................................... 128

3.2.7 From Polar to Rectangular ....................................... 128

Fourier Series of Discrete Periodic Signals........................... 129

Discrete System with Periodic Inputs: The Steady-State

Response ................................................................................ 131

3.4.1 General Form for yss (n) ............................................ 134

Frequency Response of Discrete Systems ............................. 135

3.5.1 Properties of the Frequency Response ..................... 137

3.5.1.1 Periodicity Property.................................. 137

3.5.1.2 Symmetry Property .................................. 138

Fourier Transform of Discrete Signals .................................. 140

Convergence Conditions ........................................................ 141

Properties of the Fourier Transform of Discrete Signals ...... 141

3.8.1 Periodicity Property ................................................. 141

3.8.2 Linearity Property .................................................... 142

3.8.3 Discrete-Time-Shifting Property ............................. 142

3.8.4 Frequency-Shifting Property.................................... 142

3.8.5 Reflection Property................................................... 143

3.8.6 Convolution Property ............................................... 143

Parseval’s Relation and Energy Calculations ........................ 146

Numerical Evaluation of the Fourier Transform

of Discrete Signals ................................................................. 147

Some Insights: Why Is This Fourier Transform? .................. 150

3.11.1 Ease in Analysis and Design .................................... 150

3.11.2 Sinusoidal Analysis .................................................. 151

End-of-Chapter Examples ..................................................... 151

End-of-Chapter Problems ...................................................... 163

z-Transform and Discrete Systems .................................................. 171

4.1 4.2 4.3 4.4 4.5

Introduction ........................................................................... 171

Bilateral z-Transform ............................................................. 171

Unilateral z-Transform ........................................................... 173

Convergence Considerations ................................................. 175

Inverse z-Transform ............................................................... 178

4.5.1 Partial Fraction Expansion ....................................... 178

4.5.2 Long Division ........................................................... 181

4.6 Properties of the z-Transform ................................................ 182

4.6.1 Linearity Property .................................................... 182

4.6.2 Shifting Property ...................................................... 182

4.6.3 Multiplication by e−an................................................ 184

4.6.4 Convolution .............................................................. 184

4.7 Representation of Transfer Functions as Block

Diagrams ............................................................................... 185

4.8 x(n), h(n), y(n), and the z-Transform...................................... 186

4.9 Solving Difference Equation Using the z-Transform ............ 188

x

Contents

4.10 4.11 4.12 4.13

Convergence Revisited .......................................................... 190

Final-Value Theorem ............................................................. 192

Initial-Value Theorem............................................................ 192

Some Insights: Poles and Zeroes ........................................... 193

4.13.1 Poles of the System................................................... 193

4.13.2 Zeros of the System .................................................. 194

4.13.3 Stability of the System ............................................. 194

4.14 End-of-Chapter Examples ..................................................... 194

4.15 End-of-Chapter Problems ...................................................... 222

Chapter 5

Discrete Fourier Transform and Discrete Systems .......................... 231

5.1 Introduction ........................................................................... 231

5.2 Discrete Fourier Transform and the Finite-Duration

Discrete Signals ..................................................................... 232

5.3 Properties of the DFT ............................................................ 233

5.3.1 How Does the Defining Equation Work? ................. 234

5.3.2 DFT Symmetry ........................................................ 234

5.3.3 DFT Linearity .......................................................... 236

5.3.4 Magnitude of the DFT.............................................. 237

5.3.5 What Does k in x(k), the DFT, Mean? ...................... 237

5.4 Relation the DFT Has with the Fourier Transform of

Discrete Signals, the z-Transform, and the Continuous

Fourier Transform ................................................................. 239

5.4.1 DFT and the Fourier Transform of x(n).................... 239

5.4.2 DFT and the z-Transform of x(n) .............................. 239

5.4.3 DFT and the Continuous Fourier

Transform of x(t) ....................................................240

5.5 Numerical Computation of the DFT ..................................... 242

5.6 Fast Fourier Transform: A Faster Way of Computing

the DFT.................................................................................. 243

5.7 Applications of the DFT........................................................244

5.7.1 Circular Convolution ................................................244

5.7.2 Linear Convolution ................................................... 249

5.7.3 Approximation to the Continuous Fourier

Transform ................................................................. 250

5.7.4 Approximation to the Coefficients of the Fourier

Series and the Average Power of the Periodic

Signal x(t).................................................................. 251

5.7.5 Total Energy in the Signal x(n) and x(t).................... 254

5.7.6 Block Filtering.......................................................... 256

5.7.7 Correlation ................................................................ 256

5.8 Some Insights ........................................................................ 257

5.8.1 DFT is the Same as the fft........................................ 257

5.8.2 DFT Points Are the Samples of the Fourier

Transform of x(n) ...................................................... 257

xi

Contents

5.8.3 How Can We Be Certain that Most of the

Frequency Contents of x(t) Are in the DFT?............ 257

5.8.4 Is the Circular Convolution the Same as the

Linear Convolution? ................................................. 258

5.8.5 Is |X(w)| ≊ |X(k)|?....................................................... 258

5.8.6 Frequency Leakage and the DFT ............................. 258

5.9 End-of-Chapter Examples ..................................................... 259

5.10 End-of-Chapter Problems ...................................................... 272

Chapter 6

State-Space and Discrete Systems .................................................. 277

6.1 6.2

Introduction ........................................................................... 277

Review on Matrix Algebra .................................................... 278

6.2.1 Definition, General Terms, and Notations ............... 278

6.2.2 Identity Matrix ......................................................... 278

6.2.3 Adding Two Matrices ............................................... 278

6.2.4 Subtracting Two Matrices ........................................ 279

6.2.5 Multiplying a Matrix by a Constant. ........................ 279

6.2.6 Determinant of a Two-by-Two Matrix ..................... 279

6.2.7 Inverse of a Matrix ...................................................280

6.2.8 Matrix Multiplication ...............................................280

6.2.9 Eigenvalues of a Matrix ........................................... 281

6.2.10 Diagonal Form of a Matrix ...................................... 281

6.2.11 Eigenvectors of a Matrix .......................................... 281

6.3 General Representation of Systems in State Space ............... 282

6.3.1 Recursive Systems .................................................... 282

6.3.2 Nonrecursive Systems .............................................. 283

6.3.3 From the Block Diagram to State Space .................. 285

6.3.4 From the Transfer Function H(z) to State Space ...... 287

6.4 Solution of the State-Space Equations in the z-Domain........ 295

6.5 General Solution of the State Equation in Real Time ........... 295

6.6 Properties of An and Its Evaluation ....................................... 297

6.7 Transformations for State-Space Representations .................300

6.8 Some Insights: Poles and Stability ........................................302

6.9 End-of-Chapter Examples ..................................................... 303

6.10 End-of-Chapter Problems ...................................................... 326

Index...................................................................................................................... 333

Preface

All books on linear systems for undergraduates cover both the discrete and the con­ tinuous systems material together in one book. In addition, they also include topics in discrete and continuous filter design, and discrete and continuous state-space rep­ resentations. However, with this magnitude of coverage, although students typically get a little of both continuous and discrete linear systems, they do not get enough of either. A minimal coverage of continuous linear systems material is acceptable pro­ vided there is ample coverage of discrete linear systems. On the other hand, minimal coverage of discrete linear systems does not suffice for either of these two areas. Under the best of circumstances, a student needs solid background in both of these subjects. No wonder these two areas are now being taught separately in so many institutions. Discrete linear systems is a big area by itself and deserves a single book devoted to it. The objective of this book is to present all the required material that an under­ graduate student will need to master this subject matter and to master the use of MATLAB® in solving problems in this subject. This book is primarily intended for electrical and computer engineering students, and especially for the use of juniors or seniors in these undergraduate engineering disciplines. It can also be very useful to practicing engineers. It is detailed, broad, based on mathematical basic principles and focused, and it also contains many solved problems using analytical tools as well as MATLAB. The book is ideal for a one-semester course in the area of discrete linear sys­ tems or digital signal processing, where the instructor can cover all chapters with ease. Numerous examples are presented within each chapter to illustrate each con­ cept when and where it is presented. In addition, there are end-of-chapter examples that demonstrate the theory presented with applications using the MATLAB’s Data Acquisition toolbox when applicable. Most of the worked-out examples are first solved analytically and then solved using MATLAB in a clear and understandable fashion. To the Instructor: All chapters can be covered in one semester. The book con­ centrates on understanding the subject matter with an easy-to-follow mathemati­ cal development and many solved examples. It covers all traditional topics and a chapter on state space and FFT. If the instructor decides to cover block diagrams and the design of discrete systems, Chapters 7–10 are available at www.routledge .com/9780367539931 to cover those topics. At this link provided by the publisher, there are stand-alone chapters on sampling and transformations and two comprehen­ sive chapters on IIR and FIR digital filter design in addition to the MATLAB m-files for chapters 1–6. To the Student: Familiarity with calculus, differential equations and program­ ming knowledge is desirable. In cases where other background material needs to be presented, that material directly precedes the topic under consideration (just-in-time approach). This unique approach will help the student stay focused on that particular topic. In this book, there are three forms of the numerical solutions presented using xiii

xiv

Preface

MATLAB, which allows you to type any command at its prompt and then press the Enter key to get the results. This is one form. Another form is the MATLAB script, which is a set of MATLAB commands to be typed and saved in a file. You can run this file by typing its name at the MATLAB prompt and then pressing the Enter key. The third form is the MATLAB function form where it is created and run in the same way as the script file. The only difference is that the name of the MATLAB function file is specific and may not be renamed. Chapters 7–10 are not within this volume but are available online along with the MATLAB m-files for chapters 1–6 at www.routledge.com/9780367539931. These are stand-alone chapters on sampling and transformations and two comprehensive chapters on IIR and FIR digital filter design. To the Practicing Engineer: The practicing engineer will find this book very useful. The topics of discrete systems and signal processing are of most importance to electrical and computer engineers. The book uses MATLAB, an invaluable tool for the practicing engineer, to solve most of the problems. Chapters 7–10 are not within this volume but are available online along with the MATLAB m-files for chapters 1–6 at www.routledge.com/9780367539931. These are stand-alone chapters on sampling and transformations and two comprehensive chapters on IIR and FIR digital filter design. MATLAB® is a registered trademark of The Math Works, Inc. For product information, please contact: The Math Works, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 Tel: 508-647-7000 Fax: 508-647-7001 E-mail: [email protected] Web: http://www.mathworks.com

About the Author

Taan S. ElAli, PhD is a full professor of electrical engineering. He is currently the chair of the Engineering Program at ERAU. He has served as the chairman of the curriculum committee of the new College of Engineering at King Faisal University (KFU) from August 2008, when the committee was formed, to August 2009, when the final draft of the curriculum and its quality assurance plan for the college of engineering was approved by the University Council, the president of KFU, and the Ministry of Higher Education. From August 2009 to August 2010, Dr. ElAli was responsible for the implementation of the college of engineering curriculum quality assurance plan and the chairman of the electrical engineering department. Dr. ElAli has worked full-time at several academic institutions in the United States of America for more than 26 years in the areas of curriculum development, accreditation, teaching, research, etc. He received his BS degree in electrical engineering in 1987 from the Ohio State University, Columbus, Ohio, USA, his MS degree in systems engineering in 1989 from Wright State University, Dayton, Ohio, USA, and his M.S. in applied mathematical systems, and his PhD in electrical engineering, with a specialization in systems, controls, and signal processing from the University of Dayton in the years 1991 and 1993, respec­ tively. Dr. ElAli has discovered a new approach to dynamic system identification and arrived at new mathematical formula in an automatically controlled dynamic system. Dr. ElAli is the author and coauthor of 13 books and textbooks in the area of electrical engineering and engineering education. He has contributed many papers and conference presentations in the area of dynamic systems and signal processing. In his efforts to revolutionize the engineering education, Dr. ElAli has contributed greatly to the Project-Based Curriculum (PBC) approach to engineering educa­ tion. This approach has led to the restructuring of one of the major courses in the engineering curriculum and thus to the restructuring of the textbooks used for the course. From this restructuring, two textbooks have emerged: Continuous Signals and Systems with MATLAB® and Discrete Systems and Digital Signal Processing with MATLAB®. Universities like Rochester Institute of Technology, University of Texas at San Antonio, the University of Georgia, New Mexico State University, University of Massachusetts at Dartmouth, Texas A&M University at Kingsville, Western New England College, Lakehead University, University of New Haven, etc. have come on board to use these textbooks. He has taken the PBC approach to engi­ neering education one step further and introduced student-focused learning through PBC. Dr. ElAli has contributed a chapter to the well-known The Engineering Handbook by CRC Press, another to the well-known The Electrical Engineering Handbook, by Taylor & Francis Group, and another two to Advances in Systems, and Computing Sciences and Software Engineering, by Springer, Germany, 2006

xv

xvi

About the Author

and 2007, respectively. Dr. ElAli is a Fulbright Scholar, and a senior member of the Institute of Electrical and Electronics Engineers (IEEE), a rare honor attained by fewer than 8% of IEEEs more than 400,000 members and is conferred only on those who have outstanding research achievements and who have performed great service to the scientific community.

Acknowledgment

I would like to thank the CRC Press team. Special thanks also go to Nora Konopka, who encouraged me greatly when I discussed this project with her for the first time, and has reaffirmed my belief that this book is very much needed.

xvii

1 1.1

Signal Representation

INTRODUCTION

We experience signals of various types almost on a continual basis in our daily life. The blowing of the wind is an example of a continuous wave. One can plot the strength of the wind wave as a function of time. We can plot the velocity of this same wave and the distance it travels as a function of time as well. When we speak, continuous signals are generated. These spoken word signals travel from one place to another so that another person can hear them. These are our familiar sound waves. When a radar system detects a certain object in the sky, an electromagnetic signal is sent. This signal leaves the radar system and travels the distance in the air until it hits the target object, which then reflects back to the sending radar to be analyzed, where it is decided whether the target is present. We understand that this electromag­ netic signal, whether it is the one being sent or the one being received by the radar, is attenuated (its strength reduced) as it travels away from the radar station. Thus, the attenuation of this electromagnetic signal can be plotted as a function of time. If you vertically attach a certain mass to a spring at one end while the other end is fixed and then pull the mass, oscillations are created such that the spring’s length increases and decreases until finally the oscillations stop. The oscillations produced are a signal that also dies out with increasing time. This signal, for example, can represent the length of the spring as a function of time. Signals can also appear as electric waves. Examples are voltages and currents on long transmission lines. Voltage value gets reduced as the impressed voltage travels on transmission lines from one city to another. Therefore, we can represent these voltages as signals as well and plot them in terms of time. When we discharge or charge a capacitor, the rate of charging or discharging depends on the time factor (other factors also exist). Charging and discharging the capacitor can be represented thus as voltage across the capacitor terminal as a function of time. These are a few examples of continuous signals that exist in nature that can be modeled mathematically as signals that are functions of various parameters. Signals can be continuous or discrete. We will consider only one-dimensional dis­ crete signals in this book. A discrete signal is shown in Figure 1.1. Discrete signals are defined only at discrete instances of time. They can be samples of continuous signals, or they may exist naturally. A discrete signal that is a result of sampling a continuous signal is shown in Figure 1.2. An example of a signal that is inherently discrete is a set of any measurements that are taken physically at discrete instances of time. In most system operations, we sample a continuous signal, quantize the sample val­ ues, and finally digitize the values, so a computer can operate on them (the computer works only on digital signals). 1

2

FIGURE 1.1

Discrete Signals and Systems with MATLAB®

An example of a discrete signal.

In this book, we will work with discrete signals that are samples of continuous signals. In Figure 1.2, we can see that the continuous signal is defined at all times, while the discrete signal is defined at certain instances of time. The time between sample values is called the sampling period. We will label the time axis for the discrete signal as n, where the sampled values are represented at … −1, 0, 1, 2, 3, … and n is an integer.

FIGURE 1.2

A sampled continuous signal.

3

Signal Representation

1.2

WHY DO WE DISCRETIZE CONTINUOUS SYSTEMS?

Engineers used to build analogue systems to process a continuous signal. These sys­ tems are very expensive, they can wear out very fast as time passes, and they are inaccurate most of the time. This is due in part to thermal interferences. Also, any time modification of a certain design is desired, it may be necessary to replace whole parts of the overall system. On the other hand, using discrete signals, which will then be quantized and digitized, to work as inputs to digital systems such as a computer renders the results more accurate and immune to such thermal interferences that are always present in analogue systems. Some real-life systems are inherently unstable, and thus, we may design a con­ troller to stabilize the unstable physical system. When we implement the designed controller as a digital system that has its inputs and outputs as digital signals, there is a need to sample the continuous inputs to this digital computer. Also, a digital controller can be changed simply by changing a program code.

1.3 PERIODIC AND NONPERIODIC DISCRETE SIGNALS A discrete signal x(n) is periodic if x ( n ) = x ( n + kN )

(1.1)

where k is an integer N is the period, which is an integer as well. A periodic discrete signal is shown in Figure 1.3. This signal has a period of 3. This periodic signal repeats every N = 3 instances.

FIGURE 1.3

A periodic discrete signal.

4

Discrete Signals and Systems with MATLAB®

FIGURE 1.4

Signals for Example 1.1.

Example 1.1 Consider the two signals in Figure 1.4. Are they periodic? SOLUTION The first signal is periodic but the second is not. This can be seen by observing the signals in the figure.

1.4 UNIT STEP DISCRETE SIGNAL Mathematically, a unit step discrete signal is written as ⎧⎪ A n ≥ 0 Au ( n ) = ⎨ (1.2) ⎪⎩0 n < 0 where A is the amplitude of the unit step discrete signal. This signal is shown in Figure 1.5.

1.5

IMPULSE DISCRETE SIGNAL

Mathematically, the impulse discrete signal is written as ⎧⎪ A n = 0 Aδ ( n ) = ⎨ (1.3) ⎩⎪0 n ≠ 0 where, again, A is the strength of the impulse discrete signal. This signal is shown in Figure 1.6 with A = 1.

5

Signal Representation

FIGURE 1.5

The step discrete signal.

FIGURE 1.6

The impulse discrete signal.

1.6 RAMP DISCRETE SIGNAL Mathematically, the ramp discrete signal is written as Ar ( n ) = An −∞ < n < +∞

(1.4)

where A is the slope of the ramp discrete signal. This signal is shown in Figure 1.7.

6

Discrete Signals and Systems with MATLAB®

FIGURE 1.7

1.7

The ramp discrete signal.

REAL EXPONENTIAL DISCRETE SIGNAL

Mathematically, the real exponential discrete signal is written as x ( n ) = Aα n

(1.5)

when α is a real value. If 0 < |α| < 1, then the signal x(n) will decay exponentially, as shown in Figure 1.8. If 1 < |α| < ∞, then the signal x(n) will grow without bound, as shown in Figure 1.9.

FIGURE 1.8

The decaying exponential discrete signal.

7

Signal Representation

FIGURE 1.9

1.8

The growing exponential discrete signal.

SINUSOIDAL DISCRETE SIGNAL

Mathematically, the sinusoidal discrete signal is written as x ( n ) = A cos ( θ0 n + φ ) −∞ < n < +∞

(1.6)

where A is the amplitude θ0 is the angular frequency ϕ is the phase A sinusoidal discrete signal is shown in Figure 1.10. The period of the sinusoidal discrete signal x(n), if it is periodic, is N. This period can be found as in the following development. x(n) is the magnitude A times the real part of e jθ0 n + ϕ . But ϕ is the phase and A is the magnitude, and neither has an effect on the period. So if e jθ0 n is periodic, then e jθ0 n = e jθ0 ( n+ N ) or e jθ0 n = e jθ0 n e jθ0 N

8

FIGURE 1.10

Discrete Signals and Systems with MATLAB®

The sinusoidal discrete signal.

If we divide the previous equation by e jθ0 n , we get 1 = e jθ0 N = cos ( θ0 N ) + j sin ( θ0 N ) For the previous equation to be true, the following two conditions must be true: cos ( θ0 N ) = 1 and sin ( θ0 N ) = 0 These two conditions can be satisfied only if θ 0N is an integer multiple of 2π. In other words, x(n) is periodic if θ0 N = 2πk where k is an integer. This can be written as 2π N = θ0 k If N/k is a rational number (ratio of two integers), then x(n) is periodic and the period is ⎛ 2π ⎞ N = k⎜ ⎟ ⎝ θ0 ⎠

(1.7)

The smallest value of N that satisfies the previous equation is called the fundamental period. If 2π/θ0 is not a rational number, then x(n) is not periodic.

9

Signal Representation

Example 1.2 Consider the following continuous signal for the current

i (t ) = cos ( 20πt )

which is sampled at 12.5 ms. Will the resulting discrete signal be periodic?

SOLUTION The continuous radian frequency is w = 20π rad. Since the sampling interval Ts is 12.5 ms = 0.0125 s, ⎛ 2π ⎞ ⎛π ⎞ n = cos ⎜ n⎟

x ( n) = cos 2π (10 ) ( 0.0125) n = cos ⎜ ⎝ 8 ⎟⎠ ⎝4 ⎠

(

)

Since for periodicity, we must have

2π N

= θ0 k we get

2π N 16π 8

= = = 2π / 8 k 2π 1

For k = 1, we have N = 8, which is the fundamental period.

Example 1.3 Are the following discrete signals periodic? If so, what is the period for each?

(

1. x ( n) = 2cos 2πn 2. x ( n) = 20 cos ( πn)

) SOLUTION

For the first signal, θ0 = 2π and the ratio 2π/θ0 must be a rational number.

2π 2π 2

= = θ0 2π 2 This is clearly not a rational number, and therefore, the signal is not periodic. For the second signal, θ0 = π and the ratio 2π/θ0 = 2π/π = 2 is a rational number. Thus, the signal is periodic and the period is calculated by setting 2=

N k

For k = 1, we get N = 2. Thus, N is the fundamental period.

10

FIGURE 1.11

Discrete Signals and Systems with MATLAB®

The decaying sinusoidal discrete signal.

1.9 EXPONENTIALLY MODULATED SINUSOIDAL SIGNAL The exponentially modulated sinusoidal signal is written mathematically as x ( n ) = Aα n cos ( θ0 n + φ )

(1.8)

If cos(θ0n + ϕ) is periodic and 0 < |α| < 1, x(n) is a decaying exponential discrete signal, as shown in Figure 1.11. If cos(θ0n + ϕ) is periodic and 1 < |α| < ∞, x(n) is a growing exponential discrete signal, as shown in Figure 1.12. If cos(θ0n + ϕ) is

FIGURE 1.12

The growing sinusoidal discrete signal.

Signal Representation

FIGURE 1.13

11

The irregularly decaying modulated sinusoidal discrete signal.

nonperiodic and 0 < |α| < 1, x(n) will not decay exponentially in a regular fashion, as shown in Figure 1.13. If cos(θ0n + ϕ) is nonperiodic and 1 < |α| < ∞, x(n) will grow irregularly without bounds, as shown in Figure 1.14.

FIGURE 1.14

The irregularly growing modulated sinusoidal discrete signal.

12

Discrete Signals and Systems with MATLAB®

1.10

COMPLEX PERIODIC DISCRETE SIGNAL

A complex discrete signal is represented mathematically as x ( n ) = Ae jαn

− ∞ < n < +∞

(1.9)

where α is a real number. For x(n) to be periodic we must have x (n) = x (n + N ) or Ae jαn = Ae jα( n + N ) Simplifying, we get Ae jαn = Ae jαn e jαN If we divide both sides by Aejαn, we get 1 = e jαN The previous equation is satisfied if αN = 2πk or N 2π = k α Again, and similar to what we did in Section 1.8, if 2π/α is a rational number, then x(n) is periodic with period 2π N = ⎛⎜ ⎞⎟ k ⎝ α⎠ and the smallest N satisfying the previous equation is called the fundamental period. If 2π/α is not rational, then x(n) is not periodic. Example 1.4 Consider the following complex sinusoidal discrete signals: 1. 2. 3. 4.

2e jn e jnπ e(j2πn + 2) e jn8π/3

Are the signals periodic? If so, what are their periods?

13

Signal Representation SOLUTION For the first signal, jn = jαn requires that α = 1. For periodicity, the ratio 2π/α must be a rational number. But 2π/1 is not a rational number and this signal is not periodic. For the second signal, jnπ = jαn requires α = π. For periodicity again, 2π/α must be a rational number. The ratio 2π/α = 2π/π = 2/1 is a rational number. Thus, the signal is periodic. 2π N 2π 2 = = = α k π 1 For k = 1, we get N = 2. Thus, N is the fundamental period. For the third signal, e( j2πn + 2) can be written as e2e j2πn and 2πjn = jαn requires α = 2π. For periodicity, 2π/α = 2π/2π = 1/1 must be a rational number, which is true in this case. Therefore, the signal is periodic. 2π 2π 1 N = = = α 2π 1 k For k = 1, we get N = 1, which is the fundamental period. For the fourth signal, jαn = j8π/3 and α = 8π/3. For periodicity, 2π/α must be a rational number. 2π 2π 6 3 = = = α 8π /3 8 4 This is a rational number and the signal is periodic with the fundamental period N calculated by setting 2π 3 N = = α 4 k For k = 4 we get N = 3 as the smallest integer.

1.11

SHIFTING OPERATION

A shifted discrete signal x(n) is x(n − k), where k is an integer. If k is positive, then x(n) is shifted k units to the right, and if k is negative, then x(n) is shifted k units to the left. Consider the discrete impulse signal x(n) = 5Aδ(n). The signal x(n − 1) = 5δ(n − 1) is the signal x(n) shifted by 1 unit to the right. Also x(n + 3) = 5δ(n + 3) is x(n) shifted by 3 units to the left. The importance of the shift operation will be apparent when we get to the next chapters. In the following section, we will see one basic importance.

14

Discrete Signals and Systems with MATLAB®

FIGURE 1.15

Pulse signal for Example 1.5.

Example 1.5 Consider the discrete pulse in Figure 1.15. Write this pulse as a sum of discrete step signals. SOLUTION Consider the shifted step signal in Figure 1.16 and the other shifted step signal in Figure 1.17. Let us subtract Figure 1.16 from Figure 1.17 to get Figure 1.15.

FIGURE 1.16

Signal for Example 1.5.

15

Signal Representation

FIGURE 1.17

1.12

Signal for Example 1.5.

REPRESENTING A DISCRETE SIGNAL USING IMPULSES

Any discrete signal can be represented as a sum of shifted impulses. Consider the signal in Figure 1.18 that has values at n = 0, 1, 2, and 3. Each of these values can be thought of as an impulse shifted by some units. The signal at n = 0 can be represented as 1(n), the signal at n = 1 as 1.5(n − 1), the signal at n = 2 as 1/2(n − 2), and the signal at n = 3 as 1/4(n − 3). Therefore, x(n) in Figure 1.18 can be represented mathematically as x ( n ) = δ ( n ) + 1.5δ ( n − 1) +

FIGURE 1.18

1 1 δ ( n − 2 ) + δ ( n − 3) 2 4

Representation of a discrete signal using impulses.

16

Discrete Signals and Systems with MATLAB®

FIGURE 1.19

Signal for Example 1.6.

Example 1.6 Represent the following discrete signals using impulse signals. ⎧ 1, 1. x ( n) = ⎨⎪ ⎪⎩

2, 3, 4, − 1 ⎪⎫ ⎬ ↑  ⎪



⎧⎪ 0, 1, 2, −4 ⎫⎪ 2. x ( n) = ⎨ ⎬

↑  ⎩⎪ ⎭⎪

where the arrow under the number indicates n = 0, where n is the time index where the signal starts. SOLUTION Graphically, the first signal is shown in Figure 1.19, and it can be seen as a sum of impulses as x ( n) = 1δ ( n + 2) + 2δ ( n + 1) + 3δ ( n) + 4δ ( n − 1) − 1δ ( n − 2) The second signal is shown in Figure 1.20 and can be written as the sum of impulses as x ( n) = 0δ ( n) + 1δ ( n − 1) + 2δ ( n − 2) − 4δ ( n − 3)

1.13

REFLECTION OPERATION

Mathematically, a reflected signal x(n) is written as x(−n), as shown in Figure 1.21.

Signal Representation

FIGURE 1.20

Signal for Example 1.6.

FIGURE 1.21

The reflected signal.

1.14

17

TIME SCALING

A time-scaled discrete signal x(an) of x(n) is calculated by considering two cases for a. In case a = k, we will consider all cases where k is an integer. In case a = 1/k, we will also consider all values for k where k is an integer. An example will be given shortly.

18

Discrete Signals and Systems with MATLAB®

1.15

AMPLITUDE SCALING

An amplitude-scaled version of x(n) is ax(n) where, if a is negative, the magnitude of each sample in x(n) is reversed and scaled by the absolute value of a. If a is positive, then each sample of x(n) is scaled by a. Example 1.7 Consider the following signal:

⎧−1, 2,0,3⎫

x ( n) = ⎨ ↑ ⎬⎭ ⎩

Find 1. 2. 3. 4.

x(−n) x(−n + 1) 2x(−n + 1) x(−n) + x(−n + 1)

SOLUTION ⎧−1, 2,0,3⎫ 1. x ( n) = ⎨ ↑ ⎬⎭ ⎩ x(−n) is x(n) shifted about the zero position, which is ⎧3,0,2, −1⎫ x ( − n) = ⎨ ⎬ ⎩ ↑ ⎭ 2. x(−n + 1) is x(−n) shifted to the left 1 unit and it is ⎧ 3,0,2, −1 ⎫ x ( − n + 1) = ⎨ ⎬ ↑ ⎩ ⎭ 3. 2x(−n + 1) is x(−n + 1) scaled by 2 and is

⎧6,0,4, −2⎫

2x ( − n + 1) = ⎨ ↑ ⎬⎭ ⎩ ⎧3,0,2, −1⎫ ⎧3,0, 2, −1⎫ 4. x ( − n) + x ( − n + 1) = ⎨ ⎬ + ⎨

⎬ ↑ ⎭

⎩ ↑ ⎭ ⎩ We add these two signals at the n = 0 index to get

{

}{

}{

}

x ( − n) + x ( − n + 1) = 0,3,0, 2, −1 + 3,0, 2, −1,0 = 3,3, 2,1, −1 ↑ ↑ ↑

19

Signal Representation

1.16

EVEN AND ODD DISCRETE SIGNAL

Every discrete signal x(n) can be represented as a sum of an odd and an even discrete signal. The discrete signal x(n) is odd if x (n) = − x (n)

(1.10)

x (n) = x (−n)

(1.11)

The discrete signal x(n) is even if

Therefore, any discrete signal, x(n), can be written as the sum of an even and an odd discrete signal. We write x ( n ) = x even ( n ) + xodd ( n ) where x even ( n ) =

1 ( x ( n ) + x ( −n )) 2

(1.12)

xodd ( n ) =

1 ( x ( n ) − x ( −n )) 2

(1.13)

and

Example 1.8 The signals in Figures 1.22 and 1.23 are not odd or even. Write them as the sum of even and odd signals.

FIGURE 1.22

Signal for Example 1.8.

20

Discrete Signals and Systems with MATLAB®

FIGURE 1.23

Signal for Example 1.8. SOLUTION

{ }

For x ( n) = 1,1,1 , we have ↑

{ }{ } { }{ } {

xodd ( n) =

1 1⎡ ⎤ ⎧−1/ 2, −1/ 2,0,1/ 2,1/ 2⎫ ⎡x ( n) − x ( − n) ⎦⎤ = ⎢ 1,1,1 − 1,1,1 ⎥ = ⎨ ⎬ ↑ ↑ ⎦ ⎩ 2⎣ 2⎣ ↑ ⎭

xeven ( n) =

1 1⎡ ⎤ ⎡x ( n) + x ( − n) ⎤⎦ = ⎢ 1,1,1 + 1,1,1 ⎥ = 1/ 2,1/ 2,1,1/ 2,1/ 2 ↑⎦ ↑ 2⎣ ↑ 2⎣

}

Now if we add xodd and xeven, we will get ⎧− 1/ 2, − 1/ 2,0,1/ 2,1/ 2⎫ ⎧1/ 2,1/ 2,1,1/ 2,1/ 2⎫ ⎧0,0,1,1,1⎫ ⎨ ⎬+ ⎨ ⎬= ⎨ ↑

↑ ↑ ⎭⎬ ⎭ ⎩ ⎭ ⎩ ⎩

{ }

For x ( n) = 1, 2,3 , we have ↑

{ }{ } { }{ } {

xodd ( n) =

1 1⎡ ⎡x ( n) − x ( − n) ⎤⎦ = ⎢ 1, 2,3 − 3, 2,1 ↑ 2⎣ 2⎣ ↑

⎤ ⎧−3/ 2, −1,0,1,3/ 2⎫ =⎨ ⎬ ↑ ⎦⎥ ⎩ ⎭

 xeven ( n) =

1 1⎡ ⎡ x ( n) + x ( − n) ⎤⎦ = ⎢ 1, 2,3 + 3, 2,1 ↑ 2⎣ 2⎣ ↑

⎤ 3/ 2,1,0,1, 3/ 2 ⎥⎦ = ↑

}

Now if we add xodd and xeven, we will get

{

}{

}

⎧−3/ 2, −1,0,1,3/ 2⎫ 3/ 2,1,0,1,3/ 2 = 0,0,0, 2,3 ⎨ ⎬+ ↑ ↑ ↑ ⎭ ⎩

21

Signal Representation

1.17

DOES A DISCRETE SIGNAL HAVE A TIME CONSTANT?

Consider the continuous real exponential signal x ( t ) = e −αt Let us sample x(t) every t = nTs s with a > 0. Then we write x ( n ) = e −αnTs = ( e −αTs ) = a n n

where a = e−αTs is a real number. The continuous exponential signal has a time constant τ, where e−αt = e−t/τ. This implies that τ = 1/a. Therefore,

(

x ( n ) = e −Ts / τ

)

n

= an

But e−Ts/τ = a and by taking the logarithm on both sides, we get τ 1 =− Ts ln a

or

τ=

−Ts ln a

So, a discrete time signal that was obtained by sampling a continuous exponential signal has a time constant as given earlier. Example 1.9 Consider the following two continuous signals: x (t ) = e −t x (t ) = e −100t 1. Find the time constant for both continuous signals. 2. Discretize both signals for Ts = 1 s and then find the time constant for the resulting discrete signals. SOLUTION For x(t) = e and by setting e = e in order to find the time constant τ we see that τ = 1 s. By letting t = nTs we get the discretized signal −t

−t

−t/τ

( )

x ( n) = e − ( nTs ) = e −n = e −1 As discussed earlier, we set

e −1 = e −Ts / τ

n

22

Discrete Signals and Systems with MATLAB® to get the discrete time constant τ=

−Ts −1 = −1 ln e ln e −1

( )

( )

For x(t) = e −100t, we set e −100t = e −t / τ to get τ = 1/100 s. Similarly, the second discretized signal is

(

x ( n) = e −100Ts n = e −100

)

n

and the discrete time constant is

τ=

−Ts −1

= ln e −100 ln e −100

(

)

(

)

1.18 BASIC OPERATIONS ON DISCRETE SIGNALS A discrete system will operate on discrete inputs. Some basic operations follow. The output of a discrete system is the input operated upon in a certain way.

1.18.1

Modulation

Consider the two discrete signals x1(n) and x2(n). The resulting signal y(n) where y ( n ) = x1 ( n ) x 2 ( n ) is called the modulation of x1(n) and x2(n). y(n) is a discrete signal found by multiply­ ing the sample values of x1(n) and x2(n) at every instant.

1.18.2 addition and Subtraction Consider the two discrete signals x1(n) and x2(n). The addition/subtraction of these two signals is y(n) where y ( n ) = x1 ( n ) ± x 2 ( n )

1.18.3

Scalar Multiplication

A scalar multiplication of the discrete signal x(n) is the signal y(n) where y ( n ) = Ax ( n ) where A is the scaling factor.

23

Signal Representation

1.18.4 coMbined operationS We may have multiple operations among input discrete signals. One operation may be represented as y ( n ) = 2x1 ( n ) + 1.5x 2 ( n − 1) where we have scaling, shifting, and addition operations combined. In other opera­ tions you may have the output y(n) presented as y ( n ) = 2x1 ( n ) − x 2 ( n ) x3 ( n ) where you have x1(n) scaled, then the modulated signal resulting from x2(n) and x3(n) is subtracted from 2x1(n). Example 1.10 Consider the discrete signal as shown in Figure 1.24. Find 1. 2. 3. 4. 5. 6.

x(−n) x(n + 2) x(2n) x(n/2) x(2n − 1) x(n)x(n) SOLUTION

From Figure 1.24, we see that ⎧1,1,0, −1, −1⎫ x ( n) = ⎨ ⎬ ⎩ ↑ ⎭ 1. x(−n) is x(n) reflected and is ⎧−1, −1,0,1,1⎫ x ( − n) = ⎨ ↑ ⎬⎭ ⎩ 2. x(n + 2) is x(n) shifted to the left by 2 units and is

{

}

x ( n + 2) = 1,1,0, −1, −1 ↑

3. The new time axis in this case is nnew = nold/2, where nold is the index of the given x(n). The indices are arranged as in the following with the help of the equation nnew = nold/2.

24

Discrete Signals and Systems with MATLAB®

FIGURE 1.24 nold −2 −1 0 1 2 3

Signal for Example 1.10. nnew −1 −1/2 No value will appear at n = −1/2 since n must be an integer 0 1/2 No value will appear 1 No value for x(n) at n = 3, so we stop at this point

Therefore, the new n axis for x(2n) will start at −1 and will contain the indices n = −1, 0, and 1. The value at −1 for the scaled signal x(2n) will be the value of x(n) at n = −2. Similarly, the value at nnew = 0 will be the value at nold = 0, and the value at nnew = 1 will be the value at nold = 2. Therefore, x(2n) is ⎧0,1,0, −1,0 ⎫ x ( 2n) = ⎨ ⎬ ↑ ⎩ ⎭ 4. This is also a scaling case. For this case, the new time axis is nnew = 2nold These indices are arranged in the following table: nold nnew −2 −4

−1 −2

0 0

1 2

2 4

25

Signal Representation The scaled signal x(n/2) therefore is ⎛ n ⎞ ⎧1,0,1,0,0,0, −1,0, −1⎫ x⎜ ⎟ = ⎨ ⎬ ↑ ⎝ 2⎠ ⎩ ⎭ 5. x(2n + 1) is x(2n) shifted left by one unit and is

⎧0,1,0, −1,0 ⎫

x ( 2n + 1) = ⎨ ↑ ⎬⎭ ⎩ 6. x(n) multiplied by x(n) is called the element-by-element multiplication and is

{

}

⎧1,1,0, −1, −1⎫ ⎧1,1,0, −1, −1⎫ 1,1,0,1,1 x ( n ) x ( n) = ⎨ ⎬⎨ ↑ ⎬= ↑ ⎩ ↑ ⎭⎩ ⎭

1.19

ENERGY AND POWER DISCRETE SIGNALS

The total energy in the discrete signal x(n) is E and mathematically written as +∞

E=

∑ x (n)

2

(1.14)

−∞

The average power in the discrete signal x(n) is P and is written mathematically as k



1 2 x (n) k→∞ 2k + 1 n =− k

P = lim

(1.15)

where n= k

∑ x (n)

2

n=− k

is the energy in x(n) in the interval −k < n < k. The average power of a discrete peri­ odic signal is written mathematically as P=

where N is the period of x(n).

1 N

N −1

∑ x (n) n=0

2

(1.16)

26

Discrete Signals and Systems with MATLAB®

Example 1.11 Consider the following finite discrete signals: 1. x(n) = −1δ(n − 0) + 2δ(n − 1) − 2δ(n − 2) ⎧1,0, −1⎫ 2. x(n) = ⎨ ⎬ ⎩ ↑ ⎭ Find the energy in both signals. SOLUTION The first signal x(n) can be written as ⎧⎪−1, 2, −2⎪⎫ x ( n) = ⎨ ⎬ ⎪⎩↑ ⎭⎪ The energy in the signal is then 2

E=

∑ x ( n)

2

= ( −1) + ( 2) + ( −2) = 1+ 4 + 4 = 9 2

2

2

n=0

This means that x(n) has finite energy. For the second signal the total energy is given by 1

E=

∑ x ( n)

2

= (1) + ( 0 ) + ( −1) = 2 2

2

2

n=−1

Example 1.12 Consider the discrete signals x ( n) = 2 ( −1)

n

n≥0

Find the energy and the power in x(n).

SOLUTION ∞

E=

∑ 2(−1) n=0

22

= 4 [1+ 1+ ]

27

Signal Representation This sum clearly does not converge to a real number. Hence, x(n) has infinite energy. The power in the signal is k ⎞ 4 ( k + 1) 1 ⎛ 4 1⎟ = lim =2 ⎜ k→∞ 2k + 1 k→∞ 2k + 1 ⎝ n=0 ⎠



P = lim

Therefore, x(n) has finite power and is a power signal.

Example 1.13 Find the energy in the signal:   x ( n) =

1 n

n ≥1

SOLUTION The energy is given by ∞

E=

∑ n1 n=1

2

2

2

⎛ 1⎞ ⎛ 1⎞ = 1+ ⎜ ⎟ + ⎜ ⎟ +  ⎝ 3⎠ ⎝ 2⎠

which converges to π2/6. This means that x(n) has finite energy.

1.20

BOUNDED AND UNBOUNDED DISCRETE SIGNALS

A discrete signal x(n) is bounded if each sample in the signal has a bounded magnitude. Mathematically, if x(n) is bounded then x (n) ≤ β < ∞ where β is some positive value. If this is not the case, then x(n) is said to be unbounded. The step signal is bounded, the ramp is unbounded, and the sinusoidal signal is bounded.

1.21

SOME INSIGHTS: SIGNALS IN THE REAL WORLD

The signals that we have introduced in this chapter were all represented in math­ ematical form and plotted on graphs. This is how we represent signals for the purpose of analysis, synthesis, and design. For better understanding of these sig­ nals, we will provide herein real-life situations and see the relation between these mathematical abstractions of signals and get a feel of what they may represent in real life.

28

1.21.1

Discrete Signals and Systems with MATLAB®

Step Signal

In real-life situations, this signal can be viewed as a constant force of magnitude A newtons applied at time (t) = 0 s to a certain object for a long time. In another situ­ ation, Au(t) can be an applied voltage of constant magnitude to a load resistor R at the time t = 0.

1.21.2 iMpulSe Signal Again, in real life, this signal can represent a situation in which a person hits an object with a hammer with a force of A newtons for a very short period of time (pico­ seconds). We sometimes refer to this kind of signal as a shock. In another real-life situation, the impulse signal can be as simple as closing and opening an electrical switch in a very short time. Another situation where a springcarrying mass is hit upward can be seen as an impulsive force. A sudden oil spill similar to the one that happened during the Gulf war can represent a sudden flow of oil. You may realize that it is impossible to generate a pure impulse signal for zero duration and infinite magnitude. To create an approximation to an impulse, we can generate a pulse signal of very short duration, where the duration of the pulse signal is very short compared with the response of the system.

1.21.3

SinuSoidal Signal

This signal can be thought of as a situation where a person is shaking an object regu­ larly. This is like pushing and pulling an object continuously with a period of T s. Thus, a push and pull forms a complete period of shaking. The distance the object covers during this shaking represents a sinusoidal signal. In the case of electrical signals, an AC voltage source is a sinusoidal signal.

1.21.4 raMp Signal In real-life situations, this signal can be viewed as a signal that is increasing linearly with time. An example is when a person applies a force at time t = 0 to an object and keeps pressing the object with increasing force for a long time. The rate of the increase in the force applied is constant. Consider another situation where a radar antenna, an antiaircraft gun, and an incoming jet are in one place. The radar antenna can provide an angular position input. In one case, the jet motion forces this angle to change uniformly with time. This will force a ramp input signal to the antiaircraft gun since it will have to track the jet.

1.21.5 other SignalS A train of impulses can be thought of as hitting an object with a hammer continu­ ously and uniformly. In terms of electricity, you may be closing and opening a switch continuously. A rectangular pulse can be likened to applying a constant

29

Signal Representation

force to an object for a certain time and instantaneously removing that force. It is also like applying a constant voltage for a certain time and then instantaneously closing the switch of the voltage source. Other signals are the random signals where the magnitude changes randomly as time progresses. These signals can be thought of as shaking an object with variable random force as time progresses, or as a gusting wind.

1.22

END-OF-CHAPTER EXAMPLES

EOCE 1.1 Consider the following discrete periodic and nonperiodic signals in Figure 1.25. For the periodic signal, find the period N and also the average power. For the nonperiodic signals, find the total energy. SOLUTION For the first discrete signal in Figure 1.25, the signal x(n) is periodic with period N = 3. The average power is then P=

P=

1 N

N−1

∑ x ( n)

2

=

n=0

2 2 ⎞ 1 1 ⎛ 2 ⎛ 1⎞ 2 x ( n) = ⎜ (1) + ⎜ ⎟ + 0 2 ⎟ ⎝ 2⎠ 3 n=0 3⎝ ⎠



( )

1⎛ 1 ⎞ 1 ⎛ 4 + 1⎞ 5 ⎜ 1+ ⎠⎟ = ⎝⎜ ⎟= 3⎝ 4 3 4 ⎠ 12

We can use MATLAB® to calculate this average power as in the script EOCE1_11. The result will be 0.4167. For the second discrete signal the period is N = 5. The average power is calculated as P=

P=

1 N

N−1



x ( n) = 2

n=0

((

3



2 2 2 2 1 1 x ( 0 ) + x (1) + x ( 2) + x ( 3) x ( n) = 5 n=0 5

(

) (

) (

) (

)) 2

)

1 1 (1)2 + (1)2 + (1)2 + (1) 2 + (0) 2 = [ 4 ] = 0.8 5 5

We can use MATLAB and write the script EOCE1_12 to find the power.

The result is 0.8 for the average power.

The last signal in Figure 1.25 is not periodic and the total energy is

+∞

E=

N=4

∑ x ( n) = ∑ x ( n) 2

2

= x ( 0 ) + x (1) + x ( 2) + x ( 3) + x ( 4 ) 2

2

2

2

2

n=0

n=0

E = ( 0 ) + (1) + ( 2) + ( 2) = 1+ 4 + 4 + 4 = 13 2

2

2

2

We can use MATLAB to find this total energy in the signal by writing the EOCE1_13 script. The result will be 13 for the energy.

Discrete Signals and Systems with MATLAB®

FIGURE 1.25 Signals for EOCE 1.1.

30

31

Signal Representation

EOCE 1.2 Write MATLAB scripts to simulate the step and the impulse signals. SOLUTION For the step signal, ⎪⎧ 1 n ≥ 0 u ( n) = ⎨ ⎪⎩ 0 n < 0 We can use the MATLAB function ones to generate sequences that have every value unity. We write ones (1, L) where L is the number of ones in this row vector that “ones” generate. However, sometimes not all step signals start at n = 0. In this case, we have ⎪⎧ 1 n ≥ n0 u ( n − n0 ) = ⎨ ⎩⎪ 0 n < 0 We know that u(n) is defined for n ≥ 0 and we also know that we cannot gen­ erate u(n) for an infinite number of samples. Therefore, we will generate these sequences for a limited interval. We will denote n1 to be the left limit and n2 to be the right limit. Notice that ones (1, L) will generate L ones for n = 0, 1, 2, 3, . . ., L − 1 automatically. To generate the most general step sequence u(n − n0) in the interval n1 ≤ n ≤ n2, we write the MATLAB script EOCE1_21 that will generate a unit step signal that starts at n0 = −1 and defined in the interval −3 ≤ n ≤ 3 first. Note in the previous script on the line before the last that for n = −3, n0 = −1 (fixed), the logical expression (−3 − (−1)) ≥ 0 results in −3 + 1 ≥ 0 and evaluates to false, which in MATLAB evaluates to zero. Therefore, for n = −3, u(n + 1) is zero. Now take n = −2; the expression −2 + 1 ≥ 0 evaluates to false again. Take n = −1. The expression −1 + 1 ≥ 0 evaluates to true, and hence, the first one appears. The plot is shown in Figure 1.26. To sketch 3u(n − 5) in the interval −10 ≤ n ≤ 10, we write the script EOCE1_22 and the plot is shown in Figure 1.27. For the impulse signal, we have ⎧⎪ 1 δ ( n) = ⎨ ⎪⎩ 0

n=0 n≠0

We can use the MATLAB function zeros to generate a sequence of zeros of any length. For example, the command delta = zeros (1, L)

will generate a sequence of zeros of length L. Then we can make the first value in the sequence one to form the impulse signal and write delta (1) = 1;

32

Discrete Signals and Systems with MATLAB®

FIGURE 1.26 MATLAB®-generated step signal starting at n = −1. But again, suppose you want to generate an impulse sequence that has a certain value at n = n0 and zero otherwise. We write ⎧⎪ 1 n = n0 δ ( n − n0 ) = ⎨ ⎪⎩ 0 n ≠ n0 For this, we write the MATLAB script EOCE1_23 that simulates δ(n − 1).

FIGURE 1.27 MATLAB®-generated step signal starting at n = 5.

33

Signal Representation

FIGURE 1.28

MATLAB®-generated impulse signal at n = 1.

The plot is shown in Figure 1.28. Note the last line of the previous MATLAB script. x = ⎡⎣( n − n0 ) = = 0 ⎤⎦ If n = −5, (−5 − 1 = = 0) evaluates to false and the impulse at n = −5 is zero. If n = 2, (2 − 1 = = 0) also evaluates to zero and the impulse signal at n = 2 is zero. But if n = 1, (1 − 1 = = 0) evaluates to true and this is the only value in the interval −5 ≤ n ≤ 5 for the impulse to have a value other than zero.

EOCE 1.3 Write MATLAB scripts to simulate the exponential signal x ( n) = A ( α )

n

and the sinusoidal signal x ( n) = Acos ( θ0 n + φ ) SOLUTION For x ( n) = A ( α )

n

−∞ < n < +∞

we can generate the x(n) sequence in a limited interval only. To simulate 3(.5)n in the interval −3 ≤ n ≤ 3, we write the EOCE1_31 script and the plot is shown in Figure 1.29. It is seen that this signal is bounded because 0 < α < 1.

34

Discrete Signals and Systems with MATLAB®

FIGURE 1.29 MATLAB®-generated exponential decaying signal.

For the sinusoid sequence

x ( n) = Acos ( θ0 n + ϕ )

−∞ < n < +∞

the signal can be simulated in a fixed interval. To do that, let us look at the signal x ( n) = 3cos ( 3πn + 5)

− 10 < n < 10

and write the EOCE1_32 script to simulate this signal.

The plot is shown in Figure 1.30.

FIGURE 1.30

MATLAB®-generated sinusoidal signal.

35

Signal Representation

EOCE 1.4 Consider the following signals: x ( n) = (.5) cos ( 2nπ + π ) n

x ( n) = 5cos ( 2nπ + π ) + 3 Are the signals periodic? SOLUTION The first signal will decay to zeros as the index n get larger and it is not periodic. For the second signal, θ0 = 2π and for periodicity, the ratio 2π/θ0 must be rational. We have 2π 2π 1 = = θ0 2π 1 and therefore, the signal is periodic. The period N is ⎛ 2π ⎞ N = k⎜ ⎟ ⎝ θ0 ⎠ For k = 1 we have N = 1. Note that the addition of 3 to x(n) has no effect on the period N. We can use MATLAB to verify this and simulate x(n) in the interval −3 < n < 3 and write the EOCE1_4 script and the plot is seen in Figure 1.31. It is seen from the figure that N = 1.

FIGURE 1.31

Signal for EOCE 1.4.

36

Discrete Signals and Systems with MATLAB®

EOCE 1.5 Consider the following discrete signals:

{ {

} }

x1 ( n) = 0,1, 2,3 ↑

x2 ( n) = 0,1, 2,3 ↑

Find x1(n) + x2(n) and x1(n) x2(n) analytically and using MATLAB. SOLUTION Analytically, we can arrange the two signals as follows and then add the corre­ sponding samples. Remember we add samples with similar indices. ⎧0,0,1, 2,3⎫ ⎧0,1, 2,3,0 ⎫ ⎧0,1,3, 5,3⎫ x1 ( n) = ⎨ ⎬ + x2 ( n) = ⎨ ↑ ⎬ = x ( n) ⎨ ↑ ⎬ ↑ ⎩ ⎭ ⎩ ⎭ ⎩ ⎭ x1(n) has an index that starts at n = 0 and ends at n = 3, and x2(n) has an index that starts at n = −1 and ends at n = 2. Note also that x(n) starts at n = −1 and ends at n = 3. The initial index, n = −1, for x(n) is the minimum of the minimum of the starting index for x1(n) and x2(n). The last index n = 3 for x(n) is the maximum of the maximum of the last index for x1(n) and x2(n). This note will help us do the addition with MATLAB. For x1(n) x2(n), we have the same arrangement. ⎧0,0,1, 2,3⎫ ⎧0,1, 2,3,0 ⎫ ⎧0,0, 2,6,0 ⎫ x ( n) = ⎨ ⎬⎨ ↑ ⎬=⎨ ↑ ⎬ ⎩ ↑ ⎭⎩ ⎭ ⎩ ⎭ Using MATLAB, let n1 represent the timescale (index) for x1(n) and n2 represent the timescale for x2(n). Then the index for x(n) = x1(n) + x2(n) will start with the minimum of n1 and n2 and end with the maximum of n1 and n2. Notice also when we added the signals analytically, we made both of the same length and the same length as x(n). In MATLAB, the function finds works as follows: find(x) returns the indices of the vector x that are nonzero. With that notice we now write the script EOCE1_51 that adds the two signals. The output is similar to what we got earlier. Using MATLAB, we can simulate the element-by-element multiplication using a script similar to the one we just wrote for the addition. We will use EOCE1_52 and the result is again similar to what we arrived at before.

EOCE 1.6 The scripts that we have generated can be put in the form of functions. A func­ tion in MATLAB receives parameters and sends back results. Once this function is

37

Signal Representation written and saved, it can be utilized as often as desired. The function is typed in the MATLAB editor and then saved and given a name similar to the name of the function that was written. Let us write functions to implement the step signal, the impulse signal, the reflection of a signal, the sum of two signals, the product of two signals, and the shifting by n0 of a discrete signal. SOLUTION The general form of a MATLAB function is Function [rv1 rv2 … rvn] = Function_Name (pv1, pv2, … pvn)

where

rv1 is the returned value one pv1 is the passed value one Function_Name is the name of the function, which should be the same name given to the file when the function is saved. For the step discrete signal, let us call the function stepsignal. We will pass to stepsignal the time when the signal should start. We will call this time Sindex. We will also pass to it the starting and the ending of the time interval, which we will call Lindex and Rindex for left index and right index. The function will return the signal x(n) and its index. The function is function [xofn, index] = stepsignal (Sindex, Lindex, Rindex)

index = [Lindex: Rindex];

xofn = [(index − Sindex) > = 0];

For the impulse signal, let us call the function impulsesignal. We will pass to it the point of application of the impulse signal, Sindex, and the range, Lindex and Rindex. The function will send to us the impulse signal x(n) and its index. The function is function [xofn, index] = impulsesignal (Sindex, Lindex, Rindex)

index = [Lindex: Rindex];

xofn = [(index − Sindex) = = 0];

The reflection of the signal x(n) is implemented using the MATLAB function fliplr. We will use fliplr to flip the sample values for x(n) and to flip the time index. The function will be called xreflected and will receive the original x(n) and the original index. It will give back the reflected x(n) and the new index. The function is function [xnew, nnew] = xreflected (xold, nold);

xnew = fliplr (xold);

nnew = −fliplr (nold);

The function to add two discrete signals x1(n) and x2(n) will be called x1plusx2. It will receive the original signals and their original indices and return the sum of the two signals and the index for the sum. The function to multiply x1(n) and x2(n) is similar to the x1plusx2 and is called x1timesx2.

38

Discrete Signals and Systems with MATLAB® A shifted version of x(n) is x(n − n0) xshift ( n) = x ( n − n0 ) If n − n0 = m, then xshift(m + n0) = x(m). This indicates that the sample values are not affected, but the index is changed by adding the index shift n0. We will call the function xshifted and pass to it the original x(n), the original index n1, and the amount of shift n0.

EOCE 1.7 Find 1. x(n) = u(n) − 3δ(n − 1) −3 ≤ n ≤ 3 2. x(n) = 3u(n − 3) + δ(n − 2) + u(−n) −3 ≤ n ≤ 3 SOLUTION For the first x(n), we have two signals as follows: ⎧0,0,0,1,1,1,1⎫ u ( n) = ⎨ ⎬ ↑ ⎩ ⎭ and ⎧0,0,0,0, −3,0,0 ⎫ −3δ ( n − 1) = ⎨ ⎬ ↑ ⎩

⎭ Thus, u(n) − 3δ(n − 1) is

{

}

x ( n) = 0,0,0,1, −2,1,1 ↑

We can use MATLAB to generate x(n) and use the script EOCE1_71 and the plot is shown in Figure 1.32.

FIGURE 1.32

Signal for EOCE 1.7.

39

Signal Representation

FIGURE 1.33

Signal for EOCE 1.7.

For the second signal, we have

{ {

} }

3u ( n − 3) = 0,0,0,0,0,0,3 ↑ δ ( n − 2) = 0,0,0,0,0,1,0 ↑ ⎧1,1,1,1,0,0,0 ⎫ u ( − n) = ⎨ ⎬ ↑ ⎩ ⎭ and the sum is ⎧1,1,1,1,0,1,3⎫ x ( n) = ⎨ ⎬ ↑ ⎩ ⎭

We can use MATLAB to find this result using the script EOCE1_72. The result is shown in Figure 1.33. Note in the previous script that the function xreflected was called and one of the passed parameters is stepsignal (0, −3, 3), which is a function that will return the signal u(n). Thus, u(n) and n are passed to xreflected.

EOCE 1.8 Write a general-purpose script to find the odd and even parts of a discrete signal x(n) defined on the interval n1 ≤ n ≤ n2.

40

Discrete Signals and Systems with MATLAB® SOLUTION Let us repeat the equations for the even and the odd part of x(n). xeven = ( n) =

1 ⎡ x ( n) + x ( − n) ⎤⎦ 2⎣

xodd = ( n) =

1 ⎡ x ( n) − x ( − n) ⎦⎤ 2⎣

We can utilize the functions we have written so far to come up with the following script. Given x(n) and its index n, we write the script EOCE1_8.

EOCE 1.9 Consider the following signal: x ( n) = δ ( n + 3) + δ ( n + 2) + δ ( n + 1) − δ ( n − 1) − δ ( n − 2) − δ ( n − 3) for −5 ≤ n ≤ 5. Find the even and odd parts of x(n). SOLUTION Although x(n) can easily be seen as an odd signal, we will use MATLAB with the help of the functions and the scripts that we have written so far to plot the original signal, the reflected signal, the odd signal, and the even signal. First we call the function impulsesignal six times to get x(n) and then use the script EOCE1_9 for the odd and even parts of x(n) to produce the plots. The plots are shown in Figure 1.34.

EOCE 1.10 Consider the following signal: x ( n) = u ( n − 1) + δ ( n + 1) Find and plot the following signals: 1. x(−n) 2. x(n − 2) 3. x(n) + x(−n)

− 2≤ n ≤ 2

FIGURE 1.34

Signals for EOCE 1.9.

Signal Representation 41

42

Discrete Signals and Systems with MATLAB® SOLUTION 1. Analytically, x ( n) = u ( n − 1) + δ ( n + 1)

{

}{

}{

}

= 0,0,0,1,1 + 0,1,0,0,0 = 0,1,0,1,1 ↑ ↑ ↑

{

}

and x(−n) is 1,1,0,1,0 . Using MATLAB, we first generate x(n) and then ↑ find its reflection using EOCE1_101 and the plot is shown in Figure 1.35. 2. Analytically, x ( n − 2) = u ( n − 2 − 1) + δ ( n − 2 + 1) or we notice that x(n − 2) is x(n) shifted by 2 and is

{

}

x ( n − 2) = 0,1,0,1,1 ↑

Using MATLAB, we use the shifting function we derived earlier to write the script EOCE1_102 and the plot is shown in Figure 1.36. 3. Using MATLAB, we can find x(n) + x(−n) by writing the MATLAB script EOCE1_103 and the plot is shown in Figure 1.37.

EOCE 1.11 Audio signals are types of signals that are often used in signal processing and com­ munications. In this exercise we will look at how can we use MATLAB, the sound card on your computer, and MATLAB data acquisition toolbox to acquire such a signal that you will speak out. SOLUTION To complete this task you will need a PC microphone or your laptop built-in micro­ phone and a sound card that is also found on your PC or laptop. The sound card will work as the analogue-to-digital converter. Let us start by acquiring 3 s of audio using the sound card. What we speak is an analogue signal and so the sound card will convert the speech to digital samples. Let us use 8000 Hz as the sampling rate on the sound card. We will first create an analogue input object for the sound card. At the MATLAB prompt, we write AI = analoginput (‘winsound’);

to create an input communication channel with the sound card. Then you need to add an input channel to the input object AI. This is done with the MATLAB command addchannel (AI, 1);

to add a single channel to the input object.

FIGURE 1.35

Signal for EOCE 1.10.

Signal Representation 43

Signal for EOCE 1.10.

Discrete Signals and Systems with MATLAB®

FIGURE 1.36

44

FIGURE 1.37 Signal for EOCE 1.10.

Signal Representation 45

46

Discrete Signals and Systems with MATLAB® We need to specify a sampling rate (this topic will be revisited again in Chapter 8 for complete discussion). We will use 8000 Hz for that. We will write Fs = 8000;

set (AI, ‘SampleRate’, Fs);

to define the sample rate to MATLAB and associate that with the input object AI. We need to speak through the microphone for a limited time of 3 s and tell the channel how many samples per trigger we wish to collect. We do that with Trig_duration = 3;

set (AI, ‘SamplesPerTrigger’, Trig_duration*Fs);

At this stage, we can start collecting data for the audio signal we will speak using the microphone. Before you hit enter after you type the command as follows, start speaking for about 5 s. start (AI);

To collect the data samples of the words you just spoke, use the following command: data = gatdata (AI);

It is always a good practice to delete the AI object after we finish. Write the com­ mand as follows: delete (AI);

to delete the AI object.

At this time, you can plot the data you just collected.

1.23

END-OF-CHAPTER PROBLEMS

EOCP 1.1 Analytically find the following signals if x(n) = nu(n − 1) −∞ < n < ∞ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

x(−n) x(−n + 1) x(n) + x(−n) x(2n)

n x ⎛⎜ ⎞

+ x (−n) ⎝ 3 ⎟⎠ x(n) δ (n − 1) x(−n) u(n − 2) + δ(n) x(n − 2) + δ(n) x(n)

n u ⎛ ⎞ − x ( n ) ⎝ 2⎠ x(−n − 2) + u(n − 2)

Signal Representation

47

EOCP 1.2 Use MATLAB to generate the following signals if x(n) = u(n) − u(n − 1) for 0 ≤ n ≤ 5: 1. 2. 3. 4. 5. 6. 7.

x(−n) x(n + 2) x(n) + x(−n) x(n − 2) + x(n + 2) x(−n − 1)x(n) x(−n) x(n) + x(−n − 1) x(n) + cos(2πn + π) π 8. x ( −n ) cos ⎛ 3πn + ⎞ ⎝ 2⎠ π n ⎛ 9. (.1) x ( n ) cos 3πn + ⎞ ⎝ 2⎠

EOCP 1.3 Check the periodicity for each of the following signals for 0 ≤ n ≤ ∞. If they are periodic, what is the period? 1. cos(2πn + π) π n 2. (.1) cos ⎛ 5πn + ⎞ ⎝ 2⎠ 3. u(n) 4. u(n) + 1 5. cos 2 πn 6. u(n) + cos(2πn + π) 7. cos(2πn + π) + δ(n − 1) 8. 2cos(2n − π)

3

9. cos ⎜⎛ n + π ⎟⎞ + u ( n ) ⎝2 ⎠

(

)

EOCP 1.4 Use MATLAB to check periodicity for the signal in EOCP 1.3. EOCP 1.5 Find the power in the following signals: 1. u(n) n ≥ 0 2. u(n) n ≥ 1 ∞

3.

∑δ ( n − m ) 0n ≥ m=0

48

Discrete Signals and Systems with MATLAB®

EOCP 1.6 Find the energy in each of the following signals for −5 ≤ n ≤ 5: 1. 2. 3. 4. 5. 6.

u(n) cos(2πn) nu(n) 2u(n)cos(2πn) u(n) u(−n) n cos(2πn)

Find the energy in the following signals for n > 0: 1. u(n) (.1)n 2. (.1)n cos(2πn) 3. (.5)n n

EOCP 1.7 Consider the following signals: 1. x(n) = u(n) + u(n − 1) 0 ≤ n ≤ 5 2. x(n) = nu(n) 0 ≤ n ≤ 5 3. x(n) = (.1)n cos(2πn + 1) 0 ≤ n ≤ 5 a. Use MATLAB to sketch the even and the odd parts. b. Show that the energy in x(n) is the sum of the energy in its components, the even and the odd parts. c. Are the signals bounded?

EOCP 1.8 Usually the discrete signals we deal with in engineering, x(n), are obtained by taking samples from continuous signals x(t). Give five examples where discrete signals are naturally discrete.

EOCP 1.9 Consider the following signals: 1. x(t) = e−3tu(t) 2. x(t) = e−tcos(1000t)u(t) a. Let us take samples from both signals every 2 s. Find x(n) for both. b. What is the time constant for the first signal? c. If 0 ≤ n ≤ 10, find the energy in x(n) for both signals.

49

Signal Representation

EOCP 1.10 Let y(n) = y(n − 1) + u(n) with y(−1) = 1 for n ≥ 0. 1. Write down the samples for y(n). 2. Can you find a closed form equation for y(n)? EOCP 1.11 Let y(−1) = 1 and consider the following equation: y ( n ) = 2y ( n − 1) + u ( n ) 1. Find the samples for y(n) for n ≥ 0. 2. Find a mathematical closed form expression for y(n).

2

Discrete System

2.1 DEFINITION OF A SYSTEM A system is an assemblage of things that are combined to form a complex whole. When we study systems, we study the interactions and behaviors of such an assem­ blage when subjected to certain conditions. These conditions are called inputs. In its simplest case, a system can have one input and one output. This book deals with linear systems. We will call the input x(n) and the output y(n) as depicted in Figure 2.1.

2.2 INPUT AND OUTPUT The discrete signal x(n) is the continuous signal x(t) sampled at t = nTs, where t is the continuous time, n is an integer, and Ts is the sampling interval. If an input signal x(t) is available at the input of a linear system, the system will operate on the signal x(t) and produce an output signal that we call y(t). As an example, consider the case of an elevator where you push a button to go to the fifth floor. Pushing the button is the input x(t). The elevator is the system under consideration here. In addition to many other components, the elevator system consists of the small room to ride in and the motor that drives the elevator belt. The input signal x(t) “asks” the elevator to move to the fifth floor. The elevator system will process this request and move to the fifth floor. The motion of the elevator to the selected floor is the output y(t). Pushing the button in this elevator case produces an electrical signal x(t). This signal drives the motor of the elevator to produce a rotational motion, which is trans­ ferred, via some gears, to a translational motion. This translational motion is the output y(t). To summarize, when an electrical input signal or request x(t) is applied to the elevator system, the elevator will operate on the signal and produce y(t), which, in this example, can be thought of as a translational motion. The example that we just considered is inherently a continuous system. An exam­ ple of a discrete or digital system is the digital computer. The computer has many inputs and outputs. An input can be generated by pressing any key on the keyboard and an output can be the display of the character that the user presses on the key­ board on the screen. The mouse and the scanner can be thought of as inputs as well. A computer program is a digital set of zeros and ones. It has an input set of raw data. The output of the computer program is the useful data.

51

52

Discrete Signals and Systems with MATLAB®

FIGURE 2.1

2.3

Linear system representation.

LINEAR DISCRETE SYSTEMS

A linear discrete system has the following properties: 1. If the input is αx1(n), the output is αy1(n). 2. If the input is x1(n) + x2(n), the output is y1(n) + y2(n). By combining the two conditions, a system is considered linearly discrete if for the input αx1(n) + βx2(n), the output is αy1(n) + βy2(n), where α and β are constants. Example 2.1 Consider the input–output relation. ⎡ R2 ⎤ y ( n) = ⎢ ⎥ x ( n) ⎣ R1 + R2 ⎦ where α and β are constants. Is this system linear? SOLUTION Using the definition of linearity introduced previously, we can proceed as follows. If the input is x1(n), the output is y1(n); therefore, we write ⎡ R2 ⎤ y1 ( n) = ⎢ ⎥ x1 ( n) ⎣ R1 + R2 ⎦ If the input is x2(n), the output is y2(n); therefore,

⎡ R2 ⎤

y 2 ( n) = ⎢ ⎥ x2 ( n) ⎣ R1 + R2 ⎦ If the input is αx1(n) + βx2(n), the output is y(n); therefore,

⎡ R2 ⎤

y ( n) = ⎢ ⎥ αx1 ( n) + βx2 ( n) = αy1 ( n) + βy 2 ( n) ⎣ R1 + R2 ⎦

(

Thus, the system is said to be linear.

)

53

Discrete System

Example 2.2 Consider the following system: y ( n) = x ( n) Is this system linear? SOLUTION Consider two cases of the input signals, x1(n) and x2(n). The corresponding outputs are then given by y1 ( n) = x1 ( n) for x1(n) and y 2 ( n) = x2 ( n) for x2(n). Now let us consider further that αx1(n) + βx2(n) has been applied to the system as its input. The corresponding output is then given by y ( n) = αx1 ( n) + βx2 ( n) But y ( n) = αx1 ( n) + βx2 ( n) ≠  αy1 ( n) + βy 2 ( n) = α x1 ( n) + β x2 ( n) Therefore, the system is nonlinear.

Example 2.3 Consider the following system: ⎛ ⎞ 2 y ( n) = ⎜ ⎟ x ( n) ⎝ ⎡⎣ 2x ( n) + 1⎤⎦ ⎠ Is this system linear? SOLUTION As in Example 2.2, consider two cases of the input signals, x1(n) and x2(n). The cor­ responding outputs are then given by ⎛ ⎞ 2 y1 ( n) = ⎜ ⎟ x1 ( n) ⎤ ⎡ + 1 2x n ⎝ ⎣ 1( ) ⎦ ⎠

54

Discrete Signals and Systems with MATLAB® and ⎛ ⎞ 2 y 2 ( n) = ⎜ ⎟ x2 ( n) ⎝ ⎡⎣ 2x2 ( n) + 1⎤⎦ ⎠ Now, let us apply αx1(n) + βx2(n) to the system as its input. The corresponding output is then given by ⎛ ⎞ 2 ⎟ αx1 ( n) + βx2 ( n) y ( n) = ⎜ ⎜⎝ ⎡ 2 αx1 ( n) + βx2 ( n) + 1⎤ ⎟⎠ ⎦ ⎣

(

(

)

)

or y ( n) =

⎣⎡2αx1 ( n) + 2βx2 ( n) ⎤⎦ ⎡2αx 1 ( n ) + 2βx 2 ( n ) + 1⎤ ⎣ ⎦

≠ αy1 ( n) + βy 2 ( n) ⎡2αx1 ( n) ⎤⎦ 2βx2 ( n) = ⎣ + 2x1 ( n) + 1 2x2 ( n) + 1 Therefore, the system is nonlinear.

2.4

TIME INVARIANCE AND DISCRETE SIGNALS

A system is said to be time invariant if, for a shifted input x(n − n0), the output of the system is y(n − n0). To see if a system is time invariant or time variant, we do the following: 1. Find the output y1(n − n0) that corresponds to the input x1(n). 2. Let x2(n) = x1(n − n0) and then find the corresponding output y2(n). 3. Check if y1(n − n0) = y2(n). If this is true then the system is time invariant. Otherwise it is time variant. Example 2.4 Let y(n) = cos(x(n)). Find out if the system is time variant or time invariant. SOLUTION

Step 1

(

y1 = cos x1 ( n)

) (

y1 ( n)  shifted by  n0   is   y1 ( n − n0 ) = cos x1 ( n − n0 )

)

55

Discrete System

Step 2

(

y 2 ( n) = cos x1 ( n − n0 )

)

Step 3 y1 ( n − n0 ) = y 2 ( n) Thus, the system is time invariant.

Example 2.5 Let y(n) = x(n)cos(n). Find out if the system is time variant or time invariant. SOLUTION

Step 1 y1 ( n) = x1 ( n) cos ( n) Therefore, y1 ( n − n0 ) = x1 ( n − n0 ) cos x1 ( n − n0 )

Step 2 y 2 ( n) = x1 ( n − n0 ) cos ( n)

Step 3 y1 ( n − n0 ) ≠ y 2 ( n) Therefore, the system is time variant.

Example 2.6 Let y(n) = ne −nx(n). Find out if the system is time variant or time invariant. SOLUTION

Step 1 y1 ( n) = ne −n x1 ( n) Therefore, y1 ( n − n0 ) = ( n − n0 ) e − ( n − n0 ) x1 ( n − n0 )

56

Discrete Signals and Systems with MATLAB®

Step 2 y 2 ( n) = ne −n x1 ( n − n0 )

Step 3 y1 ( n − n0 ) ≠ y 2 ( n) Therefore, the system is time variant.

2.5 SYSTEMS WITH MEMORY If at any value of n, y(n) depends totally on x(n) at that particular value, then in such a case, we say the system is without memory. Otherwise the system is with memory. Example 2.7 Consider the input–output relation.

(

y 2 ( n) = x ( n)

)

2

Is the system with or without memory? SOLUTION For any value of n, y(n) depends on x(n) at that particular value. If we look at the output at n = 4, then we look at the input at n = 4 as well. In this case, the system is without memory.

Example 2.8 Consider the following system:

y ( n) = nx ( n − 1)

Is the system with or without memory? SOLUTION The output y(n) at n = 0 depends on x(n) at n = −1. Therefore, the system is with memory.

2.6

CAUSAL SYSTEMS

A causal system is a system where the output y(n) at a certain time n1 depends on the input x(n) for n < n1.

57

Discrete System

Example 2.9 If x(n) is given as

{ }

x ( n) = 1, 1, 1 ↑    and the output y(n) is

{

2, 1/4 y ( n) = 1, 1/   ↑    

}

Is this system causal? SOLUTION The first sample of the input has appeared at n = 0, as does the first sample of the output. Therefore, the system is causal. Note that the system is causal even if the output starts at any value for which n ≥ 0.

Example 2.10 Let the input x(n) be as

{

1, x ( n) = 1, 0,   0 ↑      

}

Let this signal be the input to a system where the output was recorded as

{

y ( n) = 1, 1, 0,  1, 0      ↑  

}

Is the system causal? SOLUTION The first input sample starts at n = 0 and the first output sample starts at n = −3. This makes the system noncausal.

2.7

INVERSE OF A SYSTEM

If we can determine the input by measuring the output, then the system under con­ sideration is said to be invertible. Note that if two inputs give the same output, then the system is not invertible.

58

Discrete Signals and Systems with MATLAB®

FIGURE 2.2 System for Example 2.11.

Example 2.11 Consider the following systems: 1. y(n) = x(n) 2. y(n) = 2x(n) 3. y(n) = a cos(x(n)) Are these systems invertible? SOLUTION The first system is invertible. The corresponding pictorial representation is shown in Figure 2.2. The second system is also invertible. Figure 2.3 shows the corre­ sponding pictorial depiction. The third system is not invertible. Why? Let us consider two inputs, x1(n) = x(n) and x2(n) = x(n) + nπ, where n is an even integer. For this system, the output corresponding to x1(n) = x(n) is given by

(

y1 ( n) = acos x ( n)

)

and the output corresponding to x2(n) = x(n) + nπ is given by

(

)

(

)

y 2 ( n) = acos x ( n) + nπ = acos x ( n)   We can see here that two different inputs produced the same output. Therefore, the system is not invertible as claimed.

2.8 STABLE SYSTEM The signal x(n) is considered bounded if |x(n)| < β < ∞ for all n, where β is a real number. A system is said to be BIBO (bounded-input bounded-output) stable if and when the input is bounded, the output is also bounded. y(n), the output, is bounded if |y(n)| < β < ∞.

FIGURE 2.3

System for Example 2.11.

59

Discrete System

Example 2.12 Consider the system y ( n) =

M −1

∑x (n − k ) k =0

and assume that x(n) is bounded. Is the system stable? SOLUTION If x(n) is bounded, this implies that x ( n) < β But a shifted version of x(n) is also bounded for x(n) is bounded. Therefore, M −1

∑x (n − k ) ≤ Mβ

y ( n) =

k =0

and the system is BIBO.

Example 2.13 Consider that x(n) is bounded and applied to a system where y(n) is obtained as M −1

∑x (n − k )

y ( n) = n

k =0

Is the system BIBO? SOLUTION Since x(n) is bounded, we have |x(n)| < β. We also know that a shifted version of x(n) is also bounded. Thus, M −1

∑ x (n − k ) < nMβ

y ( n) = n

k =0

However, as n approaches infinity, y(n) will grow without bounds and the system is not BIBO.

2.9

CONVOLUTION

To find the output of a discrete system y(n) to an input x(n), we need the impulse response h(n) for the system. h(n) is the output of the system when the input is δ(n), where δ(n) is the impulse signal. If we apply the signal δ(n) to the system as shown

60

Discrete Signals and Systems with MATLAB®

FIGURE 2.4 The response to the impulse signal.

in Figure 2.4, the output is h(n). Notice that we do not know the system itself (the input–output relation), but we know that if the input is the impulse signal δ(n), the output will be the impulse response h(n). Now consider the shifted impulse signal δ(n − m) to the same system, as shown in Figure 2.5. The output will also be shifted because we are considering only linear systems. Therefore, δ(n − m) will produce h(n − m). We have also seen in Chapter 1 that any discrete signal can be represented as the sum of weighted shifted impulses (samples). We have seen that the signal x(n) can be represented as x (n) =

+∞

∑ x (m)δ (n − m)

(2.1)

m=−∞

Note that each x(m) is a sample and a constant. Also, if x(m) is multiplied by δ(n − m) and applied to the discrete linear time-invariant system, the output will be x(m)h(n − m), as shown in Figure 2.6. Now let us say that we were to add all the shifted weighted samples +∞

∑ x (m)δ (n − m)

m=−∞

and present this as input to the same system. The output in this case is +∞

∑ x (m) h (n − m)

m=−∞

FIGURE 2.5

The response to the shifted impulse signal.

FIGURE 2.6

The response to the shifted impulse signal multiplied by a constant.

61

Discrete System

which is the sum of all the responses to each weighted sample individually. But +∞

∑ x (m)δ (n − m) = x (n)

m=−∞

Knowing that when x(n) is presented as an input to a linear time-invariant system, the output is y(n) allows us to write y (n) =

+∞

∑ x (m) h (n − m)

(2.2)

m=−∞

or y (n) = x (n) * h (n) The previous equation is the convolution equation that, given x(n), the input to a dis­ crete system, and h(n), the impulse response, will give the output y(n). This also tells that, given h(n) for any system, you can find y(n) for any input x(n). Example 2.14 Consider the system in which the impulse response is known to be h ( n) = ( 2) u ( n) n

n≥0

Find the output y(n) for the input x(n) = δ(n). SOLUTION Note that we expect the output to be the h(n) given because the input is δ(n). Using the convolution sum, we have y ( n) =





x ( m) h ( n − m) =

m=−∞



∑ δ (m)( 2)

n− m

u ( n − m)

m=−∞

But δ(m) is only defined at m = 0. Therefore, y ( n) = δ ( 0 )( 2)

n−0

u ( n − 0 ) = 1( 2) u ( n) = h ( n) n

n≥0

as anticipated.

Example 2.15 Consider the input x(n) = u(n) and the impulse response h(n) = (.5)nu(n) for a certain system. What is the output of the system?

62

Discrete Signals and Systems with MATLAB® SOLUTION Using the convolution equation, we write y ( n) =

+∞



x ( m) h ( n − m) =

−∞

+∞

∑ u (m) (.5)

n− m

u ( n − m)

m=−∞

But since u(m) = 1 for n ≥ 0 and both x(n) and h(n) start at n = 0, we have y ( n) =

m= n

n

n

m=0

m=0

m=0

∑ (.5)n−m = (.5)n ∑ (.5)−m = (.5)n ∑ ((.5)−1) y ( n) = (.5)

n

(

m

)

−1 n+1 ⎤ ⎡ ⎢⎣1− (.5) ⎥⎦ 0 n≥ −1 1− (.5)

The last result was obtained using the geometric series sum. m= n

S=

∑ ( a)

m

m=0

⎡1− ( a)n+1 ⎤ ⎦ = ⎣ 1− a

Example 2.16 Let x(n) = (.5)n + (.6)n + 1 and h(n) = u(n) for n ≥ 0. Find y(n). SOLUTION Using the convolution equation, we write y ( n) =

m=∞

∑ u (m) ⎣⎡(.5)

n− m

+ (.6)

n − m +1

m=−∞

⎤ u n − m) ⎦ (

which reduces to

y ( n) =

m= n

∑ (.5)

n− m

+ (.6)

n − m +1

= (.5)

m=0

n

(

)

(

)

−1 n+1 ⎤ −1 n+1 ⎤ ⎡ ⎡ 1− (.5) 1− (.6) ⎥⎦ ⎣⎢ ⎦⎥ + .6 n+1 ⎣⎢ ( ) −1 −1 1− (.5) 1− (.6)

Example 2.17 Consider the system where x(n) = Au(n) and h(n) = Bu(n). Find the output y(n). SOLUTION Using the convolution sum, we have y ( n) =

+∞

∑ Au (m) Bu (n − m)

m=−∞

63

Discrete System which reduces to y ( n) =

m= n

∑AB = AB (n + 1) n ≥ 0 m=0

Note that this system grows without bounds as n approaches infinity.

2.10 DIFFERENCE EQUATIONS OF PHYSICAL SYSTEMS A difference equation that represents the input–output relation for a discrete linear time-invariant system is of the form as follows: N

y (n) −

M

∑a y ( n − k ) = ∑b x ( n − k ) k

k

k =1

(2.3)

k =0

with the initial conditions y(−1), y(−2), … , y(−N). The relation in the previous equa­ tion is a general relation between x(n), the input, and y(n), the output of the discrete system. The order of this general difference equation is N. We also say that N is the degree of the system. An example is the difference equation as follows: y ( n ) − 2y ( n − 1) = x ( n ) where N is 1, the order of the discrete difference equation; thus, it is a first-order dif­ ference equation. Our goal is to find the output y(n) given the input x(n). The total solution has two parts: the homogeneous solution and the particular solution. We will learn how to find the total solution in the following section. But first, we will see how to find the homogeneous solution.

2.11 HOMOGENEOUS DIFFERENCE EQUATION AND ITS SOLUTION The general form of a homogeneous difference equation is N

y (n) −

∑a y ( n − k ) = 0 k

(2.4)

k =1

with initial conditions y(−1), y(−2), … , y(−N) and all inputs set to zero. You can see that without inputs, the homogeneous solution is zero unless we have nonzero initial conditions. To find yh(n), the homogeneous solution, we assume a solution of the form c(p)n. If c(p)n is a solution, it must satisfy the homogeneous previous equation. So we sub­ stitute c(p)n into Equation (2.4) to get c ( p) − n

N

∑a c ( p) k

k =1

n− k

=0

64

Discrete Signals and Systems with MATLAB®

Since the summation in the previous equation is over k, we write c ( p) − c ( p) n

N

n

∑a p k

−k

=0

k =1

By expanding the previous equation, we get c ( p ) ⎣⎡1 − a1 p−1 − a2 p−2 − a3 p−3 − aN p− N ⎦⎤ = 0 n

To satisfy the previous equation, either c ( p) = 0 n

or ⎡⎣1 − a1 p−1 − a2 p−2 − a3 p−3 −  − aN p− N ⎤⎦ = 0 But c(p)n cannot be zero. Therefore, ⎡⎣1 − a1 p−1 − a2 p−2 − a3 p−3 −  − aN p− N ⎤⎦ = 0

(2.5)

This equation is called the characteristic equation of the system. If we multiply this equation by pN, we will have ⎡⎣ p N − a1 p N −1 − a2 p N −2 − a3 p N −3 −  − aN ⎤⎦ = 0 So the homogeneous solution yh(n) is yh ( n ) = c1 ( p1 ) + c2 ( p2 ) +  + cN ( pN ) n

n

n

(2.6)

where p1, p2, … , pN are the roots of ⎡⎣ p N − a1 p N −1 − a2 p N −2 − a3 p N −3 − aN ⎤⎦ = 0 and c1, c2, … , cN are constant to be determined using the given initial conditions. Example 2.18 Consider the homogeneous difference equation that describes a discrete system as y ( n) − 2y ( n − 1) = 0 with the initial condition y(−1) = +1. What is y(n)? Check your answer using iterations.

65

Discrete System SOLUTION The solution y(n) is the sum of the homogeneous and the particular parts. The homogeneous part is due to the initial condition and the particular part is due to the existing external inputs. In this case, there are no external inputs and so the particular part is zero. The homogeneous part is calculated by first assuming a solution of the form yh(n) = cpn and then substituting in the given equation to get cp n − 2cp n−1 = 0 or

(

)

cp n 1− 2p −1 = 0 The characteristic equation is then 1 − 2p −1 = 0. Solving for p we get p = 2. The homogeneous solution is then y h ( n) = c1 ( 2)

n

To find c1, we use the initial condition and write y ( −1) = 1 = c1 ( 2)

−1

The final solution is then y ( n) = y h ( n) + y p ( n) = 2 ( 2) u ( n) n

We can check the validity of the solution obtained by iteration. We can rewrite the given difference equation as y ( n) = 2y ( n − 1) With the given initial condition, we can find y(n) for n ≥ 0 as in the following: For   n = 0, For   n = 1, For   n = 2, For   n = 3,

y ( 0 ) = 2y ( −1) = 2 (1) = 2

y (1) = 2y ( 0 ) = 2 ( 2) = 4

y ( 2) = 2y (1) = 2 ( 4 ) = 8 y ( 3) = 2y ( 2) = 2(8) = 16

These values can be checked via the closed form solution. y ( n) = 2 ( 2) For   n = 0, For   n = 1, For   n = 2, For   n = 3,

n

y ( 0 ) = 2 ( 2) = 2

1 y (1) = 2 ( 2) = 4

2

y ( 2) = 2 ( 2) = 8

3

y ( 3) = 2 ( 2) = 16 0

If we are interested in the first few values of y(n), we can use iteration, and if we are interested, for example, in y(1000), we better find the closed form solution.

66

Discrete Signals and Systems with MATLAB®

2.11.1

CaSe When RootS aRe all DiStinCt

When all roots are distinct, the form of the homogeneous solution is yh ( n ) = c1 p1n + c2 p2n +  + cn pnn

(2.7)

where p1, p2, … , pn are the roots of the characteristic equation. c1, c2, … , cn are to be determined using the given initial conditions.

2.11.2

CaSe When tWo RootS aRe Real anD equal

If we consider a second-order discrete system, the roots in this case will be equal and real. Denoting the roots as p1 = p2 = p, the homogeneous solution in this case is yh ( n ) = c1 pn + c2 npn

(2.8)

The reason for multiplying the second term by n is to make the two terms indepen­ dent. If we have three equal real and repeating roots, the homogeneous solution is yh ( n ) = c1 pn + c2 npn + c3 n 2 pn

(2.9)

If two roots are real and equal and one root is real, then yh ( n ) = c1 pn + c2 npn + c3 ( p3 )

n

(2.10)

where p = p1 = p2 and p3 is the other real root.

2.11.3

CaSe When tWo RootS aRe Complex

Suppose the roots in this case are p1 and p2. Complex roots always appear as complex conjugates. So if p1 = a + jb, then p2 = a − jb. Then we can put p1 and p2 in polar form and get p1 = Me jθ p2 = Me − jθ and the homogeneous solution is then

(

yh ( n ) = c1 Me jθ

)

n

(

+ c2 Me − jθ

)

n

67

Discrete System

For this solution to be real, c1 must be the complex conjugate of c2. Because of that we write the solution as

(

yh ( n ) = c1 Me jθ

)

n

(

+ c1* Me − jθ

)

n

Since c1 is the complex conjugate of c2, the two terms in the previous solution are conjugates. If z1 = a + jb z2 = a − jb then z1 + z2 = 2a = 2real ( z1 ) = 2real ( z2 ) where real stands for the real part of the complex number. The constants can be written in polar form as c1 = Qe jβ and c2 = Qe−jβ. With this at hand, we rewrite the homogeneous solution as

(

)

(

n

yh ( n ) = Qe jβ Me jθ + Qe − jβ Me − jθ

)

n

(

)

n = 2real ⎡Qe jβ Me jθ ⎤ ⎦ ⎣

= 2real ⎣⎡QM n e j (β+θn ) ⎦⎤

(

yh ( n ) = 2QM n real ⎣⎡cos ( θn + β ) + j sin ( θn + β ) ⎤⎦ = 2QM n cos ( θn + β )

) (2.11)

where θ = tan−1 (b/a) Q is the magnitude of c1 β = 0 3

72

Discrete Signals and Systems with MATLAB®

or 8 − 2k 2 = ( 2 − k )( 2 + k ) > 0 Thus, for stability, the values for k should be limited to −2 < k < 2. Example 2.20 Consider the following system:

y ( n) − 2y ( n − 1) = x ( n)



Is the system stable? SOLUTION The character equation is

p− 2= 0

with p = 2 as the root. Since p > 1, the system is unstable. With the Jury test, we have 1 −2

[−2 1](−2/1) −3

Subtract

0

−3 is not positive. Thus, the system is unstable.

Example 2.21 Consider the following system:

y ( n) − 0.5y ( n − 1) = x ( n) Is the system stable? SOLUTION The character equation is

p − 0.5 = 0

with p = 5. Since 0 ≤ 5 ≤ 1, the system is stable.



73

Discrete System With the jury test, we have 1 −0.5 [−0.5 1](−0.5/1) [3/4]

Subtract 0

3/4 is positive and the system is stable.

2.14 BLOCK DIAGRAM REPRESENTATION OF LINEAR DISCRETE SYSTEMS So far we have seen linear discrete systems represented as difference equations. These systems can also be represented as block diagrams. The main components for the block diagrams are given next.

2.14.1

Delay element

The delay element is shown in Figure 2.7. In this case, y ( n ) = x ( n − 1) where D in the diagram is the delay time. The delay element can be implemented physically as a shift register.

2.14.2 Summing/SubtRaCting JunCtion This junction is shown in Figure 2.8. The output here is y ( n ) = x1 ( n ) ± x 2 ( n )

FIGURE 2.7

The delay element.

FIGURE 2.8 The summing/subtracting junction.

74

Discrete Signals and Systems with MATLAB®

FIGURE 2.9 The multiplier element.

2.14.3 multiplieR The multiplier is shown in Figure 2.9. In this case, y ( n ) = kx ( n ) Example 2.22 Consider the following system:

y ( n) − 2y ( n − 1) = x ( n)



Represent this system in block diagram form. SOLUTION This is a first-order system where only y(n) is delayed. The block is shown in Figure 2.10. y ( n) = 2y ( n − 1) + x ( n) = 2Dy ( n) + x ( n) The direction of the arrows is important. It means that the signals are flowing in the indicated direction.

Example 2.23 Consider the following system:

y ( n) − 5y ( n − 1) − 3y ( n − 2) = x ( n − 1) Give the block diagram representation.

FIGURE 2.10 Block diagram for Example 2.22.

75

Discrete System

FIGURE 2.11

Block diagram for Example 2.23. SOLUTION

We rewrite the output as

y ( n) = 5y ( n − 1) + 3y ( n − 2) + x ( n − 1)

In terms of the D operator, we have

y ( n) = 5Dy ( n) + 3D 2y ( n) + Dx ( n ) The representation is shown in Figure 2.11.

2.15 FROM THE BLOCK DIAGRAM TO THE DIFFERENCE EQUATION This is best illustrated by examples. The rule is that you find signals at the junctions proceeding from the input side going right to the output side. Example 2.24 Consider the block diagram in Figure 2.12. Find the difference equation repre­ sented in the diagram. SOLUTION Looking at the output of the first summing junction from the left, we have the sig­ nal x(n). Looking at the output of the second summing junction, we have the signal

FIGURE 2.12 Block diagram for Example 2.24.

76

Discrete Signals and Systems with MATLAB®

FIGURE 2.13 Block diagram for Example 2.25. x(n) + x(n − 1) + 2y(n). The output of the last summing junction is y(n). Coming to this last junction is the signal x(n − 1) + x(n − 2) + 2y(n − 1). Thus, the output of the last junction is y(n) = 2y(n − 1) + x(n − 1) + x(n − 2). The difference equation is then y ( n) − 2y ( n − 1) = x ( n − 1) + x ( n − 2)

Example 2.25 Consider the system shown in Figure 2.13. What is the difference equation? SOLUTION The output of the first summer is y(n). The output of the second summer is y(n − 1). The output of the third summer is y(n − 2). The output of the fourth summer is y(n), which is y(n − 3) + x(n). Therefore, the system representation as a difference equation is y ( n) − y ( n − 3) = x ( n)

2.16 FROM THE DIFFERENCE EQUATION TO THE BLOCK DIAGRAM: A FORMAL PROCEDURE This procedure will also be discussed using examples. Example 2.26 Consider the following system: y ( n) − 2y ( n − 1) = x ( n) + x ( n − 1) Draw the block diagram. SOLUTION 1. The given system is first order in y(n). Therefore, we will need only one delay element.

77

Discrete System

FIGURE 2.14

Block diagram for Example 2.26.

2. We initially draw the diagram shown in Figure 2.14 where we have one delay element preceded and followed by a summing junction. The input and output lines are drawn with x(n) line not connected. 3. In the given equation, solve for y(n) to get y ( n) = 2y ( n − 1) + x ( n) + x ( n − 1) Let us represent a delay by D, two delays by D2 and so on to get y ( n) = 2Dy ( n) + x ( n) + Dx ( n) y ( n) = D ⎡2 ⎣ y ( n) + x ( n) ⎤⎦ + x ( n) We will feed (2y(n) + x(n)) to the summer before the delay and x(n) to the summer following the delay as shown in the final diagram in Figure 2.15.

Example 2.27 Consider the following system: y ( n) − 0.5y ( n − 1) − 0.3y ( n − 2) = 3x ( n) + x ( n − 1) Draw the block diagram. SOLUTION 1. Our system is second order in y(n), so we need two delay elements. 2. Draw the initial block diagram as shown in Figure 2.16 where every delay is preceded and followed by a summing junction and x(n) is hang­ ing and not connected.

FIGURE 2.15

Block diagram for Example 2.26.

78

Discrete Signals and Systems with MATLAB®

FIGURE 2.16 Block diagram for Example 2.27. 3. Solve for y(n) as y ( n) = 0.5y ( n − 1) + 0.3y ( n − 2) + 3x ( n) + x ( n − 1) Represent each delay by D and so on to get y ( n) = 0.5Dy ( n) + 0.3D 2y ( n) + 3x ( n) + Dx ( n) y ( n) = D 2 ⎡⎣0.3y ( n) ⎦⎤ + D ⎣⎡0.5y ( n) + x ( n) ⎦⎤ + 3x ( n) Feed 0.3y(n) to the summer before the first delay, (0.5y(n) + x(n)) to the summer before the second delay, and 3x(n) to the summer following the last delay to get the block diagram shown in Figure 2.17.

Example 2.28 Consider the following system:

y ( n) − 3y ( n − 3) = x ( n − 3)

Draw the block diagram.

SOLUTION 1. The system is third order in y(n) and we will need three delay elements. 2. We initially draw the block as shown in Figure 2.18 with each delay pre­ ceded and followed by a summer and the x(n) input line hanging.

FIGURE 2.17 Block diagram for Example 2.27.

FIGURE 2.18

Block diagram for Example 2.28.

79

Discrete System

FIGURE 2.19

Block diagram for Example 2.28.

3. Next we solve for y(n) as y ( n) = 3D 2y ( n) + D 2x ( n) = ⎡⎣3y ( n) + x ( n) ⎤⎦ D3 + [ 0 ] D 2 + [ 0 ] D + [ 0 ] 3y(n) + x(n) is fed to the summer preceding the first delay, 0 to the sum­ mer preceding the third delay, and 0 to the summer following the last delay as shown in Figure 2.19. Note that 0 means nothing is connected.

2.17

IMPULSE RESPONSE

The impulse response is the response due to an impulsive input. We will call the output y(n), h(n) when the input x(n) is δ(n). Example 2.29 Find the impulse responses for the following system:

y ( n) − .5y ( n − 1) = x ( n)



SOLUTION The output will be h(n) if x(n) = δ(n). The difference equation becomes

h ( n) − .5h ( n − 1) = δ ( n)



This is a nonhomogeneous difference equation in h(n) and has a solution that contains two parts: hh(n) and hp(n). For hh(n), the character equation is p − .5 = 0 and p = 0.5. So hh ( n) = c1 (.5)

n

For the particular solution we look at Table 2.1 and find that if the input is an impulse, the particular solution is zero. Thus, hp(n) = 0. Therefore, h ( n) = hh ( n) + hp ( n) = c1 (.5) Next we find c1. From the previous equation, we have h ( 0 ) = c1 (.5) = c1 0

n

80

Discrete Signals and Systems with MATLAB® But we do not know the values for h(0). From the given system with x(n) = δ(n), we have h ( 0 ) = .5h ( −1) + δ ( 0 ) = 0 + 1 = 1 Next we equate the h(0) values to get h ( 0 ) = 1 = h ( 0 ) = c1 And finally h ( n) = (.5)

n

for n ≥ 0

Example 2.30 Consider the following system: y ( n) + 5y ( n − 1) + 6y ( n − 2) = x ( n) What is the impulse response? SOLUTION The characteristic equation is p 2 + 5p + 6 = 0 which gives p1 = −2 and p2 = −3. Since x(n) = δ(n), the particular solution for h(n) is hp(n) = 0 as seen in Table 2.1. Thus, the total solution is h ( n) = c1 ( −2) + c 2 ( −3) n

n

n≥0

To find c1 and c2, we substitute n = 0 and n = 1 in the previous solution for h(n) to get h ( 0 ) = c1 + c 2 h (1) = −2c1 − 3c 2 But we do not know the values of h(0) and h(1). However, from the given system with x(n) = δ(n) and n = 0, we get h ( 0 ) + 5h ( −1) + 6h ( −1) = δ ( 0 ) = 1 with h(0) = 1.

And with n = 1, we have

h (1) + 5h ( 0 ) + 6h ( −1) = 0

81

Discrete System with h(1) = −5. Thus, we will end up with the two algebraic equations obtained by equating values for h(0) and h(1). The equations are h ( 0 ) = 1 = c1 + c 2 h (1) = −5 = −2c1 − 3c 2 Solving the two equations gives c1 = −2 and c2 = 3 and the impulse response is then h ( n) = −2 ( −2) + 3 ( −3) n

2.18

n

n≥0

CORRELATION

Correlation between two finite duration signals x1(n) and x2(n) is referred to as crosscorrelation while correlation between the finite signal x(n) and itself is referred to as auto-correlation. Next we explain both.

2.18.1 CRoSS-CoRRelation The cross-correlation between the two signals x1(n) and x2(n) is an indication of the similarities between the two signals as a function of the delay between them. The cross-correlation between x1(n) and x2(n) is written mathematically as Rx1x2 ( k ) =



∑x ( n ) x ( n − k ) 1

(2.12)

2

n=−∞

The index k is known as the lag of x1(n) relative to x2(n). If we let n − k = m, then the cross-correlation equation becomes Rx1x2 ( k ) =





x1 ( m + k ) x 2 ( m ) =

m=−∞



∑x ( n + k ) x ( n ) 1

2

(2.13)

n=−∞

This shows that we can use two equations to evaluate cross-correlation The question whether Rx1x2 ( k ) is the same as Rx1x2 ( k ) is examined next. According to the formula for cross-correlation, we have Rx1x2 ( k ) =



∑x ( n ) x ( n − k ) 2

1

n=−∞

But Rx1x2 ( k ) =



∑x ( n + k ) x ( n ) 1

n=−∞

2

82

Discrete Signals and Systems with MATLAB®

and Rx1x2 ( − k ) =





∑x ( n ) x ( n + k ) = ∑x ( n − k ) x ( n ) 1

2

1

2

n =−∞

n=−∞

Thus, we see that Rx1x2 ( k ) = Rx1x2 ( −k )

(2.14)

The previous equations for cross-correlation are defined for energy signals where the summation converges to some constant. If the signals are power signals (periodic signals are examples of this type), then the summation will not converge, and thus, we will use average values. In this case if the period of the discrete sequence is N then the cross-correlation is taken over one period (which is the same as averaging over an infinite interval) and is defined as Rx1x2 ( k ) =

1 N

N

∑x ( n) x ( n − k ) 1

2

(2.15)

n=0

We have also seen before that the convolution between the two signals x(n) and h(n) is given by y(k ) =



∑x ( n ) h ( k − n )

n=−∞

and the convolution between x(n) and h(−n) is y(k ) =



∑x ( n ) h ( k + n )

(2.16)

n=−∞

But the quantity to the right of the equal sign in Equation (2.16) is nothing but the cross-correlation between x(n) and h(n). Therefore, we conclude that the convolution between x(n) and h(−n) is the cross-correlation between x(n) and h(n). We write x ( n ) * h ( − n ) = Rxh ( k ) =



∑x ( n ) h ( k + n )

(2.17)

n=−∞

2.18.2 auto-CoRRelation Auto-correlation is defined between the signal and itself. It is defined for energy signals as Rxx ( k ) =



∑x ( n ) x ( n − k )

n=−∞

(2.18a)

83

Discrete System

and for power signals of period N it is defined as Rxx ( k ) =

1 N

N

∑x ( n) x ( n − k )

(2.18b)

n=0

2.19 SOME INSIGHTS Let us say that we have a first-order system with the output y(n) given as y ( n ) = ( 0.5)

n

for n > 0

As n approaches infinity, the output will approach the value zero. In this sense we say the output is stable for our particular input. For first-order systems (that are described by first-order difference equations), the output will have one term of the form (a)n. For second-order systems, the output will have two terms similar to (a)n at the most. For third-order systems, we will have three terms and so on. In many systems of order greater than two, and for the purpose of analysis and design, we can reduce the order of the system at hand to a second-order system due to the fast decay of some of these terms. The solution for the output for these systems is in the following form: y ( n ) = c1 ( a1 ) + c2 ( a2 ) n

n

The stability of the system is determined by the values of a1 and a2. If any of the as has a magnitude that is greater than 1, the output y(n) will grow wild as n approaches infinity. If all the as have a magnitude not greater than 1, then the output y(n) will decay gradually and stays at a fixed value as n progresses The as are called the eigenvalues of the system. Therefore, we can say that a linear timeinvariant system is stable if the eigenvalues of the system have magnitudes not greater than 1.

2.19.1 hoW Can We FinD theSe eigenValueS? A linear time-invariant system can always be represented by a linear difference equation with constant coefficients. N

y (n) −



ak y ( n − k ) =

k =1

M

∑b x ( n − k ) k

k =0

We can look at the auxiliary algebraic equation by setting the input x(n) to zero, N

y (n) −

∑a y ( n − k ) = 0 k

k =1

84

Discrete Signals and Systems with MATLAB®

and letting y(n − k) = Dk y(n) to get N

y (n) −

∑a D y ( n) = 0 k

k

k =1

We can expand the previous equation to get y ( n ) − a1 Dy ( n ) − a2 D 2 y ( n ) −  − aN D N y ( n ) = 0 We can factor out y(n) as 2 N y ( n ) ⎡1 ⎣ − a1 D − a1 D −  − aN D ⎤⎦ = 0

y(n) cannot be zero (in which case the output of the system would be zero at all times), and therefore, 2 N ⎡1 ⎣ − a1 D − a2 D −  − aN D ⎤⎦ = 0

or a1 a2 2 ⎡ 1 N⎤ ⎢ a − a D − a D −− D ⎥ = 0 N N ⎣ N ⎦ This is an Nth order algebraic equation with N roots. Let us call them the N as. These are the eigenvalues of the system.

2.19.2

Stability anD eigenValueS

To summarize, any linear time-invariant system can be modeled by a linear differ­ ence equation with constant coefficients. The auxiliary algebraic equation that can be obtained from the difference equation will have a number of roots called the eigenvalues of the system. The stability of the system is determined by these roots. These roots may be real or complex. If all the magnitudes of the roots are less than or equal to 1, then the system is stable. If any of the roots has a magnitude that is greater than 1, the system is unstable. The eigenvalues of the system are responsible for the shape of the output y(n). They dictate the shape of the transients of the system as well.

2.20 END-OF-CHAPTER EXAMPLES EOCE 2.1 Are the following systems linear? 1. y(n) = (.5)nx(n) + 1

85

Discrete System 2. y(n) = (.5)ncos(2x(n)) 3. y(n) = sin(n) − x(n) SOLUTION 1. For an input x1(n) the output is

y1 ( n) = (.5) x1 ( n) + 1

n

For an input x2(n) the output is

y 2 ( n) = (.5) x2 ( n) + 1

n

If the input is αx1(n) + βx2(n), then the output is

y ( n) = (.5) ⎡αx ⎣ 1 ( n) + βx2 ( n) ⎤⎦ + 1

n

= (.5) αx1 ( n) + (.5) βx2 ( n) + 1 n

n

But αy1(n) + βy2(n) is α (.5) x1 ( n) + β (.5) x2 ( n) + 2 ≠ α (.5) x1 ( n) + β (.5) x2 ( n) + 1 n

n

n

n

Thus, the system is not linear. 2. For y = (.5)n cos(2x(n)) and if the input is x1(n) then

(

)

(

)

y1 ( n) = (.5) cos 2x1 ( n) n

If the input is x2(n), then

y 2 ( n) = (.5) cos 2x2 ( n)

n

Now

(

)

(

αy1 ( n) + βy 2 ( n) = α (.5) cos 2x1 ( n) + β (.5) cos 2x2 ( n) n

n

)

If the input is αx1(n) + βx2(n), then

(

y ( n) = (.5) cos 2αx1 ( n) + βx2 ( n) n

)

which is clearly not equal to αy1(n) + βy2(n). Thus, the system is not linear.

3. For y = sin(n) − x(n), if the input is x1(n), then

y1 ( n) = sin ( n) − x1 ( n)



86

Discrete Signals and Systems with MATLAB® If the input is x 2(n), then y 2 ( n) = sin ( n) − x2 ( n) Now

(

) (

αy1 ( n) + βy ( n) = α sin ( n) − x1 ( n) + β sin ( n) − x2 ( n)

)

If the input is αx1(n) + βx2(n),

(

y ( n) = sin ( n) − αx1 ( n) + βx2 ( n)

)

= sin ( n) − αx1 ( n) − βx2 ( n) which is clearly not equal to αy1(n) + βy2(n). Thus, the system is not linear. We can use MATLAB to generate the sequence α(sin(n) − x1(n)) + β(sin(n) − x2(n)) and the sequence sin(n) − αx1(n) − βx2(n), and find the differ­ ence between them. If the difference is zero, then the system is linear. Otherwise it is nonlinear. We will let α = β = 1 and x1(n) = n and x2(n) = 2n. The MATLAB script is EOCE2_1. The answer will be 1.4112. Because e in the previous script is not zero, this proves that the system is nonlinear.

EOCE 2.2 Consider the same systems as in EOCE 2.1. Are they time-variant systems? SOLUTION 1. For x1(n) as an input, y1 ( n) = (.5) x1 ( n) + 1 n

y1(n) shifted by n0 is y1 ( n − n0 ) = (.5)

n − n0

x1 ( n − n0 ) + 1

If we apply a shifted version of x1(n), x1(n − n0), then y1 ( n) = (.5) x1 ( n − n0 ) + 1 n

But y2(n) ≠ y1(n − n0), so the system is time variant. 2. For x1(n) as an input

(

y1 ( n) = (.5) cos 2x1 ( n) n

)

87

Discrete System y1(n) shifted by n0 is y1 ( n − n0 ) = (.5)

n − n0

(

cos 2x1 ( n − n0 )

)

If we apply x1(n − n0) to the system, the output would be

(

y 2 ( n) = (.5) cos 2x1 ( n − n0 ) n

)

But y1(n − n0) ≠ y2(n), so the system is time variant. 3. For y = sin(n) − x(n), if we apply x1(n) as input, the output is

y1 ( n) = sin ( n) − x1 ( n)



y1(n) shifted by n0 is

y1 ( n − n0 ) = sin ( n − n0 ) − x1 ( n − n0 )

If we apply x1(n − n0) to the system, then the output is

y 2 ( n) = sin ( n) − x1 ( n − n0 ) But y1(n − n0) ≠ y2(n), so it is a time-variant system.

We can use MATLAB to prove these results. We will compare y1(n − n0)

to y2(n) given earlier. Let x(n) = n, and let us shift by two samples. The

script is EOCE2_2.

The result will be 2.378. This proves the analytical result.

EOCE 2.3 Consider the following systems for n ≥ 0: 1. y(n) = (.5)n x(n) 2. y(n) = n(.5)n x(n) 3. y(n) = (.5)n x(n)

If x(n) is bounded, what about y(n)?

SOLUTION 1. Since x(n) is bounded, we write

x ( n) < β < ∞ If (.5)n is bounded, then we will conclude that y(n) is bounded too. N

∑ (.5)n = n=0

1− (.5) 1− .5

N+1

88

Discrete Signals and Systems with MATLAB® as N →∞, (.5)N+1 goes to zero and ∞

∑ (.5)

n

=

n=0

1 =2 1− .5

Thus, y(n) is also bounded. 2. Since x(n) is bounded, we will check the signal n(.5)n. As n approaches ∞, (. 5)n will approach zero. The multiplicative term n(.5)n will die as n approaches infinity, so the system output is bounded. 3. Because x(n) is known to be bounded, we will check the sum (5)n for n ≥ 0. N

∑ (5)n = n=0

1− ( 5) 1− 5

N+1

As N approaches infinity, (5)N+1 will grow without bounds. Thus, N

∑ (5)

n

n=0

will not converge to any value. Hence, the system output is not bounded.

EOCE 2.4 Consider the following finite duration signals:

{ } { } { }

{ }

1. x1 ( n) = 1,1,1  ↑ 

1, x2 ( n) = 1, 1  ↑ 

2. x1 ( n) = 1,1,1  ↑ 

x2 ( n) = 1,1, 1     ↑ 

3. x1 ( n) = 1,1,1  ↑ 

{ } x ( n) = δ ( n) = { 1 } ↑  2

Find x1(n) * x2(n), the convolution result, for the aforementioned cases. SOLUTION For two finite signals x1(n) and x2(n), and if x1(n) is defined on the interval sn1 < n1 < en1 and x2(n) is defined on the interval sn2 < n2 < en2, then y(n) = x1(n) * x2(n) will start at the index sn1 + sn2 and ends at the index en1 + en2. 1. y ( n) =

2

∑x (m) x ( n − m) 1

0

2

89

Discrete System In this case, x1(n) is defined on 0 < n1 < 2 and x2(n) is defined on the interval 0 < n2 < 2. y(n) will start at 0 + 0 = 0 and ends at 2 + 2 = 4. So we write y ( 0 ) = x1 ( 0 ) x2 ( 0 ) + x1 (1) x2 ( −1) + x1 ( 2) x2 ( −2) = 1+ 0 + 0 = 1 y (1) = x1 ( 0 ) x2 (1) + x1 (1) x2 ( 0 ) + x1 ( 2) x2 ( −1) = 1+ 1+ 0 = 2 y ( 2) = x1 ( 0 ) x2 ( 2) + x1 (1) x2 (1) + x1 ( 2) x2 ( 0 ) = 1+ 1+ 1 = 3 y ( 3) = x1 ( 0 ) x2 ( 3) + x1 (1) x2 ( 2) + x1 ( 2) x2 (1) = 0 + 1+ 1 = 2 y ( 4 ) = x1 ( 0 ) x2 ( 4 ) + x1 (1) x2 ( 3) + x1 ( 2) x2 ( 2) = 0 + 0 + 1 = 1 Therefore, the convolution result is

{

}

2, 3, 2,1 y ( n) = x1 ( n) * x2 ( n) = 1,         ↑

We can use MATLAB to find y(n) = x1(n) * x 2(n) if both signals start at n = 0. Since the signals here both start at n = 0, we can use MATLAB and write the script EOCE2_41 to get the same result as shown in Figure 2.20. 2. In this case, x1(n) starts at n = 0 and ends at n = 2, and x2(n) starts at n = −2 and ends at n = 0. y(n) = x1(n) * x2(n) will start at 0 + (−2) = −2 and ends at n = 2 − 2 = 0. So we write y ( n) =

2

∑x (m) x (n − m) 1

m=0

FIGURE 2.20 Signals for EOCE 2.4.

2

90

Discrete Signals and Systems with MATLAB® and y ( −2) = x1 ( 0 ) x2 ( −2 − 0 ) + x1 (1) x2 ( −2 − 1) + x1 ( 2) x2 ( −2 − 2) = (1) (1) + (1) ( 0 ) + (1) ( 0 ) = 1 y ( −1) = x1 ( 0 ) x2 ( −1− 0 ) + x1 (1) x2 ( −1− 1) + x1 ( 2) x2 ( −1− 2) = (1) (1) + (1) (1) + (1) ( 0 ) = 2 y ( 0 ) = x1 ( 0 ) x2 ( 0 − 0 ) + x1 (1) x2 ( 0 − 1) + x1 ( 2) x2 ( 0 − 2) = (1) (1) + (1) (1) + (1) (1) = 3 y (1) = x1 ( 0 ) x2 (1− 0 ) + x1 (1) x2 (1− 1) + x1 ( 2) x2 (1− 2) = (1) ( 0 ) + (1) (1) + (1) (1) = 2 y ( 2) = x1 ( 0 ) x2 ( 2 − 0 ) + x1 (1) x2 ( 2 − 1) + x1 ( 2) x2 ( 2 − 2) = (1) ( 0 ) + (1) ( 0 ) + (1) (1) = 1 Therefore, we have

{

}

y ( n) = x1 ( n) * x2 ( n) = 1, 2, 3, 2,1      ↑  

We can use MATLAB to find y(n), but, since x2(n) does not start at n = 0, we will do some modification before we can use the conv function from MATLAB. The MATLAB script EOCE2_42 will do that. The plot is shown in Figure 2.21.

FIGURE 2.21 Signals for EOCE 2.4.

91

Discrete System 3. The starting index of x1(n) is sn1 = 0 and the ending index is en1 = 2. The starting index of x2(n) is sn2 = 0 and the ending index is en2 = 0. Therefore, y(n) will start at ns = sn1 + sn2 = 0 + 0 = 0 and will end at en = en1 + en2 = 2. y ( n) =

2

∑x (m) x (n − m)

1

2

m=0

y ( 0 ) = x1 ( 0 ) x2 ( 0 − 0 ) + x1 (1) x2 ( 0 − 1) + x1 ( 2) x2 ( 0 − 2) = (1)(1) + (1)( 0 ) + (1)( 0 ) = 1 y (1) = x1 (1) x2 (1− 0 ) + x1 (1) x2 (1− 1) + x1 (1) x2 (1− 2) = (1)( 0 ) + (1)(1) + (1)( 0 ) = 1 y ( 2) = x1 ( 2) x2 ( 2 − 0 ) + x1 ( 2) x2 ( 2 − 1) + x1 ( 2) x2 ( 2 − 2) = (1)( 0 ) + (1)( 0 ) + (1)(1) = 1

{ }

y ( n) = x1 ( n) * x2 ( n) = 1,1,1  ↑ 

We can use MATLAB here directly since both signals start at n = 0 and write the script EOCE2_43. The result is shown in Figure 2.22.

FIGURE 2.22 Signals for EOCE 2.4.

92

Discrete Signals and Systems with MATLAB®

EOCE 2.5 Consider the following system represented by the impulse response h(n) h ( n) = (.5) u ( n) n

with 1. x(n) = u(n) 2. x(n) = (.5)n u(n)

Find y(n) = x(n) * h(n) for both cases.

SOLUTION 1. For the first case, +∞

∑ u (m)(.5)

y ( n) =

n− m

u ( n − m)

m=−∞

Since both signals start at n = 0, y(n) will start at n = 0.

y ( n) =

m= n

∑ (.5)

n− m

= (.5)

n

m=0

m= n

∑ (.5 )

−1 m

m=0

(

)

−1 n+1 ⎤ ⎡ ⎢ 1− (.5) ⎥ = (.5) ⎢ −1 ⎥ 1− (.5) ⎢⎣ ⎥⎦ n

After simplification, we get y ( n) = 2 − (.5)

n

n≥0

2. For the second case, y ( n) =

+∞

∑ u (m)(.5)

m

(.5)n− m u ( n − m)

m=−∞

Since both x(n) and h(n) in this case start at n = 0, we have y ( n) =

m= n

∑ (.5) m=0

m

n

n

m=0

m=0

(.5)n (.5)−m = ∑ (.5)n = (.5)n ∑1

And after simplifying, we arrive at y ( n) = n (.5)

n

n≥0

n≥0

93

Discrete System

EOCE 2.6 Consider the following homogeneous difference equations: 1. y(n) + .6y(n − 1) = 0 with y(−1) = 1 2. y(n) + y(n − 1) + (1/4) y(n − 2) = 0 with y(−1) = y(−2) = 0 a. Find the characteristic equation for the aforementioned systems and see if they are stable. b. Find the homogeneous solution for both. The homogeneous solu­ tion is the solution due to the initial conditions.

SOLUTION For the first system, the characteristic equation is p + .6 = 0

p = −.6

or

Since 0 < .6 < 1, the system is stable. The homogeneous solution is y h ( n) = c1 ( −.6)

n

for n ≥ 0

With y(−1) = 1, we have 1= c1 ( −.6)

−1

c1 = −.6 Thus, the solution is y h ( n) = −0.6 ( −.6)

n

for 0

n≥

For the second system, the characteristic equation is

p2 + p +

1 =0 4

By factoring, we get

1⎞ ⎛ 1⎞ ⎛ ⎜⎝ p + ⎟⎠ ⎜⎝ p + ⎟⎠ = 0 2 2 p1 = p2 = −

1 2

Since 0 < .5 < 1, the system is stable. The homogeneous solution is then n

⎛ 1⎞ ⎛ 1⎞ y h = c1 ⎜ − ⎟ + nc 2 ⎜ − ⎟ ⎝ 2⎠ ⎝ 2⎠

n

94

Discrete Signals and Systems with MATLAB® With the initial conditions given, we can write y ( −1) = 1 = −2c1 + 2c 2 y ( −2) = 0 = 4c1 − 8c 2 Solving these equations, we arrive at c2 = − (1/2) and c1 = −1. The final solution is then n

n

1 ⎛ 1⎞ ⎛ 1⎞ y n ( n) = − ⎜ − ⎟ − ⎜ − ⎟ n ⎝ 2⎠ 2 ⎝ 2⎠

n≥0

EOCE 2.7 Consider the following difference equations: 1. y(n) + .6y(n − 1) = u(n), y(−1) = 1 2. y ( n) + y ( n − 1) +

1 y ( n − 2) = δ ( n) , y ( −1) = 1; y ( −2) = 0 2 4

Find the total solutions for the two systems.

SOLUTION For the first system, the characteristic equation is p + .6 = 0 or p = −.6 and the homogeneous part of the solution is y h ( n) = c1 ( −.6)

n

The particular solution is taken to be

y p ( n) = c 2 This particular solution is taken from Table 2.1 with x(n) = u(n), a constant. We will substitute the particular solution into the difference equation given. We will get c 2 + .6c 2 = 1 and this gives us c2 = 1/1.6. The total solution now is y ( n) = y h ( n) + y p ( n) = c1 ( −.6) + n

1 1.6

To find c1, we use the initial condition given to us and write

1

⎛ 1 ⎞ + y ( −1) = 1 = c1 ⎜ ⎝ −.6 ⎟⎠ 1.6 c1 =

6 − .6 16

95

Discrete System and finally the solution is 1 n ⎛ 6 ⎞ y ( n) = ⎜ − .6⎟ ( −.6) + ⎝ 16 ⎠ 1.6

n≥0

For the second system, the characteristic equation is

p2 + p +

1 =0 4

with

p1 = p2 = −

1

2

The homogeneous solution is

n

⎛ 1⎞ ⎛ 1⎞ y h ( n) = c1 ⎜ − ⎟ + c 2n ⎜ − ⎟ ⎝ 2⎠ ⎝ 2⎠

n

The particular solution is yp(n) = 0 and is obtained from Table 2.1. The total solution is n

⎛ 1⎞ ⎛ 1⎞ y ( n) = c1 ⎜ − ⎟ + nc 2 ⎜ − ⎟ ⎝ 2⎠ ⎝ 2⎠

n

n≥0

Next we find the constants c1 and c2 using the given initial conditions. y ( −1) = +1 = −2c1 + 2c 2 y ( −2) = 0 = 4c1 − 8c 2 Solving the previous equation gives c1 = −1 and c2 = −1/2, and the total solution is then n

1 ⎛ 1⎞ ⎛ 1⎞ y ( n) = − ⎜ − ⎟ − n ⎜ − ⎟ ⎝ 2⎠ 2 ⎝ 2⎠

n

n≥0

EOCE 2.8 Consider the following system: y ( n) + y ( n − 1) = x ( n) For x(n) = u(n), find y(n) due to the input x(n) using the convolution summation equation. SOLUTION We will first find h(n) and then find y(n) using the convolution equation y(n) = h(n) * x(n). To find h(n) for the system, we set x(n) equal to δ(n). In this case, with

96

Discrete Signals and Systems with MATLAB® a characteristic equation of p + 1 = 0, and a particular solution of zero, as seen in Table 2.1, we have h ( n) = c1 ( −1)

n

n≥0

To find c1, we have from the solution for h(n) that h(0) = c1. Also we can substitute in the given difference equation with x(n) = δ(n) to find h(0). We will have h ( 0 ) + h ( −1) = δ ( 0 ) But h(−1) = 0 since the output starts at n = 0. Thus, h (0) = δ (0) = 1 We then equate h(0) obtained from the solution and h(0) obtained from the given system to get h ( 0 ) = c1 = h ( 0 ) = 1 c1 = 1 And the solution for the impulse response is finally h ( n) = ( −1)

n

n≥0

Once we have h(n), we can find y(n) using the convolution equation y ( n) = x ( n) * h ( n) =

+∞



u ( m) ( −1)

n− m

u ( n − m) =

m=−∞

n

m= n

m=0

m=0

∑ (−1)n−m = (−1)n ∑ ⎡⎣(−1)−1⎤⎦

m

By using the geometric series summation, we simplify to get n+1 n 2n+1 ⎤ ( −1)n n ⎡ 1− ( −1) ⎡1− ( −1)n+1 ⎤ = ( −1) − ( −1) y ( n) = ( −1) ⎢ ⎥= ⎦ 2 ⎣ 2 ⎢⎣ 1− ( −1) ⎥⎦

n≥0

EOCE 2.9 Consider the following systems: 1. 2. 3. 4.

y(n) + .6y(n − 1) = x(n) y(n) + y(n − 1) + .1y(n − 2) = x(n) − x(n − 1) y(n) + y(n − 1) + .1y(n − 2) + 8y(n − 3) = x(n) y(n) − .8y(n − 4) = x(n)

For all systems, use MATLAB to find the impulse responses in the range −10 ≤ n ≤ 20, the step responses and the sinusoidal responses for x(n) = .5sin(n)u(n).

97

Discrete System SOLUTION As we know, the general difference equation is given as y ( n) =

M



bm x ( n − m) −

m=0

N

∑a y (n − k ) k

k =1

In MATLAB, the function called filter is used to solve difference equations for a particular input x(n). The function filter is used by typing y = filter (b, a, x ) where y is the output b is the input row coefficients associated with the input a is the input row coefficients associated with the output y as seen in the previ­ ous general equation x is the given input For the first system y ( n) + 0.6y ( n − 1) = u ( n) we will enter the b and the a vectors and use the functions stepsignal and impuls­ esignal defined in Chapter 1 and write the script EOCE 2_9 to find the correspond­ ing plots. The plots are shown in Figure 2.23. You can see that the system is stable. For the second system y ( n) + y ( n − 1) + .1y ( n − 2) = x ( n)

FIGURE 2.23 Signals for EOCE 2.9.

98

Discrete Signals and Systems with MATLAB®

FIGURE 2.24 Signals for EOCE 2.9. we will use the same MATLAB script given earlier (EOCE 2_9) with the changes. b = [1];

a =[1 1 0.1];

The plots are shown in Figure 2.24. The system is stable. We can see that using MATLAB by typing Eigenvalues = roots([1 1 0.1])

to get Eigenvalues =

− 0.8873

− 0.1127

For the third system y ( n) + y ( n − 1) + .1y ( n − 2) + 8y ( n − 3) = x ( n) − x ( n − 1) we will use the previous script (EOCE 2_9) with the changes b = [1 −1];

a = [1 1 0.1 8];

to get the plots shown in Figure 2.25. The system is not stable. We can see that using MATLAB by typing Eigenvalues = roots([1 1 0.1])

99

Discrete System

FIGURE 2.25 Signals for EOCE 2.9. we get Eigenvalues =

− 2.3755

0.6878 + 1.7014i

0.6878 − 1.7014i

For the last system y ( n) − .8y ( n − 4 ) = x ( n) + .1x ( n − 2) we use b = [1 0 0.1];

a = [1 0 0 0 −0.8];

The plots are shown in Figure 2.26. The system is stable. That is asserted by typing Eigenvalues = roots([1 0 0 0 −.8])

to get Eigenvalues =

− 0.9457

−0.0000 + 0.9457i

−0.0000 − 0.9457i

0.9457

100

Discrete Signals and Systems with MATLAB®

FIGURE 2.26 Signals for EOCE 2.9.

EOCE 2.10 Consider the following system:

y ( n) + y ( n − 2) = x ( n) 1. Find the impulse response. 2. Find the output if x(n) = u(n). SOLUTION 1. The characteristic equation by inspection is p1 + 1 = 0 with the roots p1 = j and p2 = −j or p1 = ejπ/2 and p2 = e −jπ/2. Thus, h ( n) = c1e jπ / 2n + c 2e − jπ / 2n We must find c1 and c2 to completely find h(n). From the solution just obtained, we have h ( 0 ) = c1 + c 2 and h (1) = c1e jπ / 2 + c 2e − jπ / 2 = jc1 − jc 2 We now find the same from the system given to us with the input being the impulse signal and get h ( 0 ) + h ( −2) = δ ( 0 ) = 1

101

Discrete System and

h (1) + h ( −1) = δ (1) = 0

We now equate the h(0) and the h(1) obtained from the solution we arrived at with h(0) and h(1) obtained from the difference equation that was given to us. We will have the two simultaneous algebraic equations c1 + c 2 = 1 jc1 − jc 2 = 0 The result will be c1 = c 2 =

1 2

and the impulse response is then

h ( n) =

1 jπ / 2n ⎛π ⎞ ⎡e + e − jπ / 2n ⎦⎤ = cos ⎜ n⎟ 0 n≥ ⎝2 ⎠ 2⎣

2. Using convolution, the output y(n) is +∞

∑ u (m) cos ⎛⎜⎝ π2 n − π2 m⎞⎟⎠ u (n − m)

y ( n) = h ( n) * x ( n) =

m=−∞ n

=

∑ cos ⎛⎜⎝ n π2 − m − π2 ⎞⎟⎠ m=0

Using trigonometric identities, we arrive at y ( n) =

n

∑ cos ⎛⎜⎝ n π2 ⎞⎠⎟ cos ⎛⎜⎝ m π2 ⎞⎟⎠ + sin ⎛⎜⎝ n π2 ⎞⎟⎠ sin ⎜⎛⎝ m π2 ⎟⎞⎠ m=0

⎛ π⎞ = cos ⎜ n ⎟ ⎝ 2⎠

n

∑ m=0

⎛ π⎞ ⎛ π⎞ cos ⎜ m ⎟ + sin ⎜ n ⎟ ⎝ 2⎠ ⎝ 2⎠

n

∑ sin ⎛⎜⎝ m π2 ⎞⎟⎠ m=0

EOCE 2.11 So far in this chapter, we have learned that a discrete linear system can be repre­ sented by its block diagram, its difference equation, and its impulse response h(n). Given in the following are systems represented as difference equations. Find the other two representations. 1. y(n) + 2y(n − 1) = x(n)

102

Discrete Signals and Systems with MATLAB® 2. y(n) − 4y(n − 2) = x(n) 3. y(n) − .9y(n − 1) + 10y(n − 2) + y(n − 3) = x(n) + x(n − 1) SOLUTION 1a. The block diagram representation Let y(n − 1) = Dy and y(n − 2) = D2y, and so on. The difference equation can be written then as y ( n) + 2Dy ( n) = x ( n) Solve for y(n) to get y ( n) = −2Dy ( n) + x ( n) The system is first order in y and should have one delay element in the block diagram. As we did earlier, we will have a summer before and after each delay, we will feed −2y(n) to the summer before the delay and x(n) to the summer after the delay. The block diagram is shown in Figure 2.27. 1b. The impulse response representation The impulse response representation completely describes the discrete system since, given any input we can find the output as y = x(n) * h(n). We start by letting x(n) = δ(n) in the difference equation given y ( n) + 2y ( n − 1) = δ ( n) The character equation is p + 2 = 0 or p = −2 is the root. Thus, h ( n) = c1 ( −2 ) n ≥ 0 n

To find c1, we have 0 h(

) = c1 ( −2)0 c1

and h(0) in the given difference equation is found as h ( 0 ) + 2h ( −1) = δ ( 0 ) = 1

FIGURE 2.27 System for EOCE 2.11.

103

Discrete System

FIGURE 2.28 Signals for EOCE 2.11. So h(0) = 1 = c1 and finally h ( n) = 1( −2) n ≥ 0 n

This impulse response can be found by using MATLAB as in the script

EOCE2_111.

The plot is shown in Figure 2.28.

2a. The block diagram representation

The difference equations can be written as

y ( n) = 4D 2y ( n) + x ( n) We need two delays in this case and the block diagram is shown in Figure 2.29.

FIGURE 2.29 System for EOCE 2.11.

104

Discrete Signals and Systems with MATLAB® 2b. The impulse response representation

The difference equation is

y ( n) − 4y ( n − 2) = δ ( n) The character equation is

p2 − 3 = 0

p 2 = 3

or

p = ± 4 = ±2

The impulse response is then

h ( n) = c1 ( 2) + c 2 ( −2) n

n

From this last equation for h(n), we get

h ( 0 ) = c1 + c 2

h (1) = 2c1 − 2c 2 and so we need values for h(0) and h(1). We do that using the given dif­ ference equation and write h ( 0 ) − 4h ( −2) = δ ( 0 ) = 1

and

h (1) − 4h ( −1) = δ (1 ) = 0 Therefore, we have now the two algebraic equations to solve 1= c1 + c 2 0 = 2c1 − 2c 2 The results are

c1 = c 2 =

1

2

and the final solution is then h ( n) =

1⎡ n ( 2) + ( −2)n ⎤⎦ 0n ≥ 2⎣

h(n) can also be found using MATLAB as in the script EOCE2_112.

The plot is shown in Figure 2.30.

3a. The block diagram representation

The difference equation can be written as

y ( n) = 0.9Dy ( n) − 10D 2y ( n) − D3y ( n) + x + Dx ( n)

Discrete System

FIGURE 2.30 Signals for EOCE 2.11.

Here we need three delay elements since the system is third order. The block diagram is shown in Figure 2.31. 3b. The impulse response representation We will use MATLAB to find the impulse response as in the script EOCE2_113. The plot is shown in Figure 2.32. The system is unstable since the magni­ tude of some of the roots is bigger than 1. The MATLAB command Eigenvalues = roots([1 −.9 10 1])

will result in

EigenValues =

0.4995 + 3.1384i

0.4995 − 3.1384i

− 0.0990

FIGURE 2.31

System for EOCE 2.11.

105

106

FIGURE 2.32

Discrete Signals and Systems with MATLAB®

Signals for EOCE 2.11.

EOCE 2.12 Consider the block diagrams shown in Figures 2.33–2.36. Find the other representations. SOLUTION For the system in Figure 2.33, the output after the first summer is x(n) + 0.1y(n). The output at the second summer is x(n − 1) + 0.1y(n − 1) + x(n). The output of the second summer is also y(n). Therefore, y ( n) = 0.1y ( n − 1) + x ( n) + x ( n − 1) The impulse response is obtained graphically using MATLAB as in the script EOCE2_121. The plot is shown in Figure 2.37. For the system in Figure 2.34, the output after the first summer is x(n). After the second summer, the output is x(n − 1) + x(n). After the third summer, the output is x(n − 2) + x(n − 1) + x(n). This output is actually y(n). Therefore, y ( n) = x ( n) + x ( n − 1) + x ( n − 2)

FIGURE 2.33 System for EOCE 2.12.

FIGURE 2.34

System for EOCE 2.12.

Discrete System

FIGURE 2.35

System for EOCE 2.12.

FIGURE 2.36 System for EOCE 2.12.

FIGURE 2.37

Signals for EOCE 2.12.

107

108

Discrete Signals and Systems with MATLAB®

To calculate the impulse responses we simply let x(n) = δ(n). Therefore, h ( n) = δ ( n) + δ ( n − 1) + δ ( n − 2) We can also use MATLAB to find the impulse response as in the script EOCE2_122. The plot is shown in Figure 2.38. For the system in Figure 2.35, the output of the first summer is x(n) + y(n). At the output of the second summer, we have x(n) + x(n − 1) + y(n − 1). At the output of the third summer, we have x(n) + x(n − 1) + x(n − 2) + y(n − 2). At the output of the last summer, we have y ( n) = x ( n) + x ( n − 1) + x ( n − 2) + x ( n − 3) + y ( n − 3) and the difference equation is y ( n) − y ( n − 3) = x ( n) + x ( n − 1) + x ( n − 2) + x ( n − 3) The impulse response can be evaluated using MATLAB as in the script EOCE2_123. The plot is shown in Figure 2.39. For the system shown in Figure 2.36, the output of the first summer is x(n) + y(n). At the output of the second summer, we have y ( n) = x ( n) + 2x ( n − 1) + y ( n − 1) The impulse response using MATLAB is obtained using the script EOCE2_124.

The plot is shown in Figure 2.40.

FIGURE 2.38 Signals for EOCE 2.12.

Discrete System

FIGURE 2.39 Signals for EOCE 2.12.

FIGURE 2.40 Signals for EOCE 2.12.

109

110

Discrete Signals and Systems with MATLAB®

We can also find this response analytically. Recall the general form of the dif­ ference equation: y ( n) +

N

M

∑a y (n − k ) = ∑b x (n − k ) k

k

k =1

k =0

If N, the degree of the difference equation, is less than M, the general form of h(n) is h ( n) =

N



ck ( pk ) + n

k =1

M

∑A δ (n − k ) k

k =0

where pk is the k-th root of the characteristic equation of the system. In this exam­ ple, N = 1 and M = 1. Therefore, h ( n) =

1

∑ k =1

ck ( Pk ) + n

0

∑A δ (n − k ) = c ( p ) k

1

1

n

+ A0δ ( n)

k =0

We need to find the constant c1 and A0. We do that by evaluating the equation for h(n) at n = 0 and n = 1 to get h ( 0 ) = c1 + A0 h (1) = p1c1 But p1 is the characteristic root of the characteristic equation and is 1. Thus, h ( 0 ) = c1 + A0 h (1) = c1 To solve for c1 and A0, we evaluate the difference equation at n = 0 and n = 1 when x(n) = δ(n). We will get h ( 0 ) − h ( −1) = δ ( 0 ) + 2δ ( −1) which gives h(0) = 1. We also have h (1) − h ( 0 ) = δ (1) + 2δ ( 0 ) which gives h(1) = 3. By comparing this h(1) with the h(1) obtained earlier, we get c1 = 3 and A0 = h(0) − c1 = 1 − 3 = −2. Therefore, the final impulse response is h ( n) = 3 (1) − 2δ ( n) = 3 − 2δ(n) n

which agrees with the plot in Figure 2.40.

111

Discrete System

EOCE 2.13 Consider the discrete systems represented by the impulse responses. 1. h(n) = (.3n)u(n) 2. h(n) = ((.3)n + (.2)n)u(n) 3. h(n) = δ(n) + δ(n − 1) + δ(n − 2) + δ(n − 3) Find the difference equations first then use MATLAB to find the output y(n) if x(n) = u(n) − u(n − 5). SOLUTION 1. For the first system, multiply h(n) = (.3)n u(n) by .3 and shift by 1 to get

(.3) h ( n − 1) = (.3) (.3)n−1 u ( n − 1) If we subtract these last two equations, we will have h ( n) − .3h ( n − 1) = (.3) u ( n) − (.3) (.3) n

n−1

u ( n − 1)

We can rearrange terms and write h ( n) − .3h ( n − 1) = (.3) u ( n) − (.3) u ( n − 1) = (.3) ⎡u ⎣ ( n) − u ( n − 1) ⎤⎦ n

n

n

But [u(n) − u(n − 1) is the impulse at n = 0. Thus, h ( n) − .3h ( n − 1) = (.3) δ ( n) = δ ( n) n

since (.3)n δ(n) has value only when n = 0. We know that if the input x(n) is δ(n), then the output is y(n) = h(n). Therefore, the difference equation is y ( n) − .3y ( n − 1) = x ( n) At this point, we have the difference equation and the input, so we can use the MATLAB filter function to find y(n). We will use the MATLAB functions stepsignal and x1plusx2 to generate u(n) and −u(n − 1) and then add them to get u(n) − u(n − 1). We do that because these two step signals start at different indices. The MATLAB script EOCE2_131 will be used. The plots are shown in Figure 2.41. 2. For the second system h ( n) = (.3) u ( n) + (.2) u ( n) n

n

This impulse response can be thought of as a sum of the output responses each due to one system as shown in Figure 2.42. We have h1 ( n) = (.3) u ( n) n

112

Discrete Signals and Systems with MATLAB®

FIGURE 2.41 Signals for EOCE 2.13.

FIGURE 2.42 System for EOCE 2.13.

Multiply by .3 and shift by 1 to get .3h1 ( n − 1) = (.3)(.3)

n−1

u ( n − 1)

By subtracting the last two equations we get h1 ( n) − .3h1 ( n − 1) = (.3) u ( n) − (.3) u ( n − 1) = (.3) ⎣⎡u ( n) − u ( n − 1) ⎤⎦ n

n

n

= (.3) δ ( n) = δ ( n ) n

Therefore, the difference equation is

y1 ( n) − .3y1 ( n − 1) = x ( n)



113

Discrete System

FIGURE 2.43 System for EOCE 2.13. Similarly, h2(n) = (.2)n u(n) can be shown to have the difference equation representation y 2 ( n) − .2y 2 ( n − 1) = x ( n) We will use MATLAB to find y(n) = y1(n) + y2(n) for x(n) = u(n) − u(n − 5)

by writing the EOCE2_132 script.

The plots are shown in Figure 2.43.

3. For the third system, h ( n) = δ ( n) + δ ( n − 1) + δ ( n − 2) + δ ( n − 3) We know that when x(n) = δ(n), then y(n) = h(n). The difference equation is then y ( n) = x ( n) + x ( n − 1) + x ( n − 2) + x ( n − 3) The output is found using MATLAB as in the EOCE2_133 script. The plots are shown in Figure 2.44.

EOCE 2.14 Consider the following systems shown in Figures 2.45 and 2.46. Let x(n) = u(n) in Figure 2.45 and x(n) = δ(n) in Figure 2.46. Find y(n) for both cases. Let h1 ( n) = h2 ( n) = h3 ( n) = (.5) u ( n) n

114

FIGURE 2.44 Signals for EOCE 2.13.

FIGURE 2.45 System for EOCE 2.14.

FIGURE 2.46 System for EOCE 2.14.

Discrete Signals and Systems with MATLAB®

115

Discrete System SOLUTION For the system in Figure 2.45, the output y(n) is y ( n) = x ( n) * h1 ( n) + x ( n) * h2 ( n) and x ( n) * h1 ( n) =

+∞



m=−∞

= (.5)

+∞

∑ u (m) (.5)

x ( m) h1 ( n − m) =

n

n− m

u ( n − m)

m=−∞

n

∑ ((.5) )

−1 m

= (.5)

(

n

m=0

= − (.5) + (.5) = 2 − (.5)   n ≥ 0 n

−1

n

Similarly x ( n) * h2 ( n) = 2 − (.5) 0 n≥ n

Therefore, the final output is n≥ y ( n) = 4 − 2 (.5) 0 n

For the system in Figure 2.46, the output of the summer is x ( n) * h1 ( n) + x ( n) * h2 ( n) = z ( n) The output of the system is y ( n) = z ( n) * h3 ( n) We have n≥ x ( n) * h1 ( n) = 2 − (.5) 0 n

and x ( n) * h2 ( n) = 2 − (.5) 0 n≥ n

The output of the summer is z ( n) = 4 − 2 (.5) 0 n≥ n

)

−1 n+1 ⎤ ⎡ ⎢⎣1− (.5) ⎥⎦ −1 1− (.5)

116

Discrete Signals and Systems with MATLAB®

and the output of the whole system is then y ( n) =

+∞

+∞

∑ z (m) h (n − m) = ∑ (4 − 2(.5) ) u (m) (.5) m

3

m=−∞

n− m

u ( n − m)

m=−∞

y ( n) = 4 (.5)

n

n

∑ (.5 )

−1 m

− 2 (.5)

m=0

n

n

∑1 m=0

Finally, the output is

y ( n) = 4 (.5)

n

(

)

−1 n+1 ⎤ ⎡ ⎢⎣1− (.5) ⎥⎦ n n n − 2 (.5) [ n + 1] = 8 − 4 (.5) − 2 (.5) [ n + 1] 0 n≥ −1 1− (.5)

EOCE 2.15 Consider the following signals: x1 ( n) = u ( n)

0≤n≤9

x2 ( n) = u ( n)

0 ≤ n ≤ 18

x3 ( n ) = u ( n )

−4 ≤ n ≤ 5

x4 ( n ) = u ( n )

−9 ≤ n ≤ 0

Correlate x1(n) with itself and all other signals. SOLUTION We will use the MATLAB script EOCE2_15 to do this. We can see clearly that for

Rx1x1 the strongest correlation is when the lag k is equal to zero. In this case Rx1x1 at

k = 0 is obtained by summing 1(1) 10 times to get 10 as the strength. For Rx1x2 the maximum strength is at k = −9. This is true because for a full overlap we need to shift x2(n) in the reverse direction, which means negative k. If k = 0 in this case we have only one sample overlap: 1(1) = 1. This is evident from the plot shown in Figure 2.47.

EOCE 2.16 One important application of cross-correlation is the estimation of the impulse response h(n). Given a system with impulse response h(n), the output using

117

Discrete System

FIGURE 2.47 Plots for EOCE 2.15. convolution is y(n) = x(n) * h(n). If we cross-correlate the output of the system with a noisy input with normal distribution, then the cross-correlation Ryr ( k ) = y ( n) * r ( −n) = ⎡⎣ r ( n) * h ( n) ⎤⎦ * r ( − n) = Rrr ( k ) * h ( n) where r(n) is a noisy random input; in the previous equation we have used the fact that r(n) * h(n) = h(n) * r(n). The signal Rrr(k) is the auto-correlation of the input noise. If the input noise has a bandwidth that is much greater than the bandwidth of the system, we write Ryr ( k ) ≈ h ( n) The reason is that if the auto-correlation of the input noise is approximately an impulse, then we know that it contains a very wide band of frequencies. To see that let us look at the noise auto-correlation. We will use MATLAB script EOCE2_161 to do that. The plot is shown in Figure 2.48. You can easily see that the auto-correlation is approximately the same as the impulse signal, which has a huge bandwidth. Therefore, we say that if we cross-correlate the random normally distributed input noise with the output of the system, we will have an approximation of the impulse response of the system.

118

Discrete Signals and Systems with MATLAB®

FIGURE 2.48 Plot for EOCE 2.16. Let us look at an example. Consider the following system: y ( n) + .5y ( n − 1) = x ( n) SOLUTION We will plot its actual impulse response and then the approximation to it using cross-correlation between the output and the input noise. We do that using MATLAB script EOCE2_162. The plots are shown in Figure 2.49.

2.21 END-OF-CHAPTER PROBLEMS EOCP 2.1 Consider the following systems for n ≥ 0: y(n) = nx(n) y(n) = cos(x(n)) + u(n) y ( n ) = nx ( n ) y(n) = (4)n sin(n) π 5. y ( n ) = cos ⎛ n − 1⎞ ⎝ 2 ⎠

1. 2. 3. 4.

Discrete System

FIGURE 2.49

119

Plots for EOCE 2.16.

sin ( nx ( n )) n y(n) = sin(n)cos(x(n)) y(n) = y(n − 1) + x(n) y(n) = ny(n − 1) + x(n) y(n) = y(n − 1) + y(n − 2) + x(n)

6. y ( n ) = 7. 8. 9. 10.

Are the aforementioned systems linear? Are they time-invariant systems? Show work. EOCP 2.2 Consider the following systems: h(n) = u(n), x(n) = u(n) h(n) = (.2) n u(n), x(n) = δ(n) h(n) = (.3)n u(n), x(n) = u(n) h(n) = (.3)n u(n), x(n) = (.2)n u(n) h(n) = (.3)n nu(n), x(n) = δ(n)

πn ⎞

n 6. h ( n ) = n (.5) cos ⎛ + 1 u (n), x (n) = δ (n) ⎝ 2 ⎠ 7. h(n) = (.4)n u(n), x(n) = u(n) − u(n − 2)

1. 2. 3. 4. 5.

120

Discrete Signals and Systems with MATLAB®

8. h(n) = u(n) − u(n − 2), x(n) = u(n) − u(n − 2) 9. h(n) = (.4)n u(n), x(n) = (.5)n [u(n) − u(n − 1)] 10. h(n) = (.1)n u(n), x(n) = (.5)n [u(n) − u(n − 5)] Find the output y(n) for each system using the convolution sum equation. Are the systems stable? EOCP 2.3 Consider the following finite signals:

{ } { } 2. x ( n ) = {1   1   1  1  } , x ( n ) = {1   1   1  1  } ↑ ↑ 1   2 2  1  3 3. x ( n ) = {−1        ↑} , x ( n ) = { ↑   } −3  −4 1  2 4. x ( n ) = {− 1  −2    ↑   } , x ( n ) = {↑   } 2  −2  3 3− 1  2  3 5. x ( n ) = {1   −1      ↑     } , x ( n ) = {   ↑   } 1. x1 ( n ) = 1 1 1 1 , x ( n ) = 1 1 1 1 ↑       2 ↑       1

1

2

2

1

1

2

2

Find x(n) = x1(n) * x2(n) for each case given earlier. EOCP 2.4 Consider the following systems with the initial conditions: 1. 2. 3. 4. 5. 6.

y(n) − .6y(n − 1) = 0, y(−1) = 1 y(n) − .6y(n − 2) = 0, y(−1) = 0, y(−2) = 1 y(n) − .6y(n − 1) + .6y(n − 2) = 0, y(−1) = 0, y(−2) = −1 y(n) − .1y(n − 3) = 0, y(−1) = y (−2) = 0, y(−3) = 1 y(n) + .1y(n − 1) + y(n − 3) = 0, y(−1) = 0, y(−2) = 2, y(−3) = 0 y(n) + .6y(n − 2) = 0, y(−1) = y(−2) = 1

Are the aforementioned systems stable? What is the output due to the given initial conditions? EOCP 2.5 Consider the following systems: 1. 2. 3. 4.

y(n) − .6y(n − 1) = sin(n), y(−1) = 0 y(n) − .6y(n − 2) = δ(n), y(−1) = y(−2) = 0 y(n) − .6y(n − 1) + .6y(n − 2) = 3δ(n), y(−1) = 0, y(−2) = 0 y(n) − .1y(n − 3) = δ(n), y(−1) = y(−2) = y(−3) = 0

Discrete System

5. y(n) + .1y(n − 1) + y(n − 3) = 2δ(n), y(−1) = y(−2) = y(−3) = 0 6. y(n) + .6y(n − 2) = 3u(n), y(−1) = y(−2) = 0 Find the total output, y(n), for each system mentioned earlier. EOCP 2.6 Consider the following difference equations: 1. 2. 3. 4. 5. 6.

y(n) − .6y(n − 1) = x(n) y(n) − .6y(n − 2) = x(n) − x(n − 1) y(n) − .6y(n − 1) + .6y(n − 2) = x(n) y(n) − .1y(n − 3) = x(n) + x(n − 1) y(n) + .1y(n − 1) + y(n − 3) = x(n) y(n) + .6y(n − 2) = x(n − 2)

Draw the block diagram for each system. EOCP 2.7 Consider the following systems: 1. 2. 3. 4. 5. 6.

h(n) = δ(n) − δ(n − 1) h(n) = δ(n) − δ(n − 1) + δ(n − 2) + δ(n − 4) h(n) = u(n) h(n) = (.3) nu(n) h(n) = (.3)nu(n) + (.6)nu(n) h(n) = u(n), 0 ≤ n ≤ 5

What are the difference equations that represent these systems? EOCP 2.8 Consider the following difference equations: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

y(n) + 3y(n − 1) = x(n) y(n) + 3y(n − 1) + 3y(n − 2) = x(n) y(n) − .1y(n − 2) = x(n) y(n) + .1y(n − 2) = x(n) y(n) + 3y(n − 1) = x(n) + x(n − 1) y(n) + 3y(n − 1) + 3y(n − 2) = x(n) + x(n − 1) + x(n − 2) y(n) − .1y(n − 2) = x(n) + x(n − 1) + x(n − 2) y(n) + .1y(n − 2) = x(n) + x(n − 1) + x(n − 2) + x(n − 4) y(n) + 3y(n − 1) = x(n) + x(n − 1) + x(n − 2) y(n) + 3y(n − 1) = x(n) + x(n − 1) + x(n − 2) + x(n − 3)

What are the impulse responses for each system mentioned earlier?

121

122

Discrete Signals and Systems with MATLAB®

EOCP 2.9 Consider the block diagrams shown in Figures 2.50–2.59. What are the impulse responses for each system?

FIGURE 2.50

System for EOCP 2.9.

FIGURE 2.51 System for EOCP 2.9.

FIGURE 2.52

System for EOCP 2.9.

FIGURE 2.53 System for EOCP 2.9.

FIGURE 2.54 System for EOCP 2.9.

Discrete System

FIGURE 2.55 System for EOCP 2.9.

FIGURE 2.56

System for EOCP 2.9.

FIGURE 2.57

System for EOCP 2.9.

FIGURE 2.58 System for EOCP 2.9.

FIGURE 2.59

System for EOCP 2.9.

EOCP 2.10 Consider the following systems: 1. y(n) + ky(n − 1) = x(n) 2. y(n) + ky(n − 1) + y(n − 2) = x(n) 3. y(n) − ky(n − 1) = x(n)

123

124

Discrete Signals and Systems with MATLAB®

4. y(n) + y(n − 1) + ky(n − 2) = x(n) 5. y(n) + .1y(n − 1) + .3y(n − 2) + y(n − 3) = x(n) a. For what values of k are the systems stable? b. Use MATLAB to find the step, impulse, and the sinusoidal responses for all systems with suitable k. EOCP 2.11 Consider the following difference equation: y ( n ) − yk ( n − 1) + 0.5y ( n − 2 ) = 0.5 x ( n ) 1. 2. 3. 4. 5.

Is the system stable? For what k values? Draw the block diagram representation of the system. Use MATLAB to find the step and the impulse responses for a certain k. Find the impulse response analytically with k of your choice. Find the step response analytically assuming zero initial conditions with suitable k. 6. Solve the difference equation by iterations for n = 0, 1, 2, 3, and 5, if x(n) = u(n) for suitable k.

EOCP 2.12 Consider the following system represented by the difference equation: y ( n ) − 6y ( n − 1) + 9ky ( n − 2 ) = 19 x ( n ) 1. Use MATLAB to find the step and the impulse responses for a k value that makes the system stable. 2. Use MATLAB to find the output y(n) if x(n) = 2u(n) + 5nu(n). 3. Draw the block diagram for the system. EOCP 2.13 Consider the following systems: 1. y(n) + .2y(n − 1) = x(n) 2. y(n) + .2y(n − 1) + .1y(n − 2) = x(n) Approximate the impulse response using cross-correlation. Compare with the actual impulse response.

3

Fourier Series and

the Fourier Transform of Discrete Signals

3.1 INTRODUCTION According to Joseph Fourier, a discrete periodic signal can be represented as a sum of complex exponentials or sinusoids. Also, a nonperiodic discrete signal and a finiteduration discrete signal can be represented as a finite sum of complex exponentials. This last representation for finite-duration discrete signals is called the Fourier trans­ form of discrete signals. There are many advantages for this representation. The most important one is that if the discrete signal is put in the frequency domain, every single frequency in the signal will be clearly identified. Consider the plot of the discrete signal y ( n ) = cos ( 2πn ) + 200 cos ( 4 πn ) + 0.1 cos (10 πn ) as shown in Figure 3.1. By looking at the plot, you would hardly think that this signal is composed of many sinusoids. You will probably reason that this signal contains no sinusoids at all. In the frequency domain, if we look at the magnitude of the signal, we see something similar to Figure 3.2. You can clearly see the three frequencies in the figure. You may also argue that these signals of small magnitudes, like the term 0.1 cos(10πn), can be neglected. You may be wrong, especially if this term is the term that we are interested in. Before we present discussion about the discrete Fourier series and the discrete Fourier trans­ form, we provide a very useful review on complex numbers.

3.2

REVIEW OF COMPLEX NUMBERS

This is a good place to give a brief review of complex numbers because the chapters ahead, as well as this chapter, are heavily involved with their arithmetic manipulation.

3.2.1 Definition By definition, the complex number j is the square root of −1. In general, the complex number C = P + jQ consists of two parts: the real part P and the imaginary part Q. C can be represented in many forms as we will see later. If we are multiplying or dividing complex numbers, we would prefer to use the polar form. If we are adding or subtracting complex numbers, we would rather use the rectangular form. The rea­ son for that is the ease each form provides in the corresponding calculation. Consider two complex numbers C1 and C2, where C1 = P1 + jQ1 and C2 = P2 + jQ2. These complex numbers are given in the rectangular form. 125

126

Discrete Signals and Systems with MATLAB®

FIGURE 3.1 A discrete sinusoidal signal.

FIGURE 3.2 A discrete signal in the frequency domain.

3.2.2 ADDition When we add two complex numbers, we add their real parts and their imaginary parts together to form the addition as follows: C1 + C2 = ( P1 + P2 ) + j (Q1 + Q2 )

(3.1)

3.2.3 SubtrAction When we subtract two complex numbers, we subtract their real parts and their imag­ inary parts to form the subtraction as follows: C1 − C2 = ( P1 − P2 ) + j (Q1 − Q2 )

(3.2)

Fourier Transform of Discrete Signals

3.2.4

127

MultiplicAtion

Let us now consider the two complex numbers in polar form. In polar form, C1 and C2 are represented as C1 = M1e jθ1 and C2 = M 2 e jθ2 where M1 = P12 + Q12 M 2 = P22 + Q22 and ⎡Q ⎤ θ1 = tan −1 ⎢ 1 ⎥ ⎣ P1 ⎦ ⎡Q ⎤ θ2 = tan −1 ⎢ 2 ⎥ ⎣ P2 ⎦ We can also represent the complex numbers C1 and C2 as M1 < θ1 and M2 < θ2, where M1, M2, θ1, and θ2 are as given earlier. The complex number M1 < θ1 is read as a com­ plex number with magnitude M1 and phase angle θ1. Complex numbers are easily multiplied in polar form as M1e jθ1 M 2 e jθ2 = M1 M 2 e j(θ1 + θ2 ) = M1 M 2 ∠ ( θ1 + θ2 )

(3.3)

If we have more than two complex numbers in polar form to be multiplied, we use the same procedure. We multiply their magnitudes and add their phase angles to form the new product.

3.2.5 DiviSion To divide two complex numbers, we divide their magnitudes and subtract their phase angles. jθ1 C1 ⎡⎣ M1e ⎤⎦ = C2 ⎡⎣ M 2 e jθ2 ⎤⎦

⎡M ⎤ ⎡M ⎤ = ⎢ 1 ⎥ e j(θ1 + θ1 ) = ⎢ 1 ⎥ ∠ ( θ1 − θ1 ) M 2 ⎣ ⎦ ⎣ M2 ⎦

(3.4)

128

FIGURE 3.3

Discrete Signals and Systems with MATLAB®

Rectangular form.

3.2.6 froM rectAngulAr to polAr Consider the complex number C1 = P1 + jQ1. This representation in the rectangular form is shown in Figure 3.3. To convert to polar form, we write C1 as C1 = M1ejθ1 M1 < θ1, where ⎡Q ⎤ M1 = P12 + Q12  and  θ1 = tan −1 ⎢ 1 ⎥ ⎣ P1 ⎦

3.2.7 froM polAr to rectAngulAr Consider the complex number C1 = M1e jθ1 = M1 < θ1 in polar form, as seen in Figure 3.4. To convert to its equivalent rectangular form, we write C1 as C1 = P1 + jQ1, where ⎡Q ⎤ M12 = P12 + Q12  and tan ( θ1 ) = ⎢ 1 ⎥ ⎣ P1 ⎦ These two equations can be solved simultaneously for P1 and Q1.

FIGURE 3.4 Polar form.

129

Fourier Transform of Discrete Signals

3.3 FOURIER SERIES OF DISCRETE PERIODIC SIGNALS We are given the discrete signal x(n) that might be the result of sampling a continu­ ous signal x(t) at t = nTs . This signal is periodic of period N samples if x (n) = x (n + N ) for all integer values n. The fundamental period is the smallest N that satisfies the previous condition. The period in seconds would be NTs, where Ts is the sampling period. In this case, the digital frequency is θ = 2π/NTs. Now consider the complex exponential set φm ( n ) = e jmθnTs = e j 2πmn / N   m = 0, ±1, 2± 

(3.5)

where m is referred to as the frequency index. n is the discrete-time index. Notice that this complex exponential set is periodic with period N for all integers n since φm ( n + N ) = e jmθ( n + N )Ts = e j 2πm e j 2πmn / N = 1e j2πmn / N = φm ( n )

(3.6)

Notice also that since ϕ m(n + N) = ϕ m(n), there is only one set of complex functions of length N that is unique in the overall set. Unique set means that the members in the set are independent; no one function or complex exponential in the set can be written as a linear combination of the others. In the set ϕ m(n) of length N, we see that N −1

n−1



φm ( n ) =

n=0

∑e

j 2 πmn / N

n=0

⎧⎪ N   m = 0, ±N, ±2 N , = ⎨ ⎪⎩ 0  m ≠ 0, ,± N 2± N,

(3.7)

since using the geometric series sum, we have N −1



e j 2 πmn / N =

n=0

N −1

∑(e

)

j 2πm / N n

n=0

=

1 − e( j 2πm / N ) N ⎧⎪ N   m = 0, ±N, ±2 N , =⎨ 1 − e j 2πm / N ⎪⎩ 0  m ≠ 0, ,± N 2± N,

(3.8)

We can also see that N −1



e j 2 πmn / N e − j 2 πkn / N =

n=0

N −1

∑(e n=0

j 2 πn( m − k ) / N

⎧ N , m = k ,± k + N 2± k + N , ⎩ 0  m ≠ k ,  ± k + N ,  ± k + 2 N ,

) = ⎪⎨⎪

(3.9)

130

Discrete Signals and Systems with MATLAB®

This is the orthogonality condition. The periodic signal x(n) can be approximated as the linear combination of the unique set ϕ(m) with the N complex exponentials as x (n) =

N −1

∑C e m

j 2πmn / N

(3.10)

n=0

To find the Fourier series coefficients, we multiply the previous approximation by e−j2πkn/N and then sum over the period N to get Cm =

1 N

N −1

∑x ( n) e

− j 2 πmn / N

(3.11)

n=0

using the geometric series sum and the orthogonality condition we established earlier. Try to see it for yourself. Writing the approximation to the periodic signal x(n) allows us to clearly see the frequency contents of the signal through the coefficients cm. These coefficients are complex numbers, yet they have a magnitude and a phase. It can be easily seen that the cm set is periodic. We write cm + N =

1 N

N −1



x ( n ) e − j2 π( m + N )n / N =

n=0

1 N

N −1

∑x ( n) e

− j 2 πn

e j 2πnm / N = cm

(3.12)

n=0

Also, if x(n) is real, then the Fourier series magnitude coefficients have even sym­ metry and the phase of the coefficients have odd symmetry. We finish this topic with an example. Consider the periodic discrete signal x(n) = {1 0 1 1 0 1 1 0 1 …} with Ts = 0.1 s as the sampling interval used to obtain x(n). The period N is clearly 3. Thus, the Fourier series coefficients are calculated as in the following: 1 c0 = 3

c1 =

1 3

1 c2 = 3

2

∑x ( n) e

− j2 π 0 n /3

=

n=0 2

∑x ( n) e

− j 2 πn /3

=

1 1 ⎡ x ( 0 ) + x (1) e − j2 π /3 + x ( 2 ) e − j4 π /3 ⎤⎦ = [ 0.5 + j.886 ] 3⎣ 3

=

1 1 ⎡x ( 0 ) + x (1) e − j4 π /3 + x ( 2 ) e − j8 π /3 ⎦⎤ = [ 0.5 − j.886 ] 3⎣ 3

n=0 2

∑x ( n) e n=0

− j 4 πn /3

1 [ x ( 0 ) + x (1) + x ( 2)] = 23 3

These are the frequency components in the signal x(n). These components are located at mθ = m2π/NTs = 20mπ/3 rad/s for m = 0, 1, and 2. Thus, these frequen­ cies are located at 0, 20π/3, and 40π/3 rads per sample. This is something very difficult to see given only the discrete periodic signal x(n) = {1 0 1 1 0 1 1 0 1 …}

131

Fourier Transform of Discrete Signals

with Ts = 0.1 s. We will come back to the Fourier series coefficients in Chapter 5 and see how we can utilize this development to estimate the average power, the average value, and the energy in signals. We will also learn how to compute these Fourier series coefficients using the computer and the very well-known algorithm, the fast Fourier transform.

3.4 DISCRETE SYSTEM WITH PERIODIC INPUTS: THE STEADY-STATE RESPONSE To start the process, let us consider the input x(n) to be of the following form: x ( n ) = e jθn Notice that the magnitude of x(n) or its phase do not contribute to any information about the input signal frequency and that is why neither were mentioned nor con­ tained in x(n) for simplicity. With h(n), the impulse response, the output of the system in this case is y (n) = x (n) * h (n) = h (n) * x (n) =

y (n) =

+∞

∑h (m) e

+∞

+∞

m=−∞

m=−∞

∑h (m) x (n − m) = ∑h (m) e

jθ( n − m )

+∞

jθn − jθm

e

=e

jθn

m=−∞

∑h (m) e

− jθm

m=−∞

Given that n was taken in the range −∞ ≤ n ≤ ∞, the output here is the steady state output that remains after all the transients die. Finally, with x(n) = ejθn, we have yss ( n ) = x ( n )

+∞

∑h (m) e

− jθm

m=−∞

where yss(n) is the steady-state response and x(n) = ejθn. Let us define H(ejθ) as +∞

( ) = ∑h (m) e jθ

H e

− jθm

(3.13)

m=−∞

then

( )

yss ( n ) = x ( n ) H e jθ

(3.14)

132

Discrete Signals and Systems with MATLAB®

Example 3.1 Consider the impulse response for a discrete system as h(n) = δ(n) + δ(n − 1) and let the input to the system be x(n) = ej2πn for −∞ ≤ n ≤ ∞. Find the steady- state output. SOLUTION From the relation yss(n) = x(n)H(e ) with x(n) = ej2πn and H(ejθ) as jθ

+∞

( ) ∑ (δ (m) + δ (m − 1)) e

H e jθ =

− jθm

(

)

(

)

= δ ( 0 ) + δ ( −1) e − jθ(0) + δ (1) + δ ( 0 ) e − jθ(1)

m=−∞

( )

H e jθ = 1+ e − j θ Thus, the steady-state output becomes

(

)

y ss ( n) = e j 2πn 1+ e − jθ −∞ ≤ n ≤ ∞ The input is applied at θ = 2π. So

( )

H e jθ = 1+ e − j 2π = 1+ cos 2π − j  sin 2π = 2

and

y ss ( n) = 2e j 2πn   −∞ ≤ n ≤ +∞

Example 3.2 For the same system as in Example 3.1, and with the input x(n) = 10 + cos(nπ), what is the steady-state output? SOLUTION To use yss(n) = e H(e ), we must put all the terms in x(n) in exponential form and then we can use the superposition principle to find jθn



y ss1 ( n)  due to x1 ( n) = 10 = 10e jn(0) y ss2 ( n)  due to  x2 ( n) =

1 jπn e 2

y ss3 ( n)  due to  x3 ( n) =

1 − jπn e 2

where

cos ( nπ ) =

e jnπ + e − jπn 2

133

Fourier Transform of Discrete Signals From Example 3.1, we have H(ejθ) = 1 + e −jθ and for x1(n) = 10ejθ(0), we have

( )

H e jθ = 2

y ss1 ( n) = 10e jθn ( 2 ) = 20

For x2(n) = eijπn/2 with 0 = π, we have

( )

H e jθ = 1+ e − jπ = 1+ cosπ − j sinπ = 0

and

y ss 2 ( n) =

e jπn (0) = 0 2

For x3 ( n ) =

e − jπn   with θ = −π 2

we have

( )

H e jθ = 1+ e − jθ = 1+ e jπ = 1+ cosπ + j sin π = 0 and

y ss3 ( n) =

e − jπn (0) = 0 2

Therefore, the total solution is the combination as follows:

y ss ( n) = y ss1 ( n) + y ss 2 ( n) + y ss3 ( n) = 20 + 0 + 0 = 20  −∞ ≤ n ≤ +∞

Example 3.3 Find the steady-state output for the system h ( n) = (.5) u ( n)

n

with the input x(n) = 10.

SOLUTION We will find H(ejθ) first. +∞

( ) ∑ h ( m) e

H e jθ =

m=−∞



− jθm

=



∑ (.5)m e− jθm = ∑ ((.5) e− jθ ) m=0

m=0

m

=

1 1− (.5) e − jθ

134

Discrete Signals and Systems with MATLAB®

The input is x(n) = 10 = 10ejn0. So θ = 0 and

( )

H e jθ =

1 1 = =2 1− (.5) e − j0 1− 0.5

and the steady-state response is y ss ( n) = 10 ( 2) = 20 −∞ ≤ n ≤ +∞

3.4.1

General Form For yss (n)

Consider the input x(n) as x ( n ) = Xcos ( θn + ϕ ) =

x ⎡ j (θn +ϕ ) e + e − j (θn +ϕ ) ⎤⎦ 2⎣

when θ is the radian frequency. φ is the phase shift. If x(n) is applied to a linear time-invariant system, the steady-state output using Equation (3.14) will be yss ( n ) =

( )

(

x jϕ jθn x e e H e jθ + e − jϕ e − jθn H e − jθ 2 2

)

Let us write H(ejθ) in terms of its magnitude and phase as Mejα, where M is the mag­ nitude of H(ejθ) and α is its phase shift. The steady-state solution is then yss ( n ) = =

x jϕ jθn jα x − jϕ − jθn − jα e e Me + e e Me 2 2 xm jϕ j(θn +α ) ⎡e e + e − jϕ e − j(θn +α ) ⎤⎦ 2 ⎣

By putting exponents together, we get yss ( n ) =

xm ⎡ j (θn +α+ϕ ) e + e − j (θn +α+ϕ ) ⎤⎦ 2 ⎣

and finally the steady-state response is written as yss ( n ) = XM  cos ( θn + ϕ + α )

(3.15)

135

Fourier Transform of Discrete Signals

Example 3.4 Let h(n) = δ(n) + δ(n − 1) and let x(n) = 10 cos(n(π/2) + (1/2)). Find the steady-state response yss(n). SOLUTION To find the steady-state response, we need to use the formula in Equation (3.15). Thus, we need values for the parameters in the formula. The magnitude of the input is X = 10. M is the magnitude of H(ejθ) = 1 + e −jθ as shown in previous examples. The input frequency is θ = π/2, and H(ejθ) is ⎛ π⎞ ⎛ π⎞ H e jπ / 2 = 1+ e − jπ / 2 = 1+ cos ⎜ ⎟ − j  sin ⎜ ⎟ = 1− j ⎝ 2⎠ ⎝ 2⎠

(

)

The magnitude and the phase of the system at the frequency of the input are M = 1+ 1 = 2 π ⎛ −1⎞ α = tan−1 ⎜ ⎟ = −45° = − ⎝ 1⎠ 4 The steady-state response is then given by y ss ( n) = 10

3.5

( 2 ) cos ⎛⎜⎝ π2 n + 12 − π4 ⎞⎟⎠  −∞ ≤ n ≤ +∞

FREQUENCY RESPONSE OF DISCRETE SYSTEMS

The frequency response of a discrete system is a set of output values when each value is obtained for a particular input x(n) at a unique frequency value. At each frequency of the input, the output will have a change in its magnitude and phase. The frequency response H(ejθ) was derived in the process of finding the steady-state response in which we have found that

( )

yss ( n ) = x ( n ) H e jθn

if x(n) is ejθn and we have defined the frequency response as +∞

( ) = ∑h (m) e

H e



− jθm

(3.16)

m =−∞

So if we have the impulse response of the system, we can use the previous equation to find the frequency response. Also we can calculate the frequency response H(ejθ) as a function of θ from the difference equation directly.

136

Discrete Signals and Systems with MATLAB®

Consider the following first-order difference equation: y ( n ) + ay ( n − 1) = x ( n ) Let the input be periodic of the form x ( n ) = e jθn We have seen that the output will be

( )

yss ( n ) = e jθn H e jθ

Therefore, if we substitute this output in the difference equation, we will get

( )

( )

e jθn H e jθ + ae jθ( n −1) H e jθ = e jθn If we cancel out the ejθn by dividing by ejθn (note that ejθn is never zero), we will have

( )(

)

H e jθ 1 + ae − jθ = 1 or

( )

H e jθ =

1 1 + ae − jθ

which is the frequency response of the system. We can now generalize to the general difference equation case. N

y (n) −



ak y ( n − k ) =

k =1

M

∑b x ( n − k ) k

(3.17)

k =0

Similar to what we did before and by letting x(n) = ejθn and y(n) = ejθnH(ejθ), we will get

( )

e jθn H e jθ −

N



( )

ak e jθ( n − k ) H e jθ =

k =1

M

∑b e k

jθ( n − k )

k =0

We can factorize H(ejθ) and cancel the ejθn to get ⎡ H e jθ ⎢1 − ⎢⎣

( )

⎤ ak e − jθk ⎥ = ⎥⎦ k =1 N



M

∑b e k

− jθk

k =0

and finally the general frequency response is

∑ be H (e ) = 1− ∑ a e M



k =0 N

k

k =1

− jθk

k

− jθk

(3.18)

137

Fourier Transform of Discrete Signals

Example 3.5 Find the frequency response for the following system:

y ( n) + .5y ( n − 1) + 6y ( n − 2) = x ( n) + x ( n − 1 ) SOLUTION With x(n) = e

jθn

and y(n) = e

jθn

H(e ), the difference equation can be written as jθ

( )

( )

( )

e jθnH e jθ + .5e jθ( n −1)H e jθ + 6e jθ( n − 2)H e jθ = e jθn + e jθ( n −1) or

( )

⎤ = 1+ e − jθ H e jθ ⎡⎣1+ .5e − jθ + .6e − j 2θ ⎦

The frequency response is then

( )

H e jθ =

1+ e − jθ e j 2θ + e jθ = j 2θ − jθ − j 2θ 1+ .5e + 6e e + .5e jθ + 6

3.5.1 propertieS of the frequency reSponSe We will discuss two properties here. 3.5.1.1 Periodicity Property We have seen the frequency response function H(ejθ) previously and it is presented here as +∞

( )

H e jθ =

∑h (m)e

− jθm

m=−∞

For periodicity, H(ejθ) must be the same as H(ej(θ+2π)). +∞

) ∑

(

H e j(θ+ 2 π ) =

h ( m ) e − j ( θ + 2 π )m =

m=−∞

+∞

∑h (m) e

− jθm − j 2 πm

e

m=−∞

You can easily see that e − j 2 πm = cos ( 2πm ) − j   sin ( 2πm ) = 1 − j ( 0 ) = 1 Thus,

(

+∞

) ∑h (m) e

H e j(θ+ 2 π ) =

− jθm

( )

= H e jθ

m=−∞

This property is important since in one period we can learn all about the signal that is being transformed.

138

Discrete Signals and Systems with MATLAB®

3.5.1.2 Symmetry Property To study this property, we will consider H(ejθ) for real values. We have +∞

( )

H e jθ =

∑h (m) e

− jθm

m=−∞

and

(

+∞

)

H e − jθ =

∑h (m) e

jθm

m=−∞

The magnitude of e−jθm is the same as the magnitude of ejθn; thus,

( )

(

H e jθ = H e − jθ

)

This indicates that the magnitude of H(ejθ) has even symmetry. Also the phase of e−jθm is −θm and that of ejθm is θm. Therefore, the phase of H(ejθ) is the negative of the phase of H(e−jθ). This indicates that the phase of H(ejθ) has odd symmetry. In general, from the frequency response for a given discrete system, you can tell if the system is able to pass a certain frequency range or reject another. Example 3.6 Let

( )

H e jθ = 1− e − jθ With respect to passing or rejecting frequencies, what kind of system is this? SOLUTION H(e ) = 1 − e is jθ

−jθ

= 1 − (cos θ − j sin θ) = 1 − cos θ + j sin θ. The magnitude response

( )

H e jθ =

(sin θ) + (1− cosθ) 2

2

The plot of the magnitude of H(ejθ) versus θ is shown in Figure 3.5. Notice that the system attenuates low-frequency signals, but at frequencies approximately between π/2 and π this system does not attenuate as it does at frequencies near zero. Hence, this system passes high frequencies and prevents low frequencies from passing.

139

Fourier Transform of Discrete Signals

FIGURE 3.5

Magnitude plot for Example 3.6.

Example 3.7 Consider the following system with the frequency response function:

( )

H e jθ =

1 2 − 0.1e − jθ

What frequencies does this system pass and what frequencies does it not?

SOLUTION The magnitude of the frequency response is

( )

H e jθ =

1 1 = = 2 − .1e − jθ 2 − .1cosθ + .1j  sinθ

1

( 2 − .1cosθ) + (.1sinθ) 2

2

The plot of |H(ejθ)| is shown in Figure 3.6. It is clear from the plot that this system passes low frequencies and rejects high frequencies.

FIGURE 3.6

Magnitude plot for Example 3.7.

140

3.6

Discrete Signals and Systems with MATLAB®

FOURIER TRANSFORM OF DISCRETE SIGNALS

The Fourier transform of a discrete signal x(n) is X(θ), where θ = wTs, w is the ana­ logue frequency of the continuous signal and Ts is the sampling period. The Fourier transform of discrete signals is defined as X (θ) =

+∞

∑x ( n ) e

− jθn

(3.19)

n=−∞

and to find x(n) given X(θ), we use the following relation:  

x (n) =

1 X ( θ ) e jθn dθ 2π



(3.20)



Note that X(θ) is a function of the continuous variable θ, the digital frequency, while x(n) is a function of the discrete variable n. We have seen that the frequency response function H(ejθ) was needed to calculate the steady-state response for a given discrete system. It also contains information about the system itself. The Fourier transform of discrete signals can be applied to signals that are periodic and not periodic. It will make the solution to difference equations much easier as we will see later. Example 3.8 What is the Fourier transform of x ( n) = (.5) u ( n) n

SOLUTION The Fourier transform of x(n) is X(θ) and it is X (θ) =



∑ x ( n) e

n=−∞



− jθn

=

∑ (.5) e n

n=0



− jθn

=

∑ (.5e )

− jθ n

n=0

1 ⎡ ⎤ =⎢ − jθ ⎣ 1− .5e ⎥⎦

where we used the following geometric series sum: ∞

∑a n=0

n

=

1 1a < 1− a

So x(n) ↔ X(θ) or we write the pairs (.5)nu(n) ↔ 1/(1 − .5e −jθ).

Example 3.9 What is the Fourier transform of the impulse signal Aδ(n)?

(3.21)

141

Fourier Transform of Discrete Signals SOLUTION For x(n) = Aδ(n), we have X (θ) =



∑Aδ (n) e

− jθn

= Aδ ( 0 ) e − jθ(0) = A

−∞

Note that δ(n) is valid only at n = 0. Therefore, x ( n) = Aδ ( n) ↔ X ( θ ) = A

3.7 CONVERGENCE CONDITIONS The Fourier transform of x(n) is given again as +∞

∑x ( n ) e

X (θ) =

− jθn

n =−∞

where X(θ) is an infinite series and that series must converge for X(θ) to exist. For X(θ) to exist, it is necessary that x(n) be summable. This means that +∞

∑ x (n) < ∞

n =−∞

However, some signals such as the step signal are not summable. We will see how to deal with such signals later in this chapter.

3.8 PROPERTIES OF THE FOURIER TRANSFORM OF DISCRETE SIGNALS Table 3.2 lists some properties of the Fourier transform of discrete signals. We will prove some of them here.

3.8.1

perioDicity property

The Fourier transform of the discrete signal x(n) is X (θ) =

+∞

∑x ( n ) e

− jθn

n =−∞

Let θ = θ + 2π. Then, X ( θ + 2π ) =

+∞

∑x ( n ) e

n=−∞

− jθn − j 2 πn

e

142

Discrete Signals and Systems with MATLAB®

But e−j2nπ = cos(2πn) − j sin(2πn) = 1 − 0 = 1. Thus, X ( θ + 2π ) =

+∞

∑x ( n ) e

− jθn

= X (θ)

n=−∞

and X(θ) is periodic in θ with the period of 2π.

3.8.2 lineArity property The Fourier transform of x(n) = a1x1(n) + a2x2(n) is X (θ) =

n=∞

∑ [ a x ( n ) = a x ( n )] e 1 1

2 2

− jθn

n =−∞

X (θ) =





a1 x1 ( n ) e − jθn +

n =−∞



∑a x ( n ) e 2 2

− jθn

n =−∞

which clearly results in X ( θ ) = a1 X1 ( θ ) + a2 X 2 ( θ )

3.8.3 DiScrete-tiMe-Shifting property If x(n) is shifted by n0, then the Fourier transform of x(n − n0) is +∞

∑x ( n − n ) e 0

− jθn

n=−∞

If we let n − n0 = m, then the Fourier transform of x(n − n0) becomes +∞





x ( m ) e − jθ( m+n0 ) = e − jθn0

∑ x (m) e

− jθm

= e − jθn0 X ( θ )

m =−∞

m =−∞

The Fourier pairs are then x ( n − n0 ) ↔ e − jθn0 X ( θ )

3.8.4 frequency-Shifting property The Fourier transform of x(n)ejθ0 n, where θ0 is the frequency shift is +∞

∑ ⎣⎡e

n=−∞

jθ0 n

x (n) e

+∞

− jθn

⎦⎤ =

∑x ( n ) e

n=−∞

− j( θ −θ0 )n

= X ( θ − θ0 )

143

Fourier Transform of Discrete Signals

Therefore, e jθ0 n x ( n ) ↔ X ( θ − θ0 )

3.8.5 reflection property Consider the reflected signal x(−n) of x(n). Its Fourier transform is +∞

∑ x (− n)e

− jθn

n=−∞

Let −n = m. Then the transform becomes +∞



+∞

x (m)e jθm =

m=−∞

∑ x(m)e

− jm( −θ)

= X ( −θ )

m=−∞

Thus, x ( − n ) ↔ X ( −θ )

3.8.6 convolution property In real time, with an input x(n) and a system transfer function h(n), the output of the system is then y(n) and is given by y (n) = x (n) * h (n) =

+∞

∑ x (m)h ( n − m )

(3.22)

m=−∞

Sometimes this summation becomes very complex to evaluate. Now let us take the Fourier transform on both sides to get ⎤ ⎡ ∞ x ( m ) h ( n − m )⎥ Y ( θ ) = f [ x ( n ) * h ( n )] = f ⎢ ⎢⎣ m =−∞ ⎥⎦



where f indicates “the Fourier transform of.” But according to the defining equation of the Fourier transform, we have ⎡ ∞ ⎤ +∞ ⎡ ∞ ⎤ x ( m ) h ( n − m )⎥ = x ( m ) h(n − m)⎥ e − jθn f⎢ ⎢ ⎥⎦ ⎣⎢ m=−∞ ⎦⎥ n=−∞ ⎢⎣ m =−∞



∑∑ +∞

=

+∞

∑ x(m) ∑h(n − m)e

m=−∞

− jθn

n=−∞

where the last term is obtained using the interchange of summation property.

144

Discrete Signals and Systems with MATLAB®

Now let k = n − m to get +∞

Y (θ) =



m=−∞

x (m)





h ( k ) e − jθ( k + m ) =

+∞



x ( m ) e − jθm

m =−∞

k =−∞

+∞

∑h ( k ) e

− jθk

k =−∞

Finally, the important relation results in the equation for the convolution in the fre­ quency domain. Y (θ) = X (θ) H (θ)

(3.23)

This result means that convolution in real time is multiplication in the frequency domain, an easy-to-manipulate complex algebra. This result can be written as x1 ( n ) * x 2 ( n ) ↔ X1 ( θ ) X 2 ( θ )

(3.24)

Example 3.10 Consider the discrete system with h(n) = δ(n) + δ(n − 1) and an input x(n) = (.5)n u(n). Find the output y(n) using the Fourier transform method. SOLUTION The transform of h(n) using Table 3.1 and the linearity and the shifting properties in Table 3.2 is H ( θ ) = 1+ e − jθ and the Fourier transform of x(n) is X (θ) =

1 1− .5e − jθ

The output using the Fourier transform is then 1 1 e − jθ ⎡ ⎤ = + Y ( θ ) = X ( θ ) H ( θ ) = ⎣⎡1+ e − jθ ⎦⎤ ⎢ − jθ ⎥ − jθ 1− .5e − jθ ⎣ 1− .5e ⎦ 1− .5e We can bring the previous equation into the discrete domain. The first term is (.5)n u(n). We can use the shifting property in Table 3.2 for the second term and get (.5)n−1u(n − 1). The output in the discrete domain is y ( n) = (.5) u ( n) + (.5) u

n−1

u ( n − 1) n ≥ 0

145

Fourier Transform of Discrete Signals

TABLE 3.1 Fourier Transform Pairs x(n)

x(θ) A

Aδ(n)

∞ ⎡ 1 ⎤ + πδ ( θ − 2πn ) ⎥ A⎢ − jθ 1− e ⎥⎦ n= −∞ ⎣⎢



Au(n)

+∞

Α

2πA

∑δ (θ − 2πn)

n= −∞

1 1 − ae − jθ

anu(n) |a| < 1 nanu(n) |a| < 1

(e

ae jθ −a

)

∑δ (θ − θ

0



+∞

ejθ0n



2

− 2πn )

n= −∞ +∞

π

cos(θ0n)

∑ ⎡δ⎣ (θ − θ

n= −∞

0

− 2πn ) + δ ( θ + θ0 − 2πn ) ⎤⎦

+∞



π δ ( θ − θ0 − 2πn ) − δ ( θ + θ0 − 2πn ) j n= −∞

sin(θ0n)

TABLE 3.2 Fourier Transform Properties Real Time a1x1(n) + a2x2(n)

Fourier Domain a1X1(θ) + a2X2(θ)

x(n − n0)

e − jθ0 n X ( θ )

e jθ0 n x ( n )

X(θ − θ0)

nx(n)

j

Χ1(θ)Χ2(θ)

x1(n)*x2(n) x1(n)x2(n)

1 2π

+∞

∫ X (m ) X (θ − m ) dm 1

∑ x (n)

n= −∞

2

−∞

Χ(−θ)

x(−n) ∞

d ⎡X ( θ ) ⎤⎦ dθ ⎣

2

1 2π

π

∫ X (θ)

−π

2



146

Discrete Signals and Systems with MATLAB®

Example 3.11 Let us pass the input x(n) = (.5)uu(n) through two systems with

h1 ( n) = h2 ( n) = δ ( n) + δ ( n − 1) Find y(n) using the Fourier transform method. SOLUTION As in Example 3.10,

X (θ) =

1

1− .5 e − jθ

and

H1 ( θ ) = H2 ( θ ) = 1+ e − jθ

If we call the output of the first system y1(n), then

1 1 e − j θ ⎡ ⎤⎡ 1+ e − jθ ⎤⎦ = Y1 ( θ ) = X ( θ ) H1 ( θ ) = ⎢ + − jθ ⎥ ⎣ − jθ 1− .5e 1− .5e − jθ ⎣ 1− .5e ⎦ The output of the second system will have the output of the first system as its input. Therefore, the output of the second system y(n) is ⎡ 1 e − jθ ⎤ ⎡1+ e − jθ ⎤⎦ + Y ( θ ) = Y1 ( θ ) H2 ( θ ) = ⎢ − jθ 1− .5e − jθ ⎥⎦ ⎣ ⎣ 1− 0.5e =

e − jθ e −2 jθ 1 e − jθ + + + − jθ − jθ − jθ 1− 0.5e 1− 0.5e 1− .5e 1− .5e − jθ

By using Tables 3.1 and 3.2, we get

y ( n) = (.5) u ( n) + 2 (.5) n

n−1

u ( n − 1) + (.5)

n− 2

u ( n − 2 ) n ≥ 0

3.9 PARSEVAL’S RELATION AND ENERGY CALCULATIONS We have seen in Chapter 1 that the total energy in the signal x(n) is +∞

E=

∑ x (n)

2

n=−∞

The Parseval’s relation for discrete signals says that this energy can be computed using the Fourier transform as +∞

E=



n =−∞

x (n) = 2

1 2π

π

∫ X (θ)

−π

2



147

Fourier Transform of Discrete Signals

Example 3.12 Find the energy in the signal. x ( n) = δ ( n) + δ ( n − 1) SOLUTION We have seen that +∞

E=

∑ x ( n)

2

= (1) + (1) = 2 2

2

n=−∞

We can use the Parseval’s theorem to find the energy as

E=

E=

1 2π 1 2π

π

∫ (1+ e ) − jθ

2



−π π

∫ (1+ cosθ − jsinθ)

2

dθ =

−π

1 2π

π

∫ ((1+ cosθ)

2

)

+ sin2θ dθ

−π

If we simplify, we arrive at π

E =

1 1 1dθ + 2π 2π



−π

E=

π



−π

π

2cosθ  dθ +

π

1 1 sin2θ  dθ cos 2θ  dθ + 2π 2π



−π



−π

1 2 1 ( π + π ) + ⎡sin ( π ) − sin ( −π ) ⎤⎦ + ( π + π ) = 1+ 0 + 1 = 2 2π 2π ⎣ 2π

3.10 NUMERICAL EVALUATION OF THE FOURIER TRANSFORM OF DISCRETE SIGNALS We should keep in mind that the Fourier transform of x(n) is X(θ), which is a complex function in θ. MATLAB® can be used to calculate the complex values for X at each θ value. The magnitude of X, the phase of X, the real part of X, and the imaginary part of X can be calculated and plotted. We also know that X(θ) is periodic of period 2π. Since X(θ) is symmetric when x(n) is real, we can plot |X(θ)| in the interval [0, π] and know all about x(n) in that range. Example 3.13 Find the Fourier transform of x(n) = (.1)n for n ≥ 0. Plot the magnitude and the phase of X(θ), the Fourier transform of x(n).

148

Discrete Signals and Systems with MATLAB®

FIGURE 3.7

Frequency response for Example 3.13. SOLUTION

The Fourier transform is given by X (θ) =

+∞



x ( m) e − jθm =

m=−∞





∑ (.1)m e− jθm = ∑ (0.1e− jθ ) m=0

m

m=0

=

1 1− 0.1e − jθ

To use MATLAB to plot |X(θ)| and the phase of X(θ) versus θ we need to put X(θ) in the form X (θ) =

a0 + a1e − jθ + a2e −2 jθ + a3e −3 jθ +  1+ b1e − jθ + b2e −2 jθ + b3e −3 jθ + 

(3.25)

We then can use the MATLAB function X = freqz (n, d, df) The function freqz receives the numerator vector n, the denominator vector d, and the digital frequency vector, and sends back the complex values of X(θ) in the vector X. Then we can use the MATLAB functions abs and angle to find the magnitude and the angle of the frequency response. In our example, X (θ) =

1 1− .1e − jθ

where n = [1]; d = [1 − .1]. We will use 401 frequency points in the range from 0 to π radians. The MATLAB script Example 313 will be used. The plots are shown in Figure 3.7.

Example 3.14 Find the Fourier transform of x(n) = δ(n) + δ(n − 1) + δ(n − 2) + δ(n − 3). Plot the magnitude and the phase of X(θ).

149

Fourier Transform of Discrete Signals SOLUTION

Since x(n) is finite and defined only at the n = 0, 1, 2, and 3, we can still use the MATLAB function freqz and we can use the Example3141 script to plot the mag­ nitude and phase of X(θ) at 401 frequency points. The plots are shown in Figure 3.8. However, we can take a different approach and implement the defining equa­ tion for X(θ) directly. We have +∞

X (θ) =

∑ x ( m) e

− jθm

m=−∞

Assume that x(n) is valid for n1 ≤ n ≤ n2 and we want to calculate X(θ) at p + 1 points. We are also interested in the frequency range from 0 to π. In this case, the frequency spacing is taken as ⎛ π⎞ df = ⎜ ⎟ m ⎝ p⎠

for m = 0, 1, 2,, p

The frequency response becomes X ( m) =

N

∑e

− j ( π / p ) mnr

x ( nr )

for m = 0, 1, , p

(3.26)

r =1

where N is the number of samples for x(n). Note that if x(nr) is a column vector having N rows and 1 column, and X(m) is also a column vector having (p + 1) rows and 1 column, then the summation N

∑e

− j ( π / p ) mnr

r =1

FIGURE 3.8 Frequency response for Example 3.14 using freqz MATLAB function.

150

Discrete Signals and Systems with MATLAB®

FIGURE 3.9 Frequency response for Example 3.14 using Equation (3.19) directly. should be a matrix of p + 1 rows and N columns. This requires the vector m to be a column vector with p + 1 rows and 1 column and the nr vector to be a row vec­ tor with 1 row and N columns. In MATLAB, if we enter data as row vectors then Equation (3.26) can be written as − j π/ p m n X = e ( ) ′   x′

(3.27)

where ′ indicates transpose of a matrix or a vector in MATLAB. To implement this method for the example at hand, we will write the script Example3142, and the plots are shown in Figure 3.9. Note that this example was straightforward. The method described in the example will be very useful, especially if you are to find the Fourier transform of x(n) = n(.1)n cos(n) for 0 ≤ n ≤ 100 or for 0 ≤ n ≤ 1000 or for a bigger range. We will look at an example of this form in the Section 3.12.

3.11

SOME INSIGHTS: WHY IS THIS FOURIER TRANSFORM?

3.11.1 eASe in AnAlySiS AnD DeSign With the Fourier transform, we are able to identify the frequency contents of the input signal x(n), both the magnitude and the phase spectrum. It may not be possible to predict what frequencies such x(n) contains, especially if they are given as a plot. Knowing the frequency contents of the input signal gives us more insights into the way we analyze and design linear systems. We will know what frequencies will pass and what frequencies will not pass through a particular system. Some convolution sums are very difficult to evaluate in discrete real time. With the help of the Fourier transform, things become much easier.

151

Fourier Transform of Discrete Signals

3.11.2

SinuSoiDAl AnAlySiS

If the system H(θ) is subject to a sinusoidal input signal x ( n ) = Xcos ( θt + ϕ ) the steady-state output, yss(n), of the system can be evaluated as yss ( n ) = x ( n ) H ( θ ) cos ( θn + ϕ + α ) or yss ( n ) = XMcos ( θn + ϕ + α ) where X is the magnitude of the input x(n)

M is the magnitude of the frequency response of the discrete system H(θ)

φ is the phase of H(θ) at a particular given θ

α is the phase of H(θ)

This says that the output of a linear time-invariant system, if subject to a sinusoidal input, will have a steady-state solution equal to the magnitude of the input signal multiplied by the magnitude of the transfer function of the system evaluated at the frequency of the input signal and shifted by the phase angle of the transfer function evaluated at the input frequency as well. Note also that the frequency of the output is the same as the frequency of the input. This means that the system is linear. If the system is not linear, the output frequency will differ from the input frequency.

3.12

END-OF-CHAPTER EXAMPLES

EOCE 3.1 Consider the discrete system given as follows: h ( n) = .1δ ( n) + .2δ ( n − 2) + .5δ ( n − 3) Plot the frequency response, the phase and magnitude of H(θ). SOLUTION The impulse response h(n) is defined only at n = 0, n = 2, and n = 3. With +∞

( ) ∑ h ( m) e

H e jθ =

m=−∞

− jθm

152

Discrete Signals and Systems with MATLAB®

FIGURE 3.10 Frequency response for EOCE 3.1. we have

( )

H e jθ = .1e − jθ(0) + .2e − j 2θ + .5e − j3θ = .1+ .2e −2 jθ + .5e −3 jθ The plot of the phase and magnitude for H(ejθ) can be obtained using MATLAB and we will take the range from 0 to 4π to show that H(ejθ) is periodic in 0 of period 2π. The script is EOCE3_1 The plot is shown in Figure 3.10.

EOCE 3.2 Consider the following difference equation:

y ( n) + .1y ( n − 1) + .2y ( n − 2) = x ( n)



Find the frequency response and plot its magnitude and phase.

SOLUTION With x(n) = ejθn and y(n) = ejθn H(ejθ) we have from the given equation that

( )

( )

e jθnH e jθ + .1e jθ( n −1)H e jθ + .2e jθ( n − 2) = e jθn When we factor out H(ejθ), we will get

( )(

)

H e jθ 1 + .1e − jθ + .2e −2 jθ = 1 and

( )

H e jθ =

1 1+ .1e − jθ + .2e −2 jθ

153

Fourier Transform of Discrete Signals

FIGURE 3.11

Frequency response for EOCE 3.2.

Next we use MATLAB to plot the magnitude and the phase of this frequency response in the range from 0 to 2π radians using EOCE3_2. The plot is shown in Figure 3.11.

EOCE 3.3 Find the frequency response of the system with h ( n) = n (.1) sin ( n) n

for 0 ≤ n ≤ 100

SOLUTION We know that +∞

( ) ∑ h ( m) e

H e jθ =

− jθm

m=−∞

and this is not a difference equation, so we can use the MATLAB function freqz to find the frequency response. It is also not easy to find H(ejθ) analytically. So we use the method we established earlier in the chapter. In this case n1 is 0 and n2 is 100. We will take 400 points, so p is 400. The frequency resolution is taken as df =

π m p

m = 0,1, 2,, p

We will use MATLAB to implement H = e −j(π/p)m,nh′ as we did earlier for the Fourier transform approximation. The MATLAB script used is EOCE3_3. The plots are shown in Figure 3.12.

154

Discrete Signals and Systems with MATLAB®

FIGURE 3.12 Frequency response for EOCE 3.3.

EOCE 3.4 Consider the discrete system described by the impulse response. h ( n) = (.9) u ( n)

n

Find that steady-state response of the system when

⎛π ⎞ ⎛π ⎞ x ( n) = 2cos ⎜ n⎟ + 4sin ⎜ n⎟ ⎝2 ⎠ ⎝2 ⎠ SOLUTION First we need to find H(ejθ), and then we can use the formula

( )

y ss ( n) = H e jθ x ( n) cos ( θn + φ + α ) to find the steady-state response. The frequency response is ∞

( ) ∑ (.9)

H e jθ =

m=0

m



e − jθm =

∑ ((.9) e )

− jθ m

m=0

=

1 1 = − jθ 1− .9e 1− .9cosθ + .9sinθ

The input can be divided into two separate inputs, x1(n) and x2(n), where ⎛π ⎞ x1 ( n) = 2cos ⎜ n⎟ ⎝2 ⎠

and

⎛π ⎞ x2 ( n) = 4 sin ⎜ n⎟ ⎝2 ⎠

155

Fourier Transform of Discrete Signals

Then we can use superposition to find yss(n) = yss1(n) + yss2(n), where yss1(n) is the output due to x1(n) and yss2(n) is the output due to x2(n). For x1(n) = 2cos(π/2n), we have x1 ( n) = 2, θ =

π and 2

ϕ=0

With

( )

H e jθ =

1

(1− .9cos θ)2 + ( .9sin θ)2

and for θ = π/2, the magnitude of the frequency response becomes

(

)

H e jπ / 2 =

1

(1− .9 (0)) + (.9 (1)) 2

2

=

1 = 1+ .81

1 2.81

and the phase is 0 − tan−1(.9/1) = 0.7328. The steady-state solution is then

⎛π ⎛ 1 ⎞ ⎛ .9 ⎞ ⎞ y ss1 ( n) = 2 ⎜ cos ⎜ n + 0 − tan−1 ⎜ ⎟ ⎟ − ∞ ≤ n ≤ +∞ ⎝ 1 ⎠⎠ ⎝ 2.81⎠⎟ ⎝2 For x2(n) = 4 sin(π/2), we need to write both inputs using the same reference. We write this second input as π⎞ ⎛π x2 ( n) = 4 cos ⎜ n − ⎟ ⎝2 2 ⎠

The only difference now is in the phase shift of the input and its magnitude.

x2 ( n) = 4

and

ϕ=−

π 2

The output is then

⎛π ⎛ 1 ⎞ π ⎛ .9 ⎞ ⎞ y ss1 ( n) = 4 ⎜ cos ⎜ n − − tan−1 ⎜ ⎟ ⎟ − ∞ ≤ n ≤ +∞ ⎝ 1 ⎠⎠ ⎝ 2.81⎠⎟ ⎝2 2 Finally,

y ss1 ( n) = y ss1 ( n) + y ss 2 ( n) ⎛ 1 ⎞⎡ π ⎛π ⎞ ⎛π ⎞⎤ =⎜ 2cos ⎜ n + 0 − 0.7328⎟ + 4 cos ⎜ n − − 0.7328⎟ ⎥ ⎝2 ⎠ ⎝2 ⎠⎦ ⎝ 2.81 ⎠⎟ ⎢⎣ 2

156

Discrete Signals and Systems with MATLAB®

FIGURE 3.13 Error for EOCE 3.5.

EOCE 3.5 The Fourier transform of αx1(n) + βx2(n) is αX1(θ) + βX2(θ). Use MATLAB to show this property. SOLUTION Consider the following two signals: x1 ( n) = 2δ ( n) + 3δ ( n − 1) − 4δ ( n − 3) and

x2 ( n) = 2δ ( n) + 3δ ( n − 3)

Let α= 2 and β = 3. Now consider the MATLAB script EOCE3_5 to obtain the proof. The plot is shown in Figure 3.13.

EOCE 3.6 Use MATLAB to prove the time-shifting property of the Fourier transform of dis­ crete signals. SOLUTION Consider the following signal: x ( n) = δ ( n) + 2δ ( n − 1) + 3δ ( n − 2)

157

Fourier Transform of Discrete Signals

FIGURE 3.14 Error for EOCE 3.6. We know that by shifting x(n) three units, for example, only the index n for x(n) will change. The MATLAB script is EOCE3_6. The plot is shown in Figure 3.14.

EOCE 3.7 Consider the following frequency response:

( )

H e jθ =

1 1− .9e − jθ

1. What is the steady-state output if the input to the system is

x ( n) =

1 ⎛ π ⎞

cos ⎜ n⎟ ⎝4 ⎠ 2

2. Use MATLAB to find the response to this input. SOLUTION 1. The frequency response at the input frequency is

(

)

H e jπ / 4 =

1− .9

(

1

) (

2 / 2 + .9

)

2/ 2 j

158

Discrete Signals and Systems with MATLAB® and the magnitude at the input frequency is

(

)

H e jπ / 4 =

(

1− .9

1

)) ( (

(

2/2

2

+ .9

))

2/ 2

2

= 1.36

The angle is

(

)

⎛ .9 2/ 2 ⎞ ⎟ = −1.05 0 − tan−1 ⎜ ⎜⎝ 1− .9 2/ 2 ⎟⎠

(

)

and the steady-state solution is

⎛ 1⎞ ⎛π ⎞

y ss ( n) = ⎜ ⎟ (1.36) cos ⎜ n + ( −1.05)⎟ ⎝ 2⎠ ⎝4 ⎠ 2. We can use MATLAB and write the script EOCE3_7. The plots are shown in Figure 3.15. You can see that as n increases in the solution using MATLAB for the total response, the outputs in the steadystate solution and the MATLAB total response do match.

FIGURE 3.15

Signals for EOCE 3.7.

159

Fourier Transform of Discrete Signals

FIGURE 3.16 System for EOCE 3.8.

EOCE 3.8 Consider the system shown in Figure 3.16. Let S1 be represented by

y1 ( n) + .1y1 ( n − 1) = x ( n)

and S2 be represented by

y 2 ( n) + .1y 2 ( n − 1) + 2y ( n − 2) = x ( n)



Find the output using MATLAB if

1 ⎛π ⎞

cos ⎜ n − π ⎟ ⎝4 ⎠ 2

x ( n) =

SOLUTION The frequency response of system 1 is obtained as

( )

H1 e jθ =

1 1+ .1e − jθ

and the frequency response of system 2 is obtained as

( )

H2 e jθ =

1 1+ .1e − jθ + 2e − j 2θ

Systems 1 and 2 are connected in parallel and y(n) can be calculated as the output of the whole system. Thus,

( )

− jθ

− j 2θ

− jθ

+ 2e + 1+ .1e ( ) (11++ .1e .1e )(1+ .1e + 2e )

H1 e jθ + H2 e jθ =

=

− jθ

− jθ

− j 2θ

2 + .2e − jθ + 2e − j 2θ 1+ .2e − jθ + 2.01e − j 2θ + .2e − j3θ

The MATLAB script used to find the output is EOCE3_8

The plot is shown in Figure 3.17.

160

Discrete Signals and Systems with MATLAB®

FIGURE 3.17 Signals for EOCE 3.8.

EOCE 3.9 Consider the system in Figure 3.18. System S1 is represented by y1 ( n) + y1 ( n − 1) = x ( n) and S2 is represented by

y 2 ( n) − y 2 ( n − 1) = y1 ( n)



Find the steady-state response y(n) if x(n) is ⎛ π⎞ x ( n) = .5cos ⎜ n ⎟ ⎝ 4⎠ Find also the response to this input using MATLAB. Note that using MATLAB you will get the total response. The steady-state response is obtained by observing the MATLAB output for large n.

FIGURE 3.18 System for EOCE 3.9.

161

Fourier Transform of Discrete Signals SOLUTION

Since S1 and S2 are connected in series, the steady-state yss(n) can be thought of as the output to the system H1(ejθ) H2(ejθ) with the input x(n).

( )

H1 e jθ =

1 1+ e − jθ

and

( )

H2 e jθ =

1 1− e − jθ

The whole system is now

( )

( ) ( )

H e jθ = H1 e jθ H2 e jθ =

1 1 1 1 = = −2 jθ − jθ − jθ 1+ e 1− e 1− e 1− cos 2θ + j sin 2θ

The frequency response at the input frequency is given by

(

)

H e jπ / 4 =

1 1 = 1− cos ( 2π / 4 ) + j sin ( 2π / 4 ) 1+ j

The magnitude of the frequency response is 1/ 2  and its phase is (0 − tan−1(1/1)) = −π/4. Thus, the steady-state response for the whole system is 1 ⎛ π π⎞ ⎛π ⎞ ⎛ 1⎞ ⎛ 1 ⎞ cos ⎜ n − ⎟ = cos ⎜ ( n − 1)⎟ y ss ( n) = ⎜ ⎟ ⎜ ⎠ ⎝ 2 ⎠ ⎝ 2 ⎟⎠ ⎝ 4 4⎠ 2 2 ⎝4 We see that the output is the input reduced in magnitude by 1/ 2 and shifted by −π/4. We can use MATLAB to plot yss(n) and the response to the given input. We write the script EOCE3_9. The plots are shown in Figure 3.19.

FIGURE 3.19

Plots for EOCE 3.9.

162

Discrete Signals and Systems with MATLAB®

EOCE 3.10 Two systems h1(n) and h2(n) are connected in series with an input x(n) = δ(n). Find the output y(n) for n ≥ 0 if h1(n) = (1/2)nu(n) and = h2(n) = (1/4)nu(n). SOLUTION In real time y(n) = (h1(n) *h2(n)) * x(n). But we can use the Fourier transform to write Y ( θ ) = X ( θ ) H1 ( θ ) H2 ( θ ) With X(θ) = 1, the first system is H1 ( θ ) =

1 1− .5e − jθ

and the second system is H2 ( θ ) =

1 1− (1/4 ) e − jθ

The output then is given as ⎞ 1 1 ⎛ ⎞⎛ Y ( θ ) = (1) ⎜ ⎝ 1− .5e − jθ ⎠⎟ ⎜⎝ 1− (1/4 ) e − jθ ⎟⎠ =

2 1 − 1− (1/ 2) e − jθ 1− (1/4 ) e − jθ

Using Table 3.1 we get n

⎛ 1⎞ ⎛ 1⎞ y ( n) = 2 ⎜ ⎟ − ⎜ ⎟ ⎝ 2⎠ ⎝ 4⎠

n

n≥0

with H (θ) =

1 1− ( 3/4 ) e − jθ + (1/8) e − j 2θ

Let us plot y(n) analytically and using MATLAB script EOCE3_10.

The plots are shown in Figure 3.20.

Fourier Transform of Discrete Signals

FIGURE 3.20 Plots for EOCE 3.10.

3.13

END-OF-CHAPTER PROBLEMS

EOCP 3.1 Perform the following calculations and give the result in the form a + jb: 1.

1− j −1 j

2.

1 − je − jπ / 2 1 + j

3.

1 1

− +j j j −1

4.

e π − e − jπ +1 j

5. e jπ / 2 +

e jπ − 1 1− j

163

164

Discrete Signals and Systems with MATLAB®

EOCP 3.2 Put the complex numbers in EOCP 3.1 in the polar form. EOCP 3.3 Find the frequency response for each of the following systems: 1. 2. 3. 4. 5. 6. 7. 8.

h(n) = δ(n) + δ(n − 1) h(n) = δ(−n + 2) + δ(−n + 1) + δ(n) + δ(n − 1) + δ(n − 2) h(n) = a(b)nu(n) h(n) = a(b)nu(n) − a(b)n−1u(n − 1) h(n) = u(n − 4) h(n) = a(b)nu(n) − a(b)n−4u(n − 4) h(n) = (a)n cos(nπ)u(n) h(n) = (a)n cos(nπ)u(n) − (a)n−1 cos(nπ − π)u(n − 1)

EOCP 3.4 For a = .5, and b = .4, use MATLAB to plot the magnitude and phase of the fre­ quency responses found in EOCP 3.3. EOCP 3.5 Use MATLAB to find the steady-state response of each system in EOCP 3.3 to the following inputs: π 1. x ( n ) = cos ⎛ n ⎞ u ( n ) ⎝2 ⎠ π π 2. x ( n ) = cos ⎛ n ⎞ u ( n ) − cos ⎛ ( n − 1)⎞ u ( n − 1) ⎝2 ⎠ ⎝2 ⎠ EOCP 3.6 Find the frequency response for each of the following systems: 1. 2. 3. 4. 5. 6. 7.

y(n) + ay(n − 1) = x(n) y(n) + ay(n − 1) = x(n) + x(n − 1) y(n) + ay(n − 1) + by(n − 2) = x(n) y(n) + ay(n − 2) = x(n) y(n) + ay(n − 3) = x(n) + x(n − 3) y(n) − ay(n − 2) = x(n − 3) y(n) − ay(n − 3) − by(n − 4) = x(n)

Fourier Transform of Discrete Signals

165

8. y(n) − ay(n − 6) = x(n − 3) 9. y(n) + ay(n − 1) = x(n) + x(n − 1) + x(n − 3) 10. y(n) = x(n) + x(n − 1) + x(n − 3) + x(n − 4) EOCP 3.7 Use MATLAB to plot the magnitude and phase of the systems in EOCP 3.6 for a = 1 and b = 5. EOCP 3.8 Use MATLAB to find the steady-state responses for the system in EOCP 3.6 with a and b as given in EOCE 3.7 if 1. x(n) = 10 2π ⎞ n u (n) 2. x ( n ) = sin ⎜⎛ ⎝ 3 ⎠⎟ EOCP 3.9 Find the Fourier transform of the following signals: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

3δ(n) + 3δ(n − 1) (.5)nu(n) + ejn (.5)nu(n − 1)+ej(n−1) (.5)nu(n) − (.5)n−1u(n − 1) (n − 1)(.5)n−1u(n − 1) 3δ(n) * 3δ(n − 1) (.5)n−1u(n − 1) * ej(n − 1)u(n − 1) (.5)nu(n)*3δ(n) * 3δ(n − 1) (.5)n−1u(n − 1) * δ(n) * δ(n) (.5)nu(n) + 3δ(n) * 3δ(n − 1)

EOCP 3.10 Use the Fourier transform to find the output y(n) when the input is x(n) = (.5)nu(n) for the following systems: 1. 2. 3. 4. 5.

h(n) = δ(n) + δ(n − 1) h(n) = δ(n − 1) + δ(n − 2) h(n) = (.5)nu(n) h(n) = (.5)nu(n) − (.5)n−1u(n − 1) h(n) = (.3)n−5u(n − 5) + δ(n)

166

Discrete Signals and Systems with MATLAB®

EOCP 3.11 Consider the following systems shown in Figures 3.21–3.25. Find y(n) if x(n) = (. 5)nu(n). Use the Fourier transform method. We are given that h1 (n)  =   δ(n)  +   δ(n − 1) h2 (n)  =  (.5) u(n) n

h3 (n)  =  (.3)

n−5

FIGURE 3.21 Signal for EOCP 3.11.

FIGURE 3.22 Signal for EOCP 3.11.

FIGURE 3.23 Signal for EOCP 3.11.

FIGURE 3.24 Signal for EOCP 3.11.

(u n − 5)  +   δ(n)  =   h(n)

Fourier Transform of Discrete Signals

167

FIGURE 3.25 Signal for EOCP 3.11.

FIGURE 3.26 Signal for EOCP 3.12.

EOCP 3.12 Consider the signal shown in Figure 3.26. Find the Fourier transform of this signal. EOCP 3.13 Consider the following system: y ( n ) = x ( n ) − x ( n − 1) 1. Find the steady-state output if x(n) = A cos(nθ). 2. Find the steady-state response when x ( n ) = x1 ( n ) + x 2 ( n )

168

Discrete Signals and Systems with MATLAB®

where x1 ( n ) = B cos ( nθ ) and

x 2 ( n ) = C cos (100 nθ )

3. What do you think that this system is doing? EOCP 3.14 Consider the following system: y ( n ) − y ( n − 1) =

x ( n ) + x ( n + 1) 2

1. Find the frequency response of this system. 2. Find the steady-state response when nπ ⎞ ⎛ x ( n ) = ⎜ A cos ⎜⎛ ⎞⎟ u ( n )⎟ ⎝ 3 ⎠ ⎝ ⎠ 3. What do you say about this system? EOCP 3.15 Consider the following systems:

( )

H e jθ = 10 + 2e − jθ + 3e −3 jθ and

( )

H e jθ =

1 1 + .5e − jθ − 5e − j2θ

1. Find the difference equation that describes the two systems. 2. What is h(n), the impulse response for both? 3. Use MATLAB to find the steady-state response if nπ x ( n ) = 10 cos ⎜⎛ ⎟⎞ u ( n ) ⎝ 3 ⎠ 4. Are both systems stable? 5. Use MATLAB to plot the magnitude response of each system. 6. What kind of system is each?

Fourier Transform of Discrete Signals

EOCP 3.16 Consider the following discrete signals with Ts = 0.1 s: 4 1. x ( n ) = sin ⎜⎛ πn ⎟⎞ ⎝3 ⎠ 8 ⎞ 2. x ( n ) = sin ⎛⎜ πn ⎟ ⎝3 ⎠ 3. x(n) = {1 1 1} a periodic signal with N = 3. a. Find the period for the first two signals. b. Find the Fourier series coefficients. c. Where are these frequency components located?

169

4

z-Transform and Discrete Systems

4.1 INTRODUCTION The z-transform is a frequency domain representation that makes solution, design, and analysis of discrete linear systems simpler. It also gives some insights about the frequency contents of signals where these insights are hard to see in real-time systems. There are other important uses for the z-transform, but we will concentrate only on the issues described in this introduction.

4.2

BILATERAL z-TRANSFORM

The z-transform of the signal x(n) is given by X (z) =

+∞

∑x(n)z

−n

(4.1)

n=−∞

where z is the complex variable. If we try to expand Equation (4.1), we get X ( z ) =  + x ( −2 ) z 2 + x(−1)  z1 + x (0) z 0 + x(1) z −1 + x(2) z −2 + 

(4.2)

You can see that in Equation (4.1), the power of z indicates the position of the samples in the signal x(n). This notice is very important. Consider that x ( n ) = x(0)δ(n) where this signal has the strength x(0) and is located only at n = 0. The z-transform of x(n), X(z), is then X (z) =

+∞



n=−∞

x ( n ) z −n =

+∞

∑x ( 0 )δ ( n ) z

−n

= x ( 0 ) z 0 = x(0)

n=−∞

Similarly, if x ( n ) = x ( −1) δ ( n + 1) + x ( 0 ) δ ( n ) + x (1) δ(n − 1) then we can see that this signal has values only at n = −1, n = 0, and n = 1. 171

172

Discrete Signals and Systems with MATLAB®

Thus, X ( z ) = x ( −1) z1 + x ( 0 ) z 0 + x (1) z −1 = x ( −1) z1 + x ( 0 ) + x (1) z −1 In general, if x ( n ) = x( p)δ(n − n0 ) is a signal that is available only at n = n0, then X(z) is X ( z ) = x( p)( z )−n0

Example 4.1 Consider the signal in Figure 4.1. What is the z-transform of x(n)? SOLUTION x(n) can be written as x ( n) = 2δ ( n + 2) − 1δ ( n + 1) + 2δ ( n) − 1δ ( n − 1) + 2δ(n − 2)

and its z-transform is given by Equation (4.1) as

X ( z) =

+∞

∑( x(n))z

n=−∞

FIGURE 4.1 Signal for Example 4.1.

−n

173

z-Transform and Discrete Systems Substituting in the previous equation, we get X ( z ) = 2z 2 − 1z1 + 2z 0 − z −1 + 2z −2 = 2z −2 − z1 + 2 − z −1 + 2z −2

Notice that z−2 represents a delay of 2Ts units of time and z3 represents an advance of 3Ts units of time, where Ts is the sampling interval for the signal x(n).

4.3

UNILATERAL z-TRANSFORM

The unilateral z-transform is the transform of the signal x(n) for n ≥ n0. We will take n0 = 0 in this discussion. We will use the notation x(n) ↔ X( z ) to indicate that we can get X(z) from x(n) and we can get x(n) from X(z) as well. Example 4.2 Find the z-transform of x(n) = Aδ(n). SOLUTION Using the definition of the z-transform, we write X ( z) =

+∞



x ( n) z −n =

+∞

∑Aδ(n)z

−n

n=0

n=0

But δ(n) is defined only at n = 0. So X(z) = Az−0 = A and we write

Aδ(n) ↔ A

Similarly, we have Aδ(n − n0 ) ↔ Az −n0

Example 4.3 Find the z-transform of x(n) = Au(n), the unit step discrete signal. SOLUTION With Equation (4.1), we have X ( z) =

+∞

∑ x(n)z

n=−∞

−n

174

Discrete Signals and Systems with MATLAB®

Since u(n) starts at n = 0 and is available only for n ≥ 0, X(z) becomes X ( z) =







∑(z )

−1 n

Az −n = A

n=0

=

n=0

A 1− z −1

where the last result is a direct application of the geometric series sum. Thus, we write Au(n) ↔

A 1− z −1

and similarly, Au(n − n0 ) ↔

Az −n0 1− z −1

Example 4.4 Find the z-transform of the signal x(n) = Aan for n ≥ 0. SOLUTION Using the defining equation of the z-transform, we write using the unilateral case X ( z) =

+∞



x ( n) z −n =

n=0

+∞





∑(az

Aan z −n = A

n=0

−1 n

) =

n=0

A 1− az −1

Therefore, we write Aanu(n) ↔

A 1− az −1

and Aan − pu(n − p) ↔

Az − p 1− az −1

Example 4.5 Find the z-transform of the complex exponential discrete signal x ( n) = Aane jθnu(n) SOLUTION Using the defining equation again, we write X ( z) =

+∞

∑ n=0

+∞

∑ ( ae z )

Aane jθnu ( n) z −n = A

n=0

jθ −1 n

=

A 1− ae jθ z −1

175

z-Transform and Discrete Systems Using the notation we established, we write Aane jθnu ( n) ↔

A 1− ae jθ z −1

Example 4.6 Find the z-transform of the signal

x ( n) = Aancos(θn)u(n ) SOLUTION Using the defining equation, we get X ( z) =

+∞

+∞

∑x (n) z = ∑Aa cos (θn) u (n) z −1

n

n=0

−n

=

n=0

A 2



∑a (e n

jθn

+ e − jθn )z −n

n=0

By rearranging terms and using the geometric series sum, we arrive at X ( z) =

A 2



∑ (ae

)

jθ −n 2

z

n=0

+

A 2



∑ (ae

)

− jθ − n n

z

=

n=0

A⎡ 1 1 ⎤ + jθ −1 ⎢ 2 ⎣ 1− ae z 1− ae − jθ z −1 ⎥⎦

After simplification, we get

Aancos(θn)u(n) ↔

A(1− az −1cosθ ) 1− az −1 e jθ + e − jθ + a2z −2

(

)

4.4 CONVERGENCE CONSIDERATIONS The z-transform of x(n) is given by X (z) =

+∞

∑x(n)z

−n

n=0

where z is a complex number. This complex number can be written in polar form as z = r e jθ With z in polar form, X(z) becomes

(

X re

+∞



) = ∑x ( n )(re ) n=0

jθ − n

+∞

=

∑x(n)r

−n − jθn

e

(4.3)

n=0

So we can see that the z-transform of x(n) is the Fourier transform of x(n)r −n. If r = 1 then z = ejθ and |z| = |ejθ| = 1, which is a circle of unity magnitude radius.

176

Discrete Signals and Systems with MATLAB®

In Equation (4.3), and if we consider the unilateral case, the series must con­ verge for the z-transform to exist. This will happen if x(n)r −n is absolutely summable. Mathematically, we require +∞

∑ x(n)r

−n

1, which is the region exterior to the unit circle in the z-plane.

Example 4.8 What is the ROC of the z-transform of x(n) = Aanu(n)? SOLUTION We have seen that Aauu(n) ↔

A Az = 1− az −1 z − a



The ROC is then |z| > |a|.

Example 4.9 What is the ROC of the z-transform of x(n) = Aanejθnu(n)? SOLUTION We have seen that Aane jθnu(n) ↔ for which the ROC is |z|>|aejθ| = |a|.

A Az = jθ −1 1− ae z z − ae jθ

177

z-Transform and Discrete Systems

Example 4.10 What is the ROC of the z-transform of x(n) = Aancos(θn)u(n)? SOLUTION We have seen that

Aan cos ( θn) a ( n) ↔

A⎡ 1 1 z z ⎤ A⎡ ⎤

= + + 2 ⎢⎣ 1− ae jθ z −1 1− ae − jθ z −1 ⎥⎦ 2 ⎢⎣ z − ae jθ z − ae − jθ ⎥⎦

The ROC for both terms is |z| > |a| since |e −jθ| = |ejθ| = 1.

Example 4.11 Find the ROC of the z-transform of x(n) = (.5)n u(n) + (.4)n u(n). SOLUTION From the properties of the z-transform (which will be discussed later), we have X ( z ) = X1 ( z ) + X 2( z ) where X1(z) and X2(z) are the z-transforms for (.5)nu(n) and (.4)nu(n), respectively. X ( z) =

z ( z − .4 ) + z( z − .5) 1 1 z z + = + = 1− .5z −1 1− .4 z −1 z − .5 z − .4 (z − .5)( z − .4)

The ROC is given by |z| > .5 and |z| > .4. Thus, we conclude that the ROC is |z| > .5. This is the annular region outside the circle of radius .5 in magnitude.

Example 4.12 Find the ROC of the z-transform of x(n) = (.5)n u(n) + (.9)n u(−n − 1). SOLUTION The first signal, x(n) = (.5) u(n), has the transform n

X1 ( z ) =



∑(.5) z n

−n

=

n−0

1 z = 1− .5z −1 z − .5

with the ROC |z| > .5. The second signal x2(n) = (.9)nu(−n − 1) has the z-transform X2 ( z) =

−1

∑(.9) z n

n=−∞

−n

178

Discrete Signals and Systems with MATLAB®

Let as add 1 and subtract 1 from the right side of this equation so that we make the summation stop at n = 0. We will get X2 ( z) =

n=0

∑(.9) z n

−n

−1

n=−∞

To start the summation from n = 0 to n = ∞, we replace n by −n under the sum­ mation to get X2 ( z) =







(.9)−n z n − 1 =

n=0

∑(.9

−1 1 n

z ) − 1=

n=0

1 1 − 1= − 1− .9−1z 1− .9z −1

For the second signal, we require that |(.9) −1 z1| < 1. This implies an ROC given by |z| < .9. Thus, to find the ROC of X(z), we require that |z| > .5 and |z| < .9. This means that the ROC is 5 < | z| < .9.

4.5

INVERSE z-TRANSFORM

The inverse z-transform can be obtained analytically as x (n) =

1 2πj

∫ X (z)z

n −1

dz

(4.4)

with j = −1 and c is a counterclockwise closed path in the z-plane. To avoid integration in the z-plane to find x(n) from X(z), we can use other ways to find x(n) given X(z) with the help of Tables 4.1 and 4.2.

4.5.1

Partial Fraction ExPansion

We will assume that our signals x(n) are defined for n > 0. The best way to illustrate the method is to give an example. Example 4.13 Consider the signal in the z-domain X ( z) = What is x(n)?

z (z − 1)( z − 2)

179

z-Transform and Discrete Systems

TABLE 4.1 Selected z-Transform Pairs x(n) Aδ(n) Au(n) nu(n) anu(n) nanu(n) n2u(n) n2anu(n) Asin(θn)u(n) Acos(θn)u(n) ansin(θn)u(n)

X(z) A

ROC Entire z-plane

Az z −1 z ( z − 1)2

|z| > 1 |z| > 1

z z−a az ( z − a) 2

|z| > |a| |z| > |a|

z ( z + 1) (z − 1)3

|z| > 1

az ( z + a) ( z − a)3

|z| > |a|

Az sin θ z 2 − 2z cos θ + 1 z ( z − cos θ) z 2 − 2 z cos θ + 1 az sin θ z 2 − 2az cos θ + a 2

|z| > |a| |z| > 1 |z| > |a|

TABLE 4.2 z-Transform Properties z-Domain A1X1(z) + a2X2(z) z−n0 X(z) n0 ≥ 0

Discrete Time Domain a1x1(n) + a2x2(n) x(n − n0)u(n − n0)

⎛ z⎞ X⎜ ⎟ ⎝ a⎠

an x(n)

−z

n x(n) ⎛ n ⎞

x⎜ ⎟ ⎝ p⎠

X(zp) for positive p

x1(n) * x2(n)

Xl(z) X2(z) lim X ( z )

x(0) x(∞)

dX (z ) dz

z→∞

lim ( z − 1) X ( z ) for known x(∞)

z→∞

180

Discrete Signals and Systems with MATLAB® SOLUTION

X(z) can be written as X ( z) =

B A + z −1 z − 2

where A and B are constants. After determining A and B, we will use the entries in Table 4.1 and the properties in Table 4.2 to find x(n). However, the entry anu(n) ↔

z z−a

requires a z in the numerator. Therefore, we need to divide X(z) by z then do the partial fraction expansion. After we are done, we will again multiply the results by z to get X(z). So we will write X ( z) z 1 A B = = = + z z( z − 1)( z − a) (z − 1)( z − 2) z − 1 z − 2 The constants are determined as A= B=

1 = −1 z − 2 z=1 1 =1 z − 1 z= 2

Therefore, X ( z) −1 1 = + z z −1 z − 2 The z-transform is then X ( z) =

z −z + z −1 z − 2

Now we can use Table 4.1 to get x(n) with the help of entry 1 in Table 4.2. We will get x ( n) = − (1) u ( n) + ( 2) u ( n) = −u ( n) + ( 2) u ( n) n

n

with x(0) = −1+ 1 = 0 x(1) = −1+ 2 = 1 x(2) = −1+ 4 = 3 x(3) = −1+ 8 = 7

n

181

z-Transform and Discrete Systems

4.5.2 long Division In most cases, X(z) can be put in a rational fraction form as a ratio of two polynomials in z, the numerator and the denominator. Then, we can use long division to find the first few values of x(n). This method is good to check the results of the closed form for x(n). The two polynomials should be put in descending power of z. Example 4.14 Find the first three values of x(n) for X ( z) =

z

( z − 1)( z − 2)

SOLUTION We can multiply out the denominator to get X ( z) =

z z 2 − 3z + 2

Now we arrange X(z) as in the following: z −1 + 3z −2 + 7z −3 + �

z − 3z + 2 ) z

2

+

− z + 3 − 2z −1 = 3 − 2z −1 +

− 3 + 9z −1 − 6z −2 = 7z −1 − 6z −2 + − 7z −1 + 21z −2 − 14 z −3 = 15z −2 − 14z −3 � The result is read as X ( z) =

z = 0z 0 + (1) z −1 + 3z −2 + 7z −3 +  z 2 − 3z + 7

This indicates that x ( 0 ) = 0,

x (1) = 1,

x ( 2) = 3, 

as was obtained before with the closed form.

and

x ( 3) = 7

182

4.6

Discrete Signals and Systems with MATLAB®

PROPERTIES OF THE z-TRANSFORM

Next, we will discuss some of the important properties of the z-transform. We assume that the signals start at n ≥ 0.

4.6.1

linEarity ProPErty

The z-transform of x(n) = a1x1(n) + a2x2(n) is x (z) =



∑ ( a x ( n ) + a x ( n )) z 1 1

2 2

−n

n=0



= a1



x1 ( n ) z −n + a2

n=0



∑x ( n) z 2

−n

n=0

= a1 x1 ( z ) + a2 X 2 ( z ) Therefore, we write x ( n ) = a1 x1 ( n ) + a2 x 2 ( n ) ↔ a1 X1 ( z ) + a2 X 2 ( z )

4.6.2 shiFting ProPErty The z-transform of x(n − n0) u(n − n0) is ∞

∑x ( n − n )u ( n − n ) z 0

0

−n

n=0

Since u(n − n0) = 1 for n ≥ n0. We have the z-transform of x(n − n0) u(n − n0) written as ∞

∑x ( n − n ) z 0

−n

n=n0

Let m = n − n0, then ∞



∑x ( n − n ) z = ∑x (m ) z 0

n=n0

−n

m= 0

−( m + n0 )



=z

−n0

∑x ( m ) z m=0

So we write x ( n − n0 ) u ( n − n0 ) ↔ z − n0 X ( z )

−n0

X (z)

183

z-Transform and Discrete Systems

The z-transform of x(n − n0) is ∞

∑x ( n − n ) z 0

−n

n=0

Let n − n0 = m. Then the transform of x(n − n0) is ∞





x (m)z − ( m + n0 ) =

m=−n0

⎡ −1 x(m) z −m z −n0 = ⎢ x(m) z −m z −n0 + ⎢ m=−n0 ⎣ m=−n0







∑ x(m)z

m=−n0



∑ x(m)z

−m −n0

z

m=0

⎤ ⎥ ⎦⎥

−1

−( m + n0 )

⎡ ⎤ =⎢ x(m) z −m z − n0 + X( z ) z −n0 ⎥ ⎢⎣ m =−n0 ⎥⎦



Therefore, we write ⎡ −1 ⎤ x ( n − n0 ) ↔ ⎢ x ( m ) z −m z −n0 + X ( z ) z − n0 ⎥ ⎢⎣ m=−n0 ⎥⎦



The reason for this derivation is to take into account the initial conditions for y(n) since they are always given for n < 0. The z-transform of x(n + n0) is ∞

∑x ( n + n ) z 0

−n

n=0

Let n + n0 = m. Then the transform of x(n + n0) is ∞



x ( m ) z − (m − n0 ) =

m = n0

m = n0 −1 ⎡ ∞ ⎤ x ( m ) z −m z n0 = ⎢ x ( m ) z −m z n0 − x ( m ) z −m z n0 ⎥ ⎢⎣ m=0 m = n0 m=0 ⎦⎥ ∞





= z X (z) − n0



m = n0 −1

∑ x (m) z

−m n0

z

m=0

Therefore, we write x ( n + n0 ) ↔ z n0 X ( z ) −

m = n0 −1

∑ x (m) z

−m n0

z

m=0

The reason for this derivation will be apparent when we talk about state-space systems in later chapters. This also takes into consideration nonzero initial conditions.

184

Discrete Signals and Systems with MATLAB®

4.6.3 MultiPlication by e−an The z-transform of e−an u(n)x(n) is ∞





∑x ( n)( e

e − an x ( n ) z −n =

n=0

)

+a +1 − n

z

n=0

Thus, we have e −an x ( n ) ↔ X ( e a z )

4.6.4

convolution

The z-transform of +∞

x1 ( n ) * x 2 ( n ) =

∑x ( k ) x (n − k ) 1

2

k =−∞

if x1(n) and x2(n) start at n ≥ 0 is obtained using the z-transform defining summation equation ∞

⎡ ∞ ⎤ ⎢ x1 ( k ) x 2 ( n − k )⎥ z −n ⎢⎣ k =0 ⎥⎦

∑∑ n=0

which is also given as ∞



x1 ( k )

k =0



∑x ( n − k ) z 2

−n

n=0

Let n − k = m in the inner summation. Then m = −k will be the lower summation. But x2(m) is defined only for m ≥ 0. Therefore, ∞



∑x ( k )∑x ( m ) z 1

k =0

2

m=0



−m− k

=



∑x ( k ) z ∑x ( m ) z 1

k =0

−k

2

− m

= X1 ( z ) X 2 ( z )

m=0

From this, we write x1 ( n ) * x 2 ( n ) ↔ X1 ( z ) X 2 ( z ) This is the convolution equation in real time related to the convolution in the fre­ quency domain. We see that convolution, a sometimes difficult operation, in real time is simply complex multiplication in the z-domain.

z-Transform and Discrete Systems

185

4.7 REPRESENTATION OF TRANSFER FUNCTIONS AS BLOCK DIAGRAMS Consider the general third-order transfer function: Y ( z ) az 3 + bz 2 + cz + d = 3 X (z) z + ez 2 + fz + g The block diagram representation for this transfer function is obtained using the following steps. 1. The system is third order and hence we need three delay elements. Each delay will be preceded by a summer and followed by a summer. The initial diagram is shown in Figure 4.2, where z−1 represents a delay element. 2. Next we feed forward, a to the summer at the output Y(z), b to the summer before the third delay, c to the summer before the second delay, and d to the summer before the first delay. The modified picture is shown in Figure 4.3. 3. Now we feed backward, −g to the summer before the first delay, −f to the summer before the second delay, and −e to the summer before the third delay. The final block is shown in Figure 4.4.

FIGURE 4.2 Block diagram step 1.

FIGURE 4.3

Block diagram step 2.

FIGURE 4.4 Block diagram step 3.

186

Discrete Signals and Systems with MATLAB®

FIGURE 4.5

Block diagram for Example 4.15.

Example 4.15 Draw the block diagram for the system described by the following transfer function: Y ( z) Z3 + 1 = 3 X ( z ) z + 2z 2 SOLUTION First we write the system transfer function as Y ( z ) Z 3 + 0z 2 + 0z + 1 = X ( z ) z 3 + 2z 2 + 0z + 0 We see that we need three delay elements. The block is shown in Figure 4.5. Note that we have only one feedback line to the summer that precedes the third delay. Also we have only two forward paths as seen in the figure.

4.8

x(n), h(n), y(n), AND THE z-TRANSFORM

Throughout this book, we have been using x(n) to represent the input, h(n) to repre­ sent the impulse response, and y(n) to represent the output. In discrete real time, the output is given using the convolution. y (n) = x (n) * h (n) But as we saw earlier, convolution is multiplication is the transform domain. Thus, we write Y(z) = X(z) H(z). We then can use Tables 4.1 and 4.2 to get back to the realtime signal y(n).

187

z-Transform and Discrete Systems

Example 4.16 If x(n) = u(n) is an input to the system with h(n) = (.5)n u(n), what is the output y(n)? SOLUTION The output in the z-domain is

Y ( z) = X ( z) H ( z)



The input in the z-domain is X(z) = z/(z − 1) and the impulse response is H(z) = z/(z − .5). Thus, using the convolution property of the z-transform, we write Y ( z) =

z z z − 1 z − .5

We will find Y(z)/z first to make use of Table 4.1.

Y ( z) z A B

= = + z (z − 1)( z − 5) z − 1 z − .5

The constants A and B are calculated as

A=

B=

z 1 z− 2

 =

1 1−

z=1

1 2

=2

z 1/ 2 = −1  = z − 1 z= 1 1/ 2 − 1 2

Therefore,

Y ( z) 2 1

= − z z − z − .5

and

Y ( z) =

2z z

− z − 1 z − .5

To get back y(n), we use Table 4.1 and write

y ( n) = 2u ( n) − .5n u ( n)

188

Discrete Signals and Systems with MATLAB®

4.9 SOLVING DIFFERENCE EQUATION USING THE z-TRANSFORM We have seen before that the z-transform of x(n − n0) is ⎡ −1 ⎤ x ( n − n0 ) ↔ ⎢ x ( m ) z −m z −n0 + X ( z ) z −n0 ⎥ ⎢⎣ m=−n0 ⎦⎥



This relation is important when we z-transform difference equation. Example 4.17 Consider the system

y ( n) = .5y ( n − 1) = x ( n)

with y(−1) = 0 and x(n) = u(n). Find y(n) for n ≥ 0.

SOLUTION We will z-transform the given difference equation term by term.

y ( n) ↔ Y ( z )

y ( n − 1) ↔

−1

∑ y ( m) z

−1 −m

z

+ z −1Y ( z ) = y ( −1) z −1z +1 + z −1Y ( z )

m=−1

Therefore, the given equation becomes Y ( z ) − .5 ⎡⎣ y ( −1) z 0 + z −1Y ( z ) ⎤⎦ = X ( z ) = or

Y ( z ) − .5z −1Y ( z ) =

z z − 1

Solving for Y(z), we get

Y ( z) =

z 2 ( z − 1)( z − .5)

By doing partial fraction expansion on Y(z), we get

Y ( z) =

2z z

− z − 1 z − .5

and

y ( n) = 2u ( n) − (.5) u ( n) n

n≥0

z z − 1

189

z-Transform and Discrete Systems

Example 4.18 Use the z-transform to find the impulse response of the system

y ( n) − y ( n − 2) = x ( n)



SOLUTION We z-transform the previous equation term by term to get y ( z ) − ⎣⎡ y ( −2) z 0 + y ( −1) z −1 + z −2y ( z ) ⎦⎤ = X ( z ) With

X ( z ) = 1 ↔ δ ( n) = x ( n)



and y(−2) = y(−1) = 0 (calculating the impulse response), we have

(

)

Y ( z ) 1− z −2 = X ( z )



or

Y ( z) =

1 z 2

= 2 −2 1− z z − 1

and

Y ( z) z A B = 2 = + z z − 1 z − 1 z + 1

The constants are

A=

z 1 = z + 1 z=1 2

B=

z 1 = z + 1 z=−1 2

Thus,

Y ( z) =

1/ 2z 1/ 2z

+ z − 1 z + 1

and the output y(n) = h(n) is

y ( n) =

1⎡ n u ( n) + ( −1) u ( n) ⎤ ⎦ 2⎣

190

4.10

Discrete Signals and Systems with MATLAB®

CONVERGENCE REVISITED

Consider the following transfer function in the z-domain: H (z) =

z2 + z + 1 z 2 + 2z + 1

Let us first find h(n) using long division by first putting the numerator and the denom­ inator of the transfer function in the descending powers of z. In this case, we will get H ( z ) = 1z 0 − z −1 + 2z −2 − 3z −3 + 4z −4 +  and the impulse response h(n) in this case is h ( n ) = δ ( n ) − δ ( n − 1) + 2δ ( n − 2 ) − 3δ ( n − 3) + 4δ ( n − 4 ) +  This impulse response is causal since h(n) has zero values for n < 0. However, if we put H(z) in the form H (z) =

1 + z + z2 1 + 2z + z 2

we will get H ( z ) = 1 − z + 2z 2 − 3z 3 + 4 z 4 +  and h(n) in this case is h ( n ) = δ ( n ) − δ ( n + 1) + 2δ ( n + 2 ) − 3δ ( n + 3) + 4δ ( n + 4 ) +  The signal is noncausal because it is zero for n > 0 and nonzero or n ≤ 0. Notice that H (z) =

1 + z + z2 z2 + z + 1 = 2 2 1 + 2z + z z + 2z + 1

But we have two signals as follows: h ( n ) = δ ( n ) − δ ( n + 1) + 2δ ( n + 2 ) − 3δ ( n + 3) + 4δ ( n + 4 ) +  h ( n ) = δ ( n ) − δ ( n − 1) + 2δ ( n − 2 ) − 3δ ( n − 3) + 4δ ( n − 4 ) +  There is a reason for what we see here. Consider the signal h(n) = anu(n) with its z-transform: H (z) =

+∞



∑a u ( n) z = ∑a z n

n=−∞

−n

n −n

z=0

=

1 z = −1 1 − az z−a

191

z-Transform and Discrete Systems

This H(z) has the ROC |z| > |a| since we require that |az−1| < 1 for the series to be summable. Notice also that H(z) has its pole at z = a and that H(z) converges outside the circle of radius of magnitude a. Consider next the signal h(n) = anu(−n − 1) with its z-transform given by H (z) =

+∞



a n u ( −n − 1) z −n =

−∞

−1



n=0

a n z −n =

n=−∞



n=∞

a n z −n − 1 =

n=−∞

∑a

−n n

z −1

n=0

where we changed the sign on n when we changed the limit to start at n = 0 and end at n = ∞. H(z) then is written as H (z) =

(

)

1 − 1 − a −1 z 1 a −1 z z − 1 = = − −1 −1 1− a z 1− a z 1 − a −1 z z − a

But the ROC is now different since in this case we required that |a−1z| < 1 for the series to converge. This means that |z/a| < 1 or |z| < |a|. From what has been discussed it is clear that to find h(n) from H(z), the ROC must be given. To generalize, let us consider that H(z) has N poles and M zeros. If H(z) has an ROC for which z > pi When pi is the ith pole that is farthest from the pole at the origin, then in this case the system is causal. But if the ROC is z < pi where pi is the ith pole that is closest to the pole at the origin, then in this case the system is noncausal. Let us look at some examples. Example 4.19 Consider the system H ( z) =

( 2z − 3) z ( z − 1)( z − 2)

with ROC |z| > 2. Find h(n). SOLUTION The transfer function can be written as H ( z) =

( 2z − 3) z = ( z − 1)( z − 2)

z z + z −1 z − 2

We can see that the ROC of H(z) is outside the rings |z| = 1 and |z| = 2 and hence h(n) = (1)nu(n) + (+2)nu(n).

192

Discrete Signals and Systems with MATLAB®

Example 4.20 Consider the same H(z) as in Example 4.19, but the ROC now is |z| < 1. What is h(n)? SOLUTION We can see in this case that the ROC is inside both rings |z| = 1 and |z| = 2. Therefore, h ( n) = − (1) u ( − n − 1) + − ( 2) u ( − n − 1) n

n

The minus sign here is added because the system is noncausal.

4.11

FINAL-VALUE THEOREM

The final value of the signal x(n) as n → ∞ can be obtained using the z-transform. The derivation is omitted since it is somewhat involved. We have x ( ∞ ) = lim x ( n ) = lim ( z − 1) X ( z ) n→∞

z→1

(4.5)

if x(n) has a final value. x(n) will have a final value if all the poles of X(z) are within the unit circle. This is to say that for all the poles zi, |zi| < 1. Example 4.21 Consider the system h ( n) = (.5) u ( n) n

Find h(∞) or the final value of h(n). SOLUTION We can see here, since the expression for h(n) is simple, that h(∞) = (.5)∞ u(∞) = 0. This is clear because (.5)∞ will approach zero. But we can use the final-value theo­ rem since the pole for H(z) = z/(z − .5) is within the unit circle. Therefore, 1 ⎛ z ⎞ h ( ∞ ) = lim ( z − 1) ⎜ = (1− 1) = 0  z→1 ⎝ z − .5 ⎠⎟ 1− .5

4.12

INITIAL-VALUE THEOREM

The initial-value theorem is used to find the initial value x(0) for the signal x(n). From the z-transform of x(n), we write X ( z ) = x ( 0 ) + x (1) z −1 + z ( 2 ) z −2 + 

193

z-Transform and Discrete Systems

If we take the limit of X(z) as z approaches infinity, we will have lim X ( z ) = x ( 0 ) + lim

z→∞

z→∞

x (1) x ( 2) + lim 2 +   z→∞ z z

So we have lim X ( z ) = x ( 0 )

z→∞

(4.6)

as the initial-value theorem Example 4.22 If a certain system has the impulse response h ( n) = (.5) u ( n) n

what would be h(0), the initial value for h(n)? SOLUTION It is clear that h(0) = (.5) u(0) = 1. Using the initial-value theorem, we have 0

h ( 0 ) = lim H ( z ) = lim z→∞

4.13

z→∞

z =1 z − .5

SOME INSIGHTS: POLES AND ZEROES

The transfer function H(z) of a linear time-invariant system is a very important rep­ resentation. It tells us many things about the stability of the system, the poles, the zeros, and the shape of the transients of the output of the system. Using H(z) we can find the steady-state response of the system and the particular solution of the system all in one shot.

4.13.1

PolEs oF thE systEM

The poles of the system are the roots of the denominator, the algebraic equation in the variable z of the transfer function H(z) H (z) =

N /( z ) D(z)

D(z) is a polynomial in z of order equal to the order of the system. The roots of the denominator D(z) are called the poles of the system. These are the same poles we discussed in Chapter 2. We called them then the eigenvalues of the system D(z) is actually the characteristic equation of the system or, as referred to before, the auxil­ iary equation of the system.

194

Discrete Signals and Systems with MATLAB®

14.13.2 ZEros oF thE systEM The roots of the numerator N(z) are called the zeros of the system.

4.13.3 stability oF thE systEM The poles of the system determine its stability. If the poles are all within the unit circle, then the system at hand is stable and the transients will die as time progresses. The stability of the system is determined by the poles and not the zeros. If one of the poles is outside the unit circle, then the system is not stable. You may have zeros that are outside the unit circle, but the location of the zeros has no effect on the stability of the system. Given H(z), the roots of the denominator will determine the general shape of the output y(n), which, in this case, is h(n) because the input x(n) is the impulse δ(n). If D(z) has two roots (second-order system) called α1 and α2, then the output will have the general form y ( n ) = h ( n ) = c1 ( α1 ) + c2 ( α 2 ) n

n

where the constant c’s are to be determined. The exponential terms will determine the shape of the transients. If one of the α’s is outside the unit circle, the output will grow without bounds. If the two α’s are within the unit circle, the output will die as time progresses. The α’s are the eigenvalues or the poles of the system. The transfer function Y(z)/X(z) is called H(z) if the input X(z) is 1 (x(n) = δ(n)). The transfer function Y(z)/X(z) is very important as we will see later in the design of linear time-invariant systems.

4.14 END-OF-CHAPTER EXAMPLES EOCE 4.1 Find the z-transform of the signals n

⎛ 1⎞ 1. x ( n) = ⎜ ⎟ u ( n) ⎝ 3⎠ n

⎛ 1⎞ 2. x ( n) = ⎜ ⎟ u ( − n − 1) ⎝ 2⎠ n

n

⎛ 1⎞ ⎛ 1⎞ 3. x ( n) = ⎜ ⎟ u ( n) − ⎜ ⎟ u ( − n − 1) ⎝ 2⎠ ⎝ 2⎠ and indicate their ROC.

195

z-Transform and Discrete Systems SOLUTION For the first signal x(n) = (1/3) u(n), the z-transform is n

X ( z) =

+∞



n=−∞

n

⎛ 1⎞ −n ⎜⎝ ⎟⎠ u ( n) z = 3



n



1 z 1 ⎛ 1 −1⎞ =  for   z −1 < 1 ⎜⎝ z ⎟⎠ = −1 − − 3 1 1/3 z z 1/3 3 ( ) ( ) n=0

or |1/3| < |z|. So the ROC in |z| > 1/3. For the second signal, x(n) = −(1/2)nu(−n − 1), the z-transform is given by +∞

X ( z) =



n=−∞

n

⎛ 1⎞ u(− n − 1)z − n = − ⎝⎜ 2 ⎠⎟

n=∞

X ( z) = −

∑ n=1

⎛ 1⎞ ⎜⎝ ⎟⎠ 2



−n

z = 1− n

∑ n= 0

−1

∑ ⎛⎜⎝ 12⎞⎟⎠

n

z −n

n=−∞

n

⎛ ⎛ 1 ⎞ −1 ⎞ 1 z = ⎜ ⎜⎝ ⎟⎠ z ⎟ = 1− −1 − − 2 1 (1/ 2) z z (1/ 2) ⎝ ⎠

with the ROC |z|< 1/2. For the last signal, x(n) = (1/3)n u(n) − (1/2)n u(−n − 1), the z-transform is X ( z) =

+∞



n=−∞

n

⎛ 1⎞ u ( n) z −n − ⎝⎜ 3 ⎠⎟

+∞



n

z z ⎛ 1⎞ + ⎜⎝ ⎟⎠ u ( − n − 1) = − − 2 z z 1/3 ( ) (1/ 2) n =−∞

with ROC now as |z| > 1/3 and |z| < 1/2. By combining these conditions, we get 1 1 < z< 3 2 for the ROC.

EOCE 4.2 What is the z-transform of the signal x ( n) = ( n + 2)(.5) u ( n) n

SOLUTION x(n) can be written as x ( n) = nx1 ( n) + 2x1 ( n) where x1(n) = (.5)n u(n). Thus, we have X1 ( z ) =

z  with  z > .5 z − .5

196

Discrete Signals and Systems with MATLAB®

Next, we can use the differentiation property in Table 4.2 to find X(z) as X ( z ) = −z X ( z) =

d z z ⎡ (z − .5) − z ⎤ X1( z ) + 2 = −z ⎢ +2 2 ⎥ dz z − .5 z − .5 ⎣ (z − .5) ⎦

.5z z .5z + 2z( z − .5) 2z 2 − .5z +2 = = 2 (z − .5) z − .5 (z − .5)2 (z − .5)2

with |z| > .5 as the ROC.

EOCE 4.3 What is X(z) if

x ( n) = cos ( n) u ( n) + nu ( n)

SOLUTION We can divide the given signal into two parts. X ( z ) = X1 ( z ) + X 2 ( z ) where X1(z) and X2(z) are the z-transforms of cos(n)u(n) and nu(n), respectively. Therefore, X ( z) = 

1− cos (1) z −1  z −1 + −1 −2 1− 2cos (1) z + z (1− z −1)2

with |z| > 1 as the ROC. X2(z) can be obtained by finding the z-transform of u(n) first, then taking the derivative with respect to z as X2 ( z) =

⎛ z − 1− z ⎞ −zd ⎛ z ⎞ z z −1 ⎜⎝ ⎟⎠ = −z ⎜ 2 ⎟ = 2 = dz z − 1 ⎝ ( z − 1) ⎠ ( z − 1) 1− z −1

(

EOCE 4.4 What is the z-transform of the signal

x ( n) = x1 ( n) * x2 ( n)

with

x1 ( n) = δ ( n) + 2δ ( n − 1 )

and

x2 ( n) = δ ( n − 1) + 3δ ( n − 2)

)

2

197

z-Transform and Discrete Systems SOLUTION By using the convolution property, we write

(

)(

)

X ( z ) = X1 ( z ) X 2 ( z ) = 1+ 2z −1 z −1 + 3z −2 = z −1 + 3z −2 + 2z −2 + 6z −3 and x(n) then is x ( n) = δ ( n − 1) + 5δ ( n − 2) + 6δ ( n − 3) We can also use MATLAB® and convolve x1(n) with x2(n) and write the script EOCE4_4 to get x=

{0

1

2

3}



which indicates that X ( z ) = 0z 0 + 1z −1 + 5z −2 + 6z −3

EOCE 4.5 With x1 ( n) = δ ( n + 1) + δ ( n) + δ ( n − 1) and x2 ( n) = δ ( n) + δ ( n − 1) what is the z-transform if x(n) = x1(n) * x2(n)? SOLUTION Convolution in real time is multiplication in the z-domain. Thus, X ( z ) = X1( z )X 2( z ) = (z + 1+ z −1)(1+ z −1) = z + 1+ 1+ z −1 + z −1 + z −2 = z + 2 + 2z −1 + z −2 and the inverse z-transform is x ( n) = δ ( n + 1) + 2δ ( n) + 2δ ( n − 1) + δ ( n − 2) We can also use MATLAB to do this but with some attention to the starting index of each signal. We use the MATLAB function conv if the two signals start at n = 0. In our case, x1(n) starts at n = −1 and x2(n) starts at n = 0. In this case, we have to fix the starting and ending indices to find x(n). We write the MATLAB script EOCE4_5 to do that.

198

Discrete Signals and Systems with MATLAB®

We will get −1 0 1 2

1 2 2 1

and from this, we have x ( n) = δ ( n + 1) + 2δ ( n) + 2δ ( n − 1) + δ ( n − 2)

EOCE 4.6 When x ( n) = (.5) u ( n) + (.3) u ( n) + (.9) u ( n) n

n

n

what is X(z) and its ROC? SOLUTION Using the linearity property of the z-transform, we write

X ( z) = =

z z z + + z − .5 z − .3 z − .9

z( z − .3)( z − .9) + z( z − .5)( z − .9) + z( z − .5)( z − .3)

(z − .5)( z − .3)( z − .9)

and the ROC is |z| > .3 and |z| > .5 and |z| > .9 all satisfied simultaneously. The ROC becomes |z| > .9.

EOCE 4.7 Consider the transforms X1 ( z ) = 1+ z −1 + 3z −2 and X 2 ( z ) = 1+ 3z −2 What is x(n) = x1(n) * x2(n)?

199

z-Transform and Discrete Systems SOLUTION x1 ( n) = δ ( n) + δ ( n − 1) + 3δ ( n − 2) and x2 ( n) = δ ( n) + 3δ ( n − 2) We can use MATLAB to find x(n) = x1(n) * x2(n) by writing the script EOCE4_7. to get

x=

{1

1

6

3

9}



and x ( n) = δ ( n) + δ ( n − 1) + 6δ ( n − 2) + 3δ ( n − 3) + 9δ ( n − 4 ) We can also use the z-transform to arrive at this result. X ( z ) = X1( z )X 2( z ) = (1+ z −1 + 3z −2 )(1+ 3z −2 ) = 1+ 3z −2 + z −1 + 3z −3 + 3z −3 + 9z −4 and then the inverse z-transform is x ( n) = δ ( n) + δ ( n − 1) + 6δ ( n − 2) + 3δ ( n − 3) + 9δ ( n − 4 )

EOCE 4.8 Use MATLAB, long division and partial function expansion to find h(n) if H ( z) =

1 z 2 − 3z + 2

with ROC z > 2

SOLUTION Using MATLAB, first we need to put X(z) in ascending powers of z−1 and write H ( z) =

z −2 1− 3z −1 + 2z −2

Then we will use the MATLAB function residuez that has the form [r p k] = residuez (num, den)

200

Discrete Signals and Systems with MATLAB®

where num and den are the coefficients of the numerator and the denominator of the rational z-transformed function. r is a vector that contains the residues, p is the vector that contains the poles, and k is the constant term that is nonzero if the degree of num is larger or equal to the degree of den, the numerator and the denominator of the rational z-transformed function. With this, we write the script EOCE4_81. to get r = 0.5000 and   −1.0000 p = 2 and 1 k = 0.5 This gives the transfer function H ( z) =

1 z (1/ 2) z − + 2 z −1 z − 2

from which we get h ( n) =

1 1 n δ ( n) − u ( n) + ( 2) u ( n) 2 2

using Table 4.1. We can see that the first few terms of h(n) are h (0) =

1 1 − 1+ = 0 2 2

h (1) = 0 − 1+ 1 = 0 h ( 2) = 0 − 1+ 2 = 1 We can also use MATLAB to find some terms of h(n). To do that, we can use the MATLAB function filter with an impulsive input. We have Y ( z) = X ( z) H ( z) If X(z) = 1, (h(n) = δ(n)), then Y(z) = H(z) and y(n) is h(n). To do that, we write the script EOCE4_82. to get the same result we found earlier. Using long division, we can divide the numerator by the denominator to get H ( z) =

1 = 0z 0 + 0z −1 + z −2 + 3z −3 +  z 2 − 3z + 2

which clearly indicates that h(0) = 0, h(1) = 0 and h(2) = 1 as we saw earlier.

201

z-Transform and Discrete Systems Using partial fraction expansion, we write the transfer function as

H ( z) 1 A B C

= = + + z z ( z − 1)( z − 2) z z − 1 z − 2 with the constants evaluated as A= B= C=

1 (z − 1)( z − 2) 1 z( z − 2) 1 z( z − 1)

= z=0

1 2

= −1 z=1

= z= 2

1 2

So the transfer function becomes H ( z) =

(1/ 2) z + z

−z (1/ 2) z + z −1 z − 2

and h ( n) =

1 1 2 δ ( n) − u ( n) + ( 2) u ( n) 2 2

EOCE 4.9 Find h(n) if H(z) is H ( z) =

1 z −2 = z − .9z + .7 1− .9z −1 + .7z −2 2

Assume the resulting signal h(n) is valid only for n ≥ 0 and it is real. SOLUTION Since this H(z) is not similar to any form in Table 4.1, we need to use partial frac­ tion expansion on H(z). We do that using MATLAB and write the script EOCE4_9 to get r = − 0.7143 − 0.4557i and − 0.7143 + 0.4557i p = 0.4500 + 0.7053i and 0.4500 − 0.7053i k = 1.4286 mag _ r = 0.8473 and 0.8473

202

Discrete Signals and Systems with MATLAB® phase _ r = −2.5737 and 2.5737 mag _ p = 0.8367 and 0.8367 phase _ p = 1.0029 and 1 − .0029

Hence, we can see that H ( z ) = 1.428 +

0.847e − j 2.57 0.847e j 2.57 + j1.0029 −1 1− 0.8367 e z 1− 0.8367 e − j1.0029 z −1

with the ROC as |z| > 0.8367. Now we can use Table 4.1 to get the inverse trans­ form h(n). We write h ( n) = 1.428δ ( n) + 0.847e − j 2.57 (.8367) e j (1.0029)n + 0.847e j 2.57 (.8367) e − j (1.0029)n n

n

These two terms are complex conjugate terms. We know that the sum of two complex conjugate terms is two times the real part of the complex number. Thus, we write

(

h(n) = 1.428δ(n) + 2Real 0.847e − j 2.257 (.8367) e j (1.0029)n n

(

= 1.428(n) + 2 ( 0.847) (.8367) Real e n

j(1.0029  n− 2.57)

)

)

After some simplifications, we get n h ( n) = 1.428δ ( n) + ⎡ 2 ( 0.847)(.83657) cos (1.0029n − 2.57) ⎤ u ( n) ⎣ ⎦

EOCE 4.10 Consider the system transfer function in the z-domain H ( z) =

z z 3 − 6z 2 + 11z − 6

with ROC |z| > 3. Find h(n). SOLUTION First, we write H(z) in the proper form so that we can use partial function to find h(n). H(z) then is H ( z) =

z −2 1− 6z + 11z −2 − 6z −3 −1

203

z-Transform and Discrete Systems

By putting H(z) in partial fraction form, we use MATLAB and write the script EOCE4_10 to get r = 0.5000, −1.0000, and 0.5000 p = 3.0000, 2.0000, and 1.0000 k =  [ ] to indicate zero value Then the partial fraction expansion results in H ( z) =

0.5 0.5 −1 + + 1− z −1 1− 2z −1 1− 3z −1

To bring H(z) back into real time, we need to look carefully at the ROC for H(z). For the first term 0.5/(1 − z−1) = 0.5z/(z − 1), the pole is at z = 1. The ROC of H(z) is outside the ring |z| = 3 and hence outside the ring |z|= 1. In this case, 0.5 ↔ 0.5u ( n) 1− z −1 The second term −1/(1 − 2z−1) = −z/(z − 2) has the pole z = 2. The ROC of H(z) is outside the ring |z| = 3 and hence −1 n ↔ − ( 2) u ( n) 1− 2z −1 The last term 0.5/(1 − 3z−1) = 0.5z/(z − 3) has a pole at z = 3. The ROC of H(z) is outside the |z|= 3 circle and z = 3 is within this ROC. Thus, 0.5 n ↔ 0.5 ( 3) u ( n) 1− 3z −1 Therefore, the inverse transform is

h ( n) = 0.5u ( n) − ( 2) u(n) + 0.5 ( 3) u ( n) n

n

Note: When you use MATLAB to find h(n) be careful to pay attention to the ROC of H(z).

EOCE 4.11 Consider the following causal difference equation:

y ( n) − .7y ( n − 1) = x ( n)

where y(n) is the output and x(n) is the input.

204

Discrete Signals and Systems with MATLAB® 1. 2. 3. 4.

Find the transfer function H(z). Find the transfer function H(ejθ). Find h(n), the impulse response. Find y(n) if x(n) = u(n). SOLUTION

1. With zero initial conditions we transform the difference equation term by term into the z-domain. We will have Y ( z ) − .7z −1 Y ( z ) = X ( z ) Taking Y(z) as a common factor, we get Y ( z ) ⎡⎣1− .7z −1 ⎤⎦ = X ( z ) and the transfer function is Y ( z) 1 z = = X ( z ) 1− .7z −1 z − .7 with ROC |z| > .7. 2. Since H(z) converges for |z| > .7, the unit circle is inside the ROC and so we can find H(ejθ) from H(z) as

( )

H e jθ = H ( z ) z=e jθ =

e jθ 1 = e − .7 1− .7e − jθ jθ

3. h(n) can be obtained directly from Table 4.1 as h ( n) = (.7) u ( n) n

4. With h(n) = (.7)nu(n) and x(n) = u(n), we have y(n) = x(n) * h(n). Or in z-domain, we have Y ( z) =

z z z2 1 = 2 = −1 z − 1 z − .7 z − 1.7z + .7 1− 1.7z + .7z −2

At this point, we can determine the ROC for Y(z) as the intersection of region |z| > 1 and |z| > .7. Thus, the ROC for Y(z) is |z| > .7. We can use MATLAB to find Y(z) in partial fraction form by writing the script EOCE4_111 to get r = 3.3333 and   −2.3333 p = 1.0000 and 0.7000

205

z-Transform and Discrete Systems Thus, Y ( z) =

3.332 −2.3333 + 1− z −1 1− 0.7z −1

The inverse transform of this equation gives y ( n) = 3.332 (1) u ( n) − 2.3333 ( 0.7) u ( n) n

n

We can use MATLAB to plot the results obtained in this example. We will use the MATLAB function freqz as [H, theta] = freqz (num, den, N, ‘whole’) where H is the vector that contains all the frequency response values. theta is the vector that contains the frequency values. num and den are the coefficients of the numerator and the denominator of the transfer function. whole indicates that freqz will evaluate H for the N theta values around the entire unit circle. The MATLAB script is EOCE4_112. The plots are shown in Figure 4.6.

FIGURE 4.6

Signals for EOCE 4.11.

206

Discrete Signals and Systems with MATLAB®

EOCE 4.12 Consider the system transfer function H ( z) =

2z 2 − 12z ( z − .3)( z + .2)( z − 3)

Find h(n) for the following ROCs and indicate stability. 1. 2. 3. 4.

|z| > 3 |z| < .2 .2| z| < .3 .3 < |z| < 3 SOLUTION

The poles of the system are at z = .3, z = −.2 and z = 3. 1. |z| > 3 is the ROC that is outside the ring |z| = 3. The poles at .3, −.2, and 3 are inside this ring. The system is unstable and causal with h ( n) = c1 (.3) u ( n) + c 2 ( −.2) u ( n) + c3 ( 3) u ( n) n

n

n

2. |z| < .2 is the ROC that is inside the ring |z| = .2. The system is unstable and noncausal with h ( n) = c4 (.3) u ( −n − 1) + c5 ( −.2) u ( − n − 1) + c6 ( 3) u ( − n − 1) n

n

n

3. .2 < |z|< .3 is the ROC that is between the two rings |z| = .2 and |z| = .3 h ( n) = c7 (.3) u ( −n − 1) + c8 ( −.2) u ( n) + c9 ( 3) u ( − n − 1) n

n

n

4. .3 < |z|< 3 is the ROC that is between the two rings |z| = .3 and |z| = 3. h ( n) = c10 ( −.2) u ( n) + c11 (.3) u ( n) + c12 ( 3) u ( − n − 1) n

n

n

EOCE 4.13 MATLAB has a function called filter that can be used to find the response of a discrete system using initial conditions that are different from zero. The form of this function is y = filter (num, den, ,x y0 ) where

y is the output vector.

num is the numerator coefficients vector.

207

z-Transform and Discrete Systems

den is the denominator coefficients vector. x is the input vector. y0 is the initial conditions vector that is derived using the actual initial condi­ tions given to you with the system under investigation. In real time, the Nth-order difference equation can be represented as y ( n) + a1y ( n − 1 ) +  + aN y ( n − N ) = b0 x ( n) + b1x ( n − 1) +  + bL x ( n − L ) The z-transform of the this equation is Y ( z) =

b0 + b1z −1 +  + bL z −L 1+ a1z −1 + a2z −2 +  + aN z −N

The derived initial conditions for the filter function are computed as in the following. y00 = −a1y ( −1 ) − � − aN y ( −N )

y01 = −a2y ( −1) a3y ( −2) − � − aN y ( −N + 1) y0N

�  = −aN y ( −1)

Consider the following system:

y ( n) − y ( n − 1) = x ( n)

with y(−1) = 1 and x(n) = δ(n). Find y(n) using the z-transform.

SOLUTION We can z-transform the difference equation term by term and write Y ( z ) − ⎣⎡ y ( −1) + z −1Y ( z ) ⎤⎦ = X ( z ) We can rearrange terms and write

Y ( z ) ⎡⎣1− z −1 ⎦⎤ = X ( z ) + y ( −1 ) We finally have Y ( z) =

X ( z )   y ( −1) + 1− z −1 1− z −1

With X(z) = 1, the output is

Y ( z) =

z z 2z

+ + z −1 z −1 z −1

208

Discrete Signals and Systems with MATLAB®

Using Table 4.1, we get y ( n) = 2u ( n) Using MATLAB, we first write Y(z)/X(z) without initial conditions to get Y ( z) 1 b0 = = −1 1+ ( a1) z −1 X ( z ) 1− z The initial condition vector y0 will have one component since the system is first order. So the derived initial condition is y00 = −a1y ( −1) = −1(1) = −1 Next, we write the MATLAB script EOCE4_131 to find y(n) for x(n) = δ(n). The plots are shown in Figure 4.7. We can also use MATLAB with the MATLAB function filtic to find the derived initial conditions for us. The general form of filtic is ic = filtic (num, den, x0, y0 ) where ic is the returned derived initial conditions. num and den are as discussed before. x0 and y0 are the initial condition vectors given with the problem for negative n. We can rework the MATLAB solution using the filtic function as in the script EOCE4_132 and the result is the same.

FIGURE 4.7

Signals for EOCE 4.13.

209

z-Transform and Discrete Systems

EOCE 4.14 Consider the following system:

y ( n) − .5y ( n − 1) − .1y ( n − 2) + .2y ( n − 3) = x ( n)



with x(n) = u(n) and y(−1) = 1, y(−2) = 2 and y(−3) = 3,

1. Find the output y(n) using MATLAB. 2. Find the system transfer function. 3. Is the system stable? SOLUTION 1. The initial condition vector y0 for the function filter is determined next. y00 = −a1y ( −1) − a2y ( −2) − a3y ( −3) = .5 (1) + .1( 2) − .2( 3) = .1 y01 = −a2y ( −1) − a3y ( −2) = .1(1) + .2 ( 2) = .3  y02 = −a3y ( −1) = −.2 (1) = −.2 

We can use MATLAB to determine these derived initial conditions by writing the EOCE4_141 script. The result is ic = 0.1000 − 0.3000 − 0.2000 With these derived initial conditions, we can write the MATLAB script

EOCE4_142 to plot the response due to the step input.

The plots are shown in Figure 4.8.

FIGURE 4.8 Signals for EOCE 4.14.

210

Discrete Signals and Systems with MATLAB® 2. The system transfer function is obtained by taking the z-transform of the difference equation with zero initial conditions. The result is Y ( z ) − .5z −1zY ( z ) − .1z −2Y ( z ) + .2z −3Y ( z ) = X ( z ) By grouping similar terms, we get Y ( z ) ⎡⎣1− .5z −1 − .1z −2 + .2z −3 ⎤⎦ = X ( z ) and the transfer function is Y ( z) 1 = H ( z) = 1− .5z −1 − .1z −2 + .2z −3 X (Z) 3. We can use MATLAB to find the poles of H(z). We type at the MATLAB prompt r   =  roots ([1 −.5  −.1 .2]); abs (r)%the magnitude of the roots to get 0.5000, 0.6325, and 0.6325. The roots are within the unit circle and thus the system is stable.

EOCE 4.15 Consider the system y ( n) =

1 y ( n − 1) = x ( n) + x ( n − 1) 2

1. Find the impulse response h(n). 2. What is the step response? 3. Use MATLAB to find y(n) if x(n) = (.5)nsin(n) u(n). SOLUTION 1. If we can find H(z) for the given system, we will inverse transform H(z) to get h(n). Let us z-transform the given difference equation to get Y ( z) −

1 −1 z Y ( z ) = X ( z ) + z −1X ( z ) 2

and the transfer function is then Y ( z) 1+ z −1 = H ( z) = X ( z) 1− (1 / 2) z −1

211

z-Transform and Discrete Systems The ROC is |z| > 0.5. Using partial fraction expansion on H(z), we have H ( z) z +1 A B = = + z z (1/ 2 ) z z − (1/ 2)

(

)

z + 1

z − (1/ 2)

z=0

with

A=

= −2

and

z + 1

(1/ 2) + 1 = (3/ 2) = 3 = z z=1/ 2 (1/ 2) (1/ 2)

B= Thus,

H ( z) =

−2z 3z

+ z z − (1/ 2 )

and from Table 4.1, we get

n

⎛ 1⎞ h ( n) = −2δ ( n) + 3 ⎜ ⎟ u ( n) ⎝ 2⎠ 2. The step response is obtained with X(z) = z/(z − 1). The output will be Y ( z) = X ( z) H ( z) =

z +1 z z − (1/ 2 ) z − 1

We will do partial fraction expansion on

Y ( z) z +1 A B = + z z − (1/ 2) ( z − 1)  z − (1/ 2) z − 1

(

)

to get ⎛ 1⎞ 3 ⎜⎝ ⎟⎠ + 1 z +1 2 A= = = 2 = −3 1 z − 1 z= 1 ⎛ 1 ⎞ 2 ⎜⎝ ⎟⎠ − 1 − 2 2 B=

z +1 z − (1/ 2)

= z=1

1+ 1 2 = =4 1− (1/ 2) 1/ 2

212

Discrete Signals and Systems with MATLAB®

FIGURE 4.9 Signals for EOCE 4.15. The resulting output in the z-domain is Y ( z) =

−3z 4z + z − (1/ 2) z − 1

and the inverse z-transform is n

1 y3 ( n) = − ⎝⎛⎜ ⎞⎠⎟ u ( n) + 4u ( n) 2 We can use MATLAB to verify this solution by writing the script EOCE4_151. The plots are shown in Figure 4.9. 3. We will use the MATLAB script EOCE4_152 to do that. The plots are shown in Figure 4.10.

EOCE 4.16 Consider the following system: H ( z) = What is h(n), the impulse response?

z z2 + 1

213

z-Transform and Discrete Systems

FIGURE 4.10 Signals for EOCE 4.15. SOLUTION We will use partial fraction expansion to find h(n). As we did previously, we will put H(z)/z in partial fraction form, then multiply by z to introduce a z into the numerator. By doing, so we will easily inverse-transform back to real time since the entries in Table 4.1 have z in the numerator. H ( z) 1 A B = 2 = + z z +1 z − j z + j We next find the constants and write H ( z ) −1/ 2 j 1/ 2 j = + z z− j z+ j Using Table 4.1, we get h ( n) =

n n −1 1 −1 1 j ( j ) u ( n) + j ( − j ) u ( n) = j e jπ / 2n u ( n) + j e − jπ / 2n u(n) 2 2 2 2

(

)

(

By taking common factors, we get h ( n) =

1 1 j ⎡e − jπ / 2n − e jπ / 2n ⎤⎦ u ( n) = − j ⎡⎣e jπ / 2n − e − jπ / 2n ⎤⎦ u(n) 2 ⎣ 2

and finally h ( n) = −

1 ( 2 j ) jsin ⎛⎝⎜ π2 n⎟⎞⎠ u ( n) = sin ⎜⎛⎝ π2 n⎟⎞⎠ u ( n) 2

)

214

Discrete Signals and Systems with MATLAB®

EOCE 4.17 Consider the system z z − 2z + 2

H ( z) =

2

What is h(n)?

SOLUTION The impulse response h(n) is the inverse z-transform of H(z). We will put H(z)/z in partial fraction form first. H ( z) 1 A B = 2 = + z z − 2z + 2 z − (1+ j ) z − (1− j ) And H(z) will be

H ( z) =

zA Bz

+ z − (1+ j ) z − (1− j )

From this last expression for H(z) and using Table 4.1, we get

h ( n) = A

( 2) e n

u(n) + B

jπ / 4n

( 2) e 2

− jπ / 4n

u(n)

where 2 is the magnitude of 1 − j and 1 + j and −π/4 is the phase of 1 − j. We still need to find A and B. We can use MATLAB to do that and to confirm some of the results that we arrived at (the magnitude and the phase of the poles). We will write the script EOCE4_17 to get mag _ r = 0.5000 0.5000 phase _ r = −1.5708 1.5708 mag _ p = 1.4142 1.4142 phase _ p = 0.7854  −0.7854

The impulse response is then

h ( n) = 0.5e −1.57 j

( 2) e n

u ( n) + 0.5e1.57 j

jπ / 4n

( 2) e n

u ( n)

− jπ / 4n

215

z-Transform and Discrete Systems

In this expression, we have two complex conjugate terms. The sum of two conju­ gate terms is two times the real part of the term. Thus, we write ⎡ h(n) = 2Real ⎢0.5e −1.57 j ⎣⎢ h(n) =

( 2 ) e n

jπ 4n

⎡ j ⎛⎜ ⎛⎜ π ⎞⎟ n−1.57⎟⎞ ⎤ n ⎝ ⎠ ⎠ ⎥= 2  Real ⎢e ⎝ 4 ⎥ ⎢ ⎦ ⎣

( )

⎤ ⎡ −1.57 j jπ ⎤ n e 4n ⎥ ⎥ = ( 2) Real ⎢e ⎥⎦ ⎢⎣ ⎦⎥

( 2 ) cos ⎛⎜⎝ π4 n − 1.57⎞⎟⎠ u(n) n

EOCE 4.18 Consider the system y ( n) − .4y ( n − 1) = x ( n) ⎛ 2π ⎞ n u ( n) . What are the initial and final values for y(n) with x(n) with x ( n) = 2sin ⎜ ⎝ 4 ⎟⎠ as the input? SOLUTION With ⎛ 2π ⎞ x ( n) = 2sin ⎜ n u ( n) ⎝ 4 ⎟⎠ X(z) is X ( z) =

(

(

2z −1 sin ( π/4 )  

)

)

1− 2 cos ((π /4)) z −1 + z −2

=

2z sin(π / 4) 2 = z 2 − ( 2cos(π / 4)) z + 1 z 2 − 2z + 1

We know that Y(z) = X(z)H(z). But from the difference equation, H(z) is H ( z) =

1 z = 1− .4 z −1 z − .4

Y ( z) =

z 2z z − .4 − 2z + 1

Therefore,

The initial value of y(n) is y(0). Using the initial-value theorem, we can find y(0) without solving for y(n) from Y(z): y ( 0 ) = lim Y ( z ) = 0 z →∞

216

Discrete Signals and Systems with MATLAB®

The final value of y(n) is y ( ∞ ) = lim ( z − 1) z→1

z 2z z − .4 z 2 − 2z + 1

provided that all poles of (z − 1) Y(z) lie inside the unit circle. This is not the case here because the input is a pure sinusoid and it has its pole on the unit circle. Without paying attention to this, we may mistakenly use this theorem and write y ( ∞ ) = lim ( z − 1) z→1

(

)

2/ 2 z z =0 2 z − .4 z − 2z + 1

But we know that the output y(n) is also sinusoidal and does not settle on a single value as n approaches infinity. However, if x(n) = u(n) then Y ( z) =

z z z − 1 z − .4

and z2 =1 z→∞ ( z − 1)( z − .4 )

y ( 0 ) = lim The final value in this case will be y ( ∞ ) = lim ( z − 1) z →1

z z 1 1 10 = = = z − 1 z − 0.4 1− .4 .6 6

EOCE 4.19 Consider the system in Figure 4.11. 1. 2. 3. 4.

Find the transfer function representation. Find the difference equation representation. Find y(n) if x(n) = u(n). Is the system stable?

FIGURE 4.11

System for EOCE 4.19.

217

z-Transform and Discrete Systems SOLUTION 1. The signal after the first summer is X(z) + Y(z). This signal then passes through a delay and becomes [X(z) + Y(z)] z−1. Then it passes through another delay and becomes [[X(z) + Y(z)] z−1] z−1. The output of the last summer is Y(z) which is −1 −1 −2 −2 Y ( z ) = 2X ( z ) + ⎣⎡ ⎡X ⎣ ( z ) + Y ( z ) ⎤⎦ z ⎦⎤ z = 2X ( z ) + X ( z ) z + Y ( z ) z

By grouping like terms, we arrive at Y ( z ) ⎣⎡1− z −2 ⎦⎤ = X ( z ) ⎣⎡ 2 + z −2 ⎤⎦ And the transfer function is Y ( z) 2 + z −2 2z 2 + 1 = 2 = H ( z) = 1− z −2 z −1 X ( z) 2. From Y ( z ) 2 + z −2 = X ( z ) 1− z −2 we can write Y ( z ) ⎡⎣1− z −2 ⎤⎦ = X ( z ) ⎡⎣ 2 + z −2 ⎤⎦ The inverse transform is y ( n) − y ( n − 2) = 2x ( n) + x ( n − 2) 3. If x(n) = u(n) then X(z) = z/(z − 1). The output then is Y ( z) =

z2 + 2 z z2 − 1 z − 1

Y ( z) z2 + 2 z2 + 2 A B C = 2 = = + + z (z − 1)( z − 1) (z − 1)2( z + 1) z + 1 ( z − 1)2 z − 1 The constants are found next.

A=

B =

C =

z2 + 2 (z − 1)2 z2 + 2 z +1

= z=−1

= z=1

1+ 2 3 = 4 4

3 2

d 2z( z + 1) − (z 2 + 2) (B( z )) = dz (z + 1)2

= z=1

4−3 1 = 4 4

218

Discrete Signals and Systems with MATLAB® Therefore, the output in the z-domain is Y ( z) =

(3/4 ) z + (3/ 2) z + (1/4 ) z z +1 ( z − 1)2 z − 1

The output in the time domain is y ( n) =

3 3 1 ( −1)n u ( n) + (1)n nu ( n) + (1)n u ( n) 4 2 4

This solution can be verified using MATLAB as in the script EOCE4_19. The plots are in Figure 4.12. 4. To check stability, we look at the poles of H ( z) =

z2 + 2 z2 + 2 = 2 z − 1 ( z − 1)( z + 1)

We can see that the poles are at z = 1 and z = −1 and they are on the unit circle. Hence, the system is on the verge of stability.

FIGURE 4.12 Signals for EOCE 4.19.

219

z-Transform and Discrete Systems

FIGURE 4.13 Signals for EOCE 4.20.

EOCE 4.20 Consider the system in Figure 4.13, with H1 ( z ) = 1. 2. 3. 4.

z = H2 ( z ) z − .5

Find the transfer function. Is the system stable? Find the general form of h(n) if h(n) is real and causal. If x(n) = u(n), what is y(n)? SOLUTION

1. From the Figure 4.13 we see that the output is

y ( n) = ⎡⎣ x ( n) * h1 ( n) ⎤⎦ * h2 ( n) + x ( n) * h2 ( n)



and from the properties of the z-transform we write Y(z) as Y ( z ) = X ( z ) H1 ( z ) H2 ( z ) + X ( z ) H2 ( z ) = X ( z ) ⎡⎣H1 ( z ) H2 ( z ) + H2 ( z ) ⎤⎦ and the transfer function is Y ( z) = H ( z ) = H1 ( z ) H2 ( z ) + H2 ( z ) X ( z) By substituting the individual transfer functions given to us, we arrive at H ( z) =

z 2 + z ( z − .5) 2z 2 − .5z z ( 2z − .5) z z z + = = = z − .5 z − .5 z − .5 ( z − .5)2 ( z − .5)2 ( z − .5)2

2. The poles are at z = .5 and they are within the unit circle. This means that the system is stable.

220

Discrete Signals and Systems with MATLAB® 3. Since we are assuming that h(n) is real and causal,

H ( z) 2z − .5 c1 c 2

= 2 = 2 + z z − .5 z − .5 z − .5 ( ) ( ) and H ( z) =

zc1

( z − .5)2

+

zc 2

z − .5

With the help of Table 4.1, we get

h ( n) = c1n (.5) u ( n) + c 2 (.5) u ( n) n

n



This means that the ROC for H(z) is |z| > .5. If the ROC for H(z) were |z| < .5, then h ( n) = c3n (.5) ( −n − 1) + c4 (.5) u ( − n − 1) n

n

4. If the input x(n) = u(n), then X(z) = z/(z − 1) and

⎡ z ⎤

Y ( z ) = [H1( z )H2( z ) + H2( z )] ⎢ ⎣ z − 1⎥⎦ z z z z Y ( z) = + (z − .5)2 z − 1 z − .5 z − 1

Let us write the output as the sum

Y ( z ) = Y1 ( z ) + Y2 ( z ) and perform partial fraction expansion as

Y1( z) z c1 c2 c

= = + + 3 z (z − .5)2( z − 1) (z − .5)2 z − .5 z − 1 z c4 Y2( z ) c = = + 5 z (z − .5)( z − 1) z − .5 z − 1 Next, we find the constants as c1 =

z 1/ 2 = = −1 z − 1 1/ 2 1/ 2 − 1

c2 =

d c1( z) dz

z c3 = (z − .5)2

= z=1/ 2

z − 1− z (z − 1)2

1 = =4 1/4 z=1

= 1/ 2

−1 −4 1/4

221

z-Transform and Discrete Systems and

1

z 2 c4 = = = −1 1 z − 1 z= 1 − 2 2 c5 =

z z − .5

= z =1

1 =2 1− .5

The output in the z-domain is then

Y ( z) =

−1z

( z − .5)2



4z 4z 1z 2z

+ − + z − .5 z − 1 z − 0.5 z − 1

The output in the time domain is

y ( n) = −n (.5) u ( n) − 4 (.5) u ( n) + 4u ( n) − (.5) u ( n) + 2u ( n) n

n

4

EOCE 4.21 If x(n) = δ(n) + δ(n − 3) and the output y(n) is δ(n − 4), what is the transfer function H(z)? Assume the system is linear and time invariant. SOLUTION We know that y(n) = x(n) * h(n) in the discrete time domain. Mathematically, y ( n) =

+∞

∑ x ( m) h ( n − m)

m=−∞

An easier way of finding H(z) is to work directly with the z-domain by taking advantage of the convolution property of the z-transform Y ( z) = H ( z) X ( z) After substitution, we get z −4 = H ( z ) ⎡⎣1+ z −3 ⎤⎦ and finally H ( z) =

z −4 1 1 = 4 = −3 3 1+ z z + z z z +1

(

)

222

Discrete Signals and Systems with MATLAB®

4.15 END-OF-CHAPTER PROBLEMS EOCP 4.1 Find the z-transform for the following signals and indicate the ROC. 1. x(n) = 3(.3)nu(n) 2. x(n) = (.3)nu(n) − (.3)nu(n − 1) 3. x(n) = u(n) − u(n − 1) π n−1 4. x ( n ) = sin ⎛⎜ n ⎟⎞ u ( n ) + (.3) u ( n − 1) ⎝ 3⎠ 5. x(n) = u(n) * (.5)nu(n) 6. x(n) = u(n) * (.5)nu(n) * (.5)n−1u(n − 1) 2π ⎞ 7. x ( n ) = nu ( n ) − n sin ⎜⎛ n u (n) ⎝ 3 ⎟⎠ 8. x(n) = (n − 1) u(n − 1) − 2δ(n − 1) π 9. x ( n ) = u ( − n − 1) * u ( n ) + ( n − 1) sin ⎛ ( n − 1) ⎞ u ( n − 1) ⎝ 4⎠ n 10. x(n) = n(.5) sin(n) u(n) + u(−n − 1) EOCP 4.2 Consider the following signals in the z-transform domain. Find h(n) for each case. 1. H ( z ) = 10

z ROC : z < .5 z − .5

z2 + z + 2   ROC : .1 < z < 3 ( z − 3)( z + 3)( z − .1) z +1 3. H ( z ) = ROC : z > .5 (z − .5)( z − .5) z +1 4. H ( z ) =   ROC : .3 < z < .5 (z − .5)2 ( z − .3)

2. H ( z ) =

5. H ( z ) =

( z − 1)( z + 1) z

ROC : z > 0

EOCP 4.3 The following signals will produce a causal h(n). Find h(n) using partial fraction, long division, and MATLAB. 1. H ( z ) =

1 z ( z − 1)

2. H ( z ) =

1 z ( z − 1)

z-Transform and Discrete Systems

3. H ( z ) =

z2 + z + 1 z 2 + 5z + 6

4. H ( z ) =

z +1 z + 2z + 4

5. H ( z ) =

z 3 + z 2 + z + 1

z

6. H ( z ) =

z 2 + 1

z 3 + 2z 2 + 4z

2

EOCP 4.4 Draw the block diagrams for the following systems in the z-domain. 1.

1 Y (z) = 2 X ( z ) z ( z − 1)

2.

Y (z) z2 + z = 2 X ( z ) z + 5z + 6

3.

Y (z) z 2 + z + 1

= 2 X ( z ) z + 2z + 2

4.

Y ( z ) z 2 + 2z + 1 = z

X (z)

5.

Y (z) z

= 2 X ( z ) z + 2z + 1

EOCP 4.5 Find Y(z)/X(z) for the block diagrams in Figures 4.14–4.18.

FIGURE 4.14 Block for EOCP 4.5.

FIGURE 4.15

Block for EOCP 4.5.

223

224

Discrete Signals and Systems with MATLAB®

FIGURE 4.16 Block for EOCP 4.5.

FIGURE 4.17 Block for EOCP 4.5.

FIGURE 4.18 Block for EOCP 4.5.

EOCP 4.6 For each block diagram in Figures 4.19–4.23, find y(n), the step response.

FIGURE 4.19

Block for EOCP 4.6.

FIGURE 4.20 Block for EOCP 4.6.

z-Transform and Discrete Systems

225

FIGURE 4.21 Block for EOCP 4.6.

FIGURE 4.22 Block for EOCP 4.6.

FIGURE 4.23 Block for EOCP 4.6.

EOCP 4.7 Consider the following transfer functions. Find the difference equations representing these systems and indicate if any of them is stable. Use MATLAB to find h(n). 1. H ( z ) =

z + 2

z + 2z + 5

2. H ( z ) =

z + 2

z 3 + 2z 2 + 5z

2

1

2z − 1 ( z − .1)

3. H ( z ) =

(

4. H ( z ) =

z 2 + z + 1

z 2 + .2 z

(

5. H ( z ) =

1

z + 3z + 2z + 1

3

)

)

3

2

226

Discrete Signals and Systems with MATLAB®

EOCP 4.8 Consider the following difference equations. Find the transfer functions and the out­ puts y(n). Are the systems stable? 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

y(n) − .5y(n − 1) = x(n) + x(n − 1), y(−1) = 0, x(n) = δ(n) y(n) − .5y(n − 1) = x(n) + x(n − 1), y(−1) = 1, x(n) = δ(n) y(n) − .5y(n − 1) = x(n) + x(n − 1), y(−1) = 0, x(n) = sin(2π/1n)u(n) y(n) − .3y(n − 1) = x(n) + x(n − 1), y(−1) = −1, x(n) = sin(2πn/3) u(n) + cos(2πn/3)u(n) y(n) − .8y(n − 1) +. 2y(n − 2) = x(n), y(−1) = 0, y(−2) = 1, x(n) = δ(n) y(n) − .8y(n − 1) +. 2y(n − 2) = x(n − 1), y(−1) = 1, y(−2) = 1, x(n) = u(n) y(n) + y(n − 1) + y(n − 2) = x(n), y(−1) = y(−2) = 0, x(n) = u(n) y(n) + .1y(n − 2) = x(n − 2), y(−1) = y(−2) = 1, x(n) = u(n) y(n) − .5y(n − 3) = x(n), y(−1) = y(−2) = 0, y(−3) = 1, x(n) = δ(n) y(n) = x(n) + x(n − 1) + x(n − 2) + x(n − 3), x(n) = sin(n)u(n)

EOCP 4.9 The following are outputs of linear discrete systems. Find y(0) and y(∞) for each output. 1. Y ( z ) =

z z − 10

2. Y ( z ) =

z 2 + z

z 2 + 2z + 1

3. Y ( z ) =

z 2 + 2z + 1

( z − 1)( z + 2 )

4. Y ( z ) =

z 2 + 3z + 1 ( z − .1)( z − .2 )( z − .3)

5. Y ( z ) =

z z

+ z − 1 ( z − 1)2

EOCP 4.10 Find the steady-state output for the systems: 1. H ( z ) =

1 x ( n ) = sin ( n ) u ( n ) + cos ( n ) u ( n ) z − .5

2. H ( z ) =

1

⎛ 2π ⎞

  x ( n ) = sin ⎜ n u (n) ⎝ 3 ⎟

⎠ ( z − .2 )( z − .3)

3. H ( z ) =

z + 1

x ( n ) = 10 z

z-Transform and Discrete Systems

4. H ( z ) =

z +1 x (n) = δ (n) + u (n) z 2

5. H ( z ) =

z 2 + z + 1

x (n) = 3 z

227

EOCP 4.11 Consider the following difference equation: y ( n ) − .5 y ( n − 1) − .3 y ( n − 2 ) − .4 y ( n − 3) = x ( n ) 1. With y(−1) = y(−2) = y(−3) = 0 and a. x(n) = δ(n) b. x(n) = u(n) c. x(n) = cos(10πn/3)u(n) Use MATLAB to find y(n) assuming that y(n) is causal; use long division to verify the MATLAB results. 2. Is the system stable? 3. Find h(n) if ROC is |z| > 2. EOCP 4.12 Consider the system in Figure 4.24. 1. 2. 3. 4.

Find the difference equation representing the system. For what value(s) of a is the system stable? Pick a value for a to make the system stable, and find y(n) for x(n) = δ(n) Use MATLAB to find y(n) for a = .5 if a. x(n) = 10 δ(n) b. x(n) = 10 sin(3n/4π)u(n) 5. Find the initial and final values for y(n) in part 4.

FIGURE 4.24 Block for EOCP 4.12.

228

Discrete Signals and Systems with MATLAB®

FIGURE 4.25 Block for EOCP 4.13.

EOCP 4.13 Consider the following system in Figure 4.25. 1. 2. 3. 4. 5. 6.

Find Y(z)/X(z) as a function of F(z), the feedback function. If F(z) =1, find Y(z)/X(z). Is the system stable in 2? If yes, for what k values? If F(z) = z/(z − .2), find Y(z)/X(z). Is the system stable in 4? If yes, for what k values? Find the difference equation representing the system for both cases F ( z ) = 1 and F ( z ) = z /( z − .2).

7. Find the impulse response of the system when F(z) = 1 and F(z) = z/(z − .2) with a value of k that makes the system stable. 8. Find the step response for both F(z) = 1 and F(z) = z/(z − .2) with a k value that stabilizes the system. 9. Let E(z) = X(z) − F(z) Y(z). Find this error signal E(z) as a function of k. 10. Find e(0) and e(∞). e(n) is called the error signal. 11. What value for k will make e(∞) = .1? Pick a suitable input x(n) that will give you this k value. EOCP 4.14 The outputs and the inputs are given for an unknown linear time-invariant system. What is the transfer function for each? 1. x(n) = δ(n) + δ(n − 1) + δ(n − 2)

y(n) = δ(n − 1) + δ(n − 2) + δ(n − 3)

2π ⎞ 2. x ( n ) = sin ⎜⎛ n u (n) ⎝ 3 ⎟⎠ 2π ⎞ y ( n ) = cos ⎛⎜ n u (n) ⎝ 3 ⎟⎠ 3. x(n) = u(n)

y(n) = nu(n)

z-Transform and Discrete Systems

4. x(n) = δ(n)

y(n) = u(n)

⎛ 3π ⎞ n ⎟ u ( n ) + u ( n )  5. x ( n ) = 2sin ⎜ ⎝ 11 ⎠

⎛ 3π ⎞

y ( n ) = 10 cos ⎜ n u (n) ⎝ 11 ⎠⎟

229

5 5.1

Discrete Fourier Transform and Discrete Systems

INTRODUCTION

We have two types of linear systems: the continuous linear system and the discrete linear system. The Fourier transform of the continuous signal x(t) is +∞

X ( w) =

∫ x (t ) e

− jwt

dt

(5.1)

−∞

By observing the signal x(t) in the frequency domain, we are able to see all the fre­ quencies that x(t) contains, and based on that we can further process the signal x(t) and alter its frequency components in any way we wish. But the Fourier transform Equation (5.1) is not suitable for computer evaluation since the bounds on the integral are infinite. By discretizing the signal x(t) and obtaining the discrete signal x(n), we can Fourier transform the signal x(n) into the frequency domain in order to see its frequency components hoping that we can utilize the computer in all calculations. The Fourier transform of the signal x(n) is

( )

+∞

X e jθ =

∑x ( n) e

− jθn

(5.2)

−∞

where θ is the digital frequency and is related to the continuous frequency by the equation θ = wTs

(5.3)

where Ts is the sampling period used to sample x(t) to get x(n). x(n) now is discrete but is of infinite duration and, again, it is not possible to evaluate X(ejθ) on the computer. This problem will be discussed next.

231

232

Discrete Signals and Systems with MATLAB®

5.2 DISCRETE FOURIER TRANSFORM AND THE FINITE-DURATION DISCRETE SIGNALS Continuing with the earlier discussion, let us assume that x(n) is zero for all the inte­ ger n values less than zero, and for n greater than or equal to some integer value N. In other words, suppose x(n) = 0 for n < 0 and n ≥ N. Then we can define the N-points Fourier transform for the truncated x(n) as X (k ) =

N −1

∑x ( n) e

− j 2 πnk /N

k = 0, 1, … , 1N −

(5.4)

n=0

Equation (5.4) is the discrete Fourier transform (DFT) of the finite duration signal x(n). In this defining equation, 1. 2. 3. 4.

x(n) in the truncated signal that is zero for n < 0 and n ≥ N. N is the length of the truncated signal x(n). n is the index for the samples in x(n). k is the frequency index for the DFT.

We can see in Equation (5.4) for the DFT that X(k) is finite, x(n) is finite, and the number of points in x(n) is the same as the number of points in X(k). Now it is easy to implement the DFT equation using the computer. To go back to the discrete time signal x(n) from the X(k) values, we use the inverse relation x (n) =

1 N

N −1

∑X ( k ) e

− j 2 πnk /N

n = 0, 1, …, N − 1

(5.5)

k =0

Example 5.1 Consider the discrete signal given by x ( 0 ) = 1 and 1x ( ) = 0 Find the DFT of x(n) and do the inverse DFT to obtain x(n) from X(k) for n = 0, 1. SOLUTION In this example, N is 2 and X(k) is X (k ) =

1

∑x (n) e n=0

1

− j 2πnk /N

=

∑x (n)(W ) n

n=0

nk

233

Discrete Fourier Transform and Discrete Systems

Before we evaluate X(k), let us look at the defining equation for X(k). We have substituted WN = e −j2π/N in Equation (5.5) where WNnk = e − j 2πnk /N = (WN )

nk

Based on this relation, in this example we have WN = W2 = e − j 2π / 2 = e − jπ = cos ( π ) − j sin ( π ) = −1 Now by expanding the X(k) equation, we get

X ( 0 ) = x ( 0 )( −1) + x (1)( −1) = 1

0

0

X (1) = x ( 0 )( −1) + x (1)( −1) = 1 0

1

To calculate x(n) from X(k), we use the inverse relation

x ( n) =

1 N

1

∑X (k ) e

j 2πnk /N

k =0

to get

x (0) =

1 1 1 1

X ( 0 ) e jπ0 + X (1) e jπ0 = (1) + (1) = 1 2 2 2 2

and

x (1) =

1 1 1 1

X ( 0 ) e jπ0 + X (1) e jπ = (1) + (1)( −1) = 0 2 2 2 2

5.3 PROPERTIES OF THE DFT Following are some of the characteristics that the DFT possesses (Table 5.1).

TABLE 5.1 Some Properties of the DFT Linearity Time shifting Frequency shifting Modulation

αx1(n) + βx2(n) ↔ αX1(k) + βX2(k) x(n − m) ↔ X(k)e−j2πkm/N x(n)ej2πnm/N ↔ X(k − m) 1 x1 (n) x 2 (n)  ↔ (X1 k ) ⊗ X 2 ( k ) N

Circular convolution

x1(n) ⊗ x2(n) ↔ X1(k)X2(k)

Parseval’s theorem

∑ x (n)

N −1

k =0

Duality ⊗

indicates circular convolution.

2

=

1 N

N −1

∑ X (k ) k =0

1 X (n) ↔ x (− k ) N

2

234

Discrete Signals and Systems with MATLAB®

FIGURE 5.1 Correlation signals for the DFT.

5.3.1

How Does tHe Defining equation work?

If we look at the defining equation in its trigonometric form, we have X (k ) =

N −1

⎛ 2πnk ⎞ ⎤ ⎞− ⎟ ⎟ j sin ⎝⎜ ∑x ( n) ⎡⎢⎣cos ⎛⎝⎜ 2πnk N ⎠ N ⎠ ⎥⎦

(5.6)

n=0

You can see that each component of X(k) is a correlation of all the samples in x(n) with cosine and sine signals that have k complete periods in the N samples interval. This can be seen in the example that we considered earlier, Example 5.1, where with N = 2 X (k ) =

1

∑x ( n)[ cos( πnk ) − j sin ( πnk )] n=0

If we plot cos(πnk) or sin(πnk) on a fine grid, we will observe a complete cycle for k = 1 and 2 cycles for k = 2 in the N = 2 interval. This can be seen in Figure 5.1.

5.3.2 Dft symmetry For a real x(n) signal, the DFT is symmetrical around the point k = N/2. The magni­ tude of X(k) will have even symmetry and the phase of X(k) will have odd symmetry. To see this, we can show that X (k ) = X (N − k )

235

Discrete Fourier Transform and Discrete Systems

and that the phase of X(k) is the negative of the phase of X(N − k). The magnitude of X(k) is X (k ) =

N −1

∑x ( n) e

− j 2 πn / N

n=0

and the magnitude of X(N − k) is X (N − k) =

N −1

∑x ( n) e

− j 2 πn( N − k ) / N

N −1

=

n=0

∑x ( n) e

j 2πn / N

n=0

since e = 1. To look at this in a different way, we have −j2πnN/N

X (K ) =

N −1

⎛ 2πn ⎞ ⎤ ⎞− ⎟ ⎟ j sin ⎜⎝ ∑x ( n) ⎡⎢⎣cos ⎜⎛⎝ 2πn N ⎠ N ⎠ ⎥⎦ n=0

But X (k ) = X (N − k )

if  Real  [ X ( k )] = Real [ X ( N − k )]

Real [ X ( k )] =

N −1

⎞ ⎟ ∑x (n) cos ⎜⎝⎛ 2πn N ⎠ n=0

and Real [ X ( N − k )] =

N −1

∑x ( n) cos ⎜⎝⎛ 2πn (NN − k ) ⎟⎠⎞ n=0

We also know that 2πn ⎞ ⎛ ⎛ −2πn ⎞ = cos ⎛ 2πn ⎞ cos ⎜ 2πn − ⎟ = cos ⎜⎝ ⎟ ⎜⎝ ⎟ ⎝ N ⎠ N ⎠ N ⎠ Thus, Real [ X ( k )] = Real [ X ( N − k )] and consequently X (k ) = X (N − k ) To show that ∠X ( k ) = −∠X ( N − K )

236

Discrete Signals and Systems with MATLAB®

we need to show that the imaginary Imag [ X ( k )] = −Imag ⎡⎣( X ( N − K )) ⎤⎦ But Imag [ X ( k )] = −

N −1

⎞ ⎟ ∑x ( n) sin ⎝⎛⎜ 2πnk N ⎠ n=0

and Imag [ X ( N − k )] = −

N −1

∑x ( n) sin ⎛⎜⎝ 2πn ( N N− k ) ⎞⎟⎠ n=0

But again 2πnk ⎞ ⎛ −2πnk ⎞ = −sin ⎛ 2πnk ⎞ sin ⎜⎛ 2πn + − ⎟ = sin ⎜⎝ ⎟ ⎜⎝ ⎟ ⎝ N ⎠ N ⎠ N ⎠ Thus, Imag [ X ( N − k )] =

N −1

⎞ ⎟ ∑x ( n) sin ⎜⎝⎛ 2πnk N ⎠ n=0

Therefore, Imag [ X ( k )] = −Imag ⎡⎣( X ( N − k )) ⎤⎦ and thus ∠X ( k ) = −∠X ( N − k )

5.3.3 Dft Linearity Given the signal X ( n ) = αx1 ( n ) + βx 2 ( n ) the DFT of x(n) is then X ( k ) = αX1 ( k ) + βX 2 ( k ) To see this result, we have X (k ) =

N −1

∑ n=0

(αx1 ( n ) + βx2 ( n )) e− j 2πnk / N = α

N −1

∑ n=0

x1 ( n ) e − j 2 πnk / N + β

N −1

∑x ( n) e

2

n=0

− j 2 πnk / N

Discrete Fourier Transform and Discrete Systems

237

Finally, we have X ( k ) = αX1 ( k ) + βX 2 ( k ) This linearity property is very important because we usually have signals that have more than one frequency component.

5.3.4 magnituDe of tHe Dft If we are calculating the DFT of the signal x(n) that was obtained by taking N sam­ ples of a real sinusoid of amplitude Mr, then the magnitude of the DFT is X (k ) =

Mr N 2

If the N samples in x(n) were obtained by sampling a complex sinusoid of the form x ( t ) = M c [ cos ( wt ) + j sin ( wt )] = M c e jwt then X ( k ) = Mc N If, however, x(n) has a dc component Md, then X ( k ) = Md N In this relation, the input to the DFT system should have a sinusoidal component that makes an integer number of periods over the N samples.

5.3.5 wHat Does k in X(k), tHe Dft, mean? After we calculate the DFT of the signal x(n), which is usually sample of the continu­ ous signal x(t), we may be interested in the value of the frequency when the magni­ tude of X(k) is maximum. The plot of |X(k)| is usually drawn versus the frequency index k. The distance between the successive values of k is given by the frequency resolution fs/N, where fs is the sampling frequency. If the maximum value of |X(k)| is at k = km, for example, then the frequency at which |X(k)| is maximum is kmfs/N Hz. If we let Δf = fs/N be the frequency resolution, then we have Δf =

fs 1 1 = = N NTs Tr

where Tr is the time interval along which the samples are taken.

(5.7)

238

Discrete Signals and Systems with MATLAB®

Example 5.2 Consider the magnitude DFT of the signal x(n) that was obtained by sampling a continuous sinusoid at fs = 1000 Hz, as shown in Figure 5.2. 1. What is the frequency at which |X(k)| is maximum? 2. What is the frequency at which |X(k)| is minimum? 3. If only the value at k = 2 is known for |X(k)|, can you find |X(3)|? SOLUTION 1. From the plot we see that |X(k)| is maximum at k = 0 and k = 4 and that N = 4. Thus, we have km fs/N = 0(1000)/4 = 0 Hz and 4(1000)/4 = 100 Hz as the two frequencies. 2. The minimum magnitude is at k = 1, 2, and 3. Thus, 1(1000 ) = 250 4

2 (1000 ) = 500 4

3 (1000 ) = 750 Hz 4

are the frequencies. 3. With only X(2) known, we have N 4 = =2 2 2 Thus, from the symmetry property, we would not know X(3). There is no need to use the value at k = 4 since the magnitude is periodic.

FIGURE 5.2 Signal for Example 5.2.

239

Discrete Fourier Transform and Discrete Systems

5.4 RELATION THE DFT HAS WITH THE FOURIER TRANSFORM OF DISCRETE SIGNALS, THE z-TRANSFORM, AND THE CONTINUOUS FOURIER TRANSFORM 5.4.1

Dft anD tHe fourier transform of x(n)

Given x(n) for −∞ ≤ n ≤ +∞. The Fourier transform is defined as +∞

( )

X e jθ =

∑x ( n ) e

− jθn

n=−∞

where θ = wTs, w is the continuous radian frequency and Ts is the sampling interval used to sample x(t) to get x(n). If the signal x(n) is truncated and is limited to the lower n = 0 and the upper n = N − 1 interval, where N is some integer value, then N −1

( )

X e jθ =

∑x ( n) e

− jθn

n=0

Now if we let θ=

2πk N

we will have

(

N −1

)

X e j 2πk / N =

∑x ( n) e

− j 2 πkn / N

n=0

But the term 2πk/N is a function of k only since N is known. Thus, we can write X (k ) =

N −1

∑x ( n) e

− j 2 πkn / N

( )

= X e jθ

n=0

θ= 2 πk / N

(5.8)

Equation (5.8) is nothing but the DFT of the finite signal x(n) defined for n = 0, 1, …, N − 1. Therefore, from this development you can see that if x(n) is limited to the interval n = 0, 1, …, N − 1, and X(ejθ) is sampled starting at values of θ = 0 and then regularly spaced along the unit circle by 2πk/N, the DFT will be the sampled version of X(ejθ).

5.4.2

Dft anD tHe z-transform of x(n)

The z-transform for a finite length signal x(n) is X (z) =

N −1

∑x ( n) z n=0

−n

240

Discrete Signals and Systems with MATLAB®

where N is the number of samples in x(n). If we set z = ej2πk/N, then

(

N −1

)

X e j 2πk /N =

∑x ( n) e

− j 2 πnk /N

n=0

But again, the term 2πk/N is a function of k only since N is known. Thus, we can write X (k ) =

N −1

∑x ( n) e

− j 2 πnk /N

= X (z)

n=0

5.4.3

(5.9) z=e

j 2πnk /N

Dft anD tHe Continuous fourier transform of x(t)

Consider the signal x(t) that is assumed to be zero for t < 0. The Fourier transform of x(t) is ∞



X c ( w ) = x ( t ) e − jwt dt 0

Let Ts be a small positive number. Then the previous equation can be approximated as Xc ( w ) =

∞ nTs +Ts

∑∫ n =0

2Ts

Ts

x (t ) e

− jwt



dt = x ( t ) e

− jwt

dt +

0

nTs

∫ x (t ) e

− jwt

dt + …

Ts

In the interval nTs ≤ t ≤ nTs + Ts, if Ts is chosen small enough such that x(t) in this interval will be considered constant, then Xc ( w ) =

∞ Ts

∑ ∫e

− jwt

dtx ( nTs )

n=0 0

With nTs + Ts



e − jwt dt =

nTs

e − jwtTs − e −(1+n ) jwTs jw

we have Xc ( w ) =

1 − e − jwTs jw



∑e n=0

− jwnTs

x ( nTs )

241

Discrete Fourier Transform and Discrete Systems

If x(nTs) is very small for n ≥ N, then the continuous Fourier transform can be simpli­ fied further as 1 − e − jwTs Xc ( w ) = jw

N −1

∑e

− jwnTs

x ( nTs )

n=0

If we set w = 2πk/NTs, we will have ⎛ 2πk ⎞ 1 − e − jwTs = Xc ⎜ ⎟ ⎝ NTs ⎠ j ( 2πk /NTs )

N −1

∑e

− j 2 πkn /N

x ( nTs )

n=0

But N −1

∑e

− j 2 πnk /N

x ( nTs ) = X ( k )

n=0

which is the DFT of x(nTs). Thus, the continuous Fourier transform can be approxi­ mated at (2π/NTs)k points, where k = 0, 1, …, N − 1. Finally, we write ⎛ 2πk ⎞ 1 − e − jwTs = X (k ) Xc ⎜ ⎟ ⎝ NTs ⎠ j ( 2πk /NTs )

(5.10)

Example 5.3 Consider the signal x(n), where x(0) = 1, x(1) = 0, and x(2) = 1. Use the z-transform method to find X(k). SOLUTION This signal can easily be put in the z-domain. It is X ( z ) = 1z −0 + 0z −1 + 1z −2 = 1+ z −2 With z = ejθ, we have

( )

X e jθ = 1+ e −2 jθ But

( )

X ( k ) = X e jθ

θ= 2πk /N

242

Discrete Signals and Systems with MATLAB®

With N = 3 as is the case in this example, we have X ( k ) = 1+ e −2 j ( 2πk / 3) with X ( 0 ) = 1+ e −2 j (0) = 2 X (1) = 1+ e −2 j ( 2π / 3) X ( 2) = 1+ e −2 j ( 2π 2/ 3) = 1+ e − j (8π / 3) Using the defining equation of the DFT, we have X (k ) =

N−1

∑x (n) e n=0

2

−2 jπnk /N

=

∑x (n)(W ) N

nk

n=0

with e − j 2π / N = e − jπ 2/ 3 With this simplification, we can get the first few samples of the DFT. X ( 0 ) = x ( 0 ) e − j 2π / 3(0) + x (1) e − j 2π / 3(0) + x ( 2) e − j 2π / 3(0) = 2 X (1) = x ( 0 ) e − j 2π / 3(0) + x (1) e − j 2π / 3(1) + x ( 2) e − j 2π / 3( 2) = 1+ e − j 4 π / 3 X ( 2) = x ( 0 ) e − j 2π / 3(0) + x (1) e − j 2π / 3( 2) + x ( 2) e − j 2π / 3( 4) = 1+ e − j8π / 3

5.5

NUMERICAL COMPUTATION OF THE DFT

The DFT is a computer program that can be used to transform the signal x(n) defined for n = 0, 1, …, N − 1, where N is the number of samples in x(n), to X(k), a set of N values defined for the frequency index k = 0, 1, …, N − 1. In other words, the DFT can be thought of as a system (a computer program) whose input is x(n) and whose output is X(k). To implement the DFT equation on a digital computer, MATLAB® will be used. To do that, we will try to find the DFT of the signal in Example 5.3, where x(0) = 1, x(1) = 0, and x(2) = 1. The MATLAB script XFromx_n is used. And the results are the same as those obtained in Example 5.3, where x(0) = 2, x(1) = 1 + e-j4n/3, and x(2) = 1 + e-j8n/3. To find x(n) from X(k), we use the inverse DFT and write the MATLAB script x_nFromX. The results are again similar to the original signal x(n), with x(0) = 1, x(1) = 0, and x(2) = 1.

243

Discrete Fourier Transform and Discrete Systems

5.6 FAST FOURIER TRANSFORM: A FASTER WAY OF COMPUTING THE DFT If we look at the following equation to calculate X(k) from x(n): X (k ) =

N −1

∑x ( n) e

− j 2 πnk / N

n=0

we can see that to evaluate X(k) for a single k value we need to perform N multi­ plications. Yet to calculate the N values for k we will need N2 multiplications. The goal is to reduce this number of multiplications. For that reason, the fast Fourier transform (FFT), a fast way of computing the DFT, was developed in which the number of multiplications N2 was reduced to N(log2N)/2 multiplications. Thus, if N = 1024, for example, it will take 10,48,576 multiplications using the DFT. Using the FFT, it will take 5120 multiplications, a drastic reduction in the number of multiplications. To see how this FFT was developed, let us look back at the DFT equation. We have X ( k ) =

N −1

∑x ( n) e

− j 2 πnk / N

n=0

If we define WN = e−j2π/N, then the DFT equation becomes X (k ) =

N −1

∑x ( n)W

nk

N

n=0

Here we will derive what is called the radix-2 FFT and use what is called decimation in time. The last equation can be written as X ( k ) =

( N / 2)−1

∑ x ( 2n)W

2nk N

n=0

( N / 2)−1

+

∑ x ( 2n + 1)W W k N

2nk N

n=0

With WNk not depending on the index n, this term can be pulled out and X(k) becomes X (k ) =

( N / 2)−1

∑ n=0

x ( 2n )WN2nk + WNk

( N / 2)−1

∑ x ( 2n + 1)W

2nk N

n=0

Notice that we are dividing x(n) into even and odd parts. Notice also that WN / 2 = e − j 2 π /( N / 2) = e − j2 π 2/ N = WN2

244

Discrete Signals and Systems with MATLAB®

With this observation, X(k) becomes X (k ) =

( N / 2)−1

( N / 2)−1

∑ x ( 2n)W

∑ x ( 2n + 1)W

+W

2nk N /2

k N

nk

N /2

n=0

Now consider X(k + (N/2)). With WN (/ 2 X(k + (N/2)) as

n k +( N / 2))

N X⎛k + ⎞ = ⎝ 2⎠

(5.11)

n=0

= WNnk/ 2 and WNk +( N / 2) = −WNk  we can write

( N / 2)−1

∑ x ( 2n ) W

( N / 2)−1

nk N /2

−W

k N

n=0

∑ x ( 2n + 1)W

2nk N /2

(5.12)

n=0

with X(k) repeated as X (k ) =

( N / 2)−1



k x ( 2n )WN2nk / 2 + WN

( N / 2)−1

n=0

∑ x ( 2n + 1)W

nk N /2

(5.13)

n=0

In Equation (5.13), we can find the first N/2 points. We can use Equation (5.12) for X(k + N/2) to find the other N/2. Notice that the last two equations are similar with only the sign of WNk reversed. To make things more clear, let us consider the case where N = 8, an 8-point DFT. With the last two equations, we can see that the 8-point DFT is reduced to the 4-point DFT. Remember that a 2-point DFT can be implemented without any complex mul­ tiplication. So if we subdivide the 4-point DFT further, we will get the 2-point DFT. In general, if we are given N samples of x(n) and are asked to find X(k), we will first subdivide the N-point DFT into N/2-point DFT. We continue with this process until we get to the 2-point DFT. The FFT is implemented in MATLAB and can be used directly to evaluate the DFT of the signal x(n). We need to remind the reader here that the FFT will give the same result as the DFT. The FFT is not an approximation to the DFT in any way. Also, the properties for the DFT will hold for the FFT.

5.7

APPLICATIONS OF THE DFT

We will look next at some of the important applications of the DFT.

5.7.1

CirCuLar ConvoLution

Let us look at the input–output relationship between the input x(n) and the output y(n) of the discrete linear system. y (n) = x (n) * h (n) =



∑ x (m) h (n − m)

m=−∞

245

Discrete Fourier Transform and Discrete Systems

where * indicates linear convolution. If we define the signals x(n) and h(n) to have zero values for n < 0 and n ≥ N, then the linear convolution relationship becomes y (n) =

2 N −1

∑x ( m ) h ( n − m ) m=0

But we can see that if n < 0 and n > 2N − 1, h(n − m) is zero. Hence y (n) = 0

for   n < 0 and 2n > N − 1

Notice that 2N − 1 is the length of the convolution result. However, y(n) is generally not zero for n ≥ N. Note also that if we take the N-points DFT of y(n), we will miss the nonzero values of y(n) as the result of the linear convolution. This indicates a need to define another form of convolution so that y(n) = x(n) * h(n) is zero for n < 0 and n ≥ N. To arrive at this conclusion in a different approach, let X(k), H(k), and Y(k) be the DFTs of the input x(n), the impulse response h(n), and the output y(n) of the linear discrete system. Let us claim now that Y (k ) = X (k ) H (k )

(5.14)

Does this mean that y (n) = x (n) * h (n) where * indicates convolution. Taking the inverse DFT of Y(k) = X(k)H(k) leads to y (n) =

1 N

N −1

⎡ N −1 ⎢ x ( m ) e − j 2 πmk / N ⎢ m=0 ⎣

∑∑ k =0

⎤ h ( p ) e − j 2 πpk / N ⎥ e j 2 πnk / N ⎥ p=0 ⎦

N −1



By rewriting the previous equation, we get 1 y (n) = N

N −1

N −1

N −1

m=0

p=0

k =0

∑x ( m ) ∑h ( p) ∑e

j 2πk ( n − m − p) / N

But with q as an integer, N −1

∑e k =0

j 2πk ( n − m − p ) / N

⎧⎪ N =⎨ ⎩⎪ 0

n − m − p = qN otherwise

246

Discrete Signals and Systems with MATLAB®

Thus, we can write N −1

∑e

j 2πk ( n − m − p ) / N

= Nδ ( n − m − p = qN )

k =0

where Nδ(n) is the impulse signal with a strength of N at n = 0 and a strength of zero for n ≠ 0. With the relation δ(n − m) f(n) = f(m), we can simplify the equation for y(n) to get y ( n ) =

N −1

∑x (m ) h ( n − m ) m=0

where h̃(n) is a periodic repetition of h(n). This equation is similar to the linear convolution equation when it is not limited to one period N. Based on what has been presented we will define circular convolution as y (n) =

N −1

∑x (m ) h ( n − m )

(5.15)

m=0

and use the notation y (n) = x (n) ⊗ h (n) to indicate circular convolution. With this result we can say now that circular convolution in the discrete domain is equal to multiplication in the DFT domain. That is, y (n) = x (n) ⊗ h (n) ↔ Y ( k ) = X ( k ) H ( k )

(5.16)

Example 5.4 Consider the signals x(n) and h(n), each of length N = 4. SOLUTION To calculate the output y(n) using circular convolution, we will write first the signals as ⎧ x ( n) = ⎨ x ( 0 ) x (1) ⎩

⎫ x ( 2) x ( 3) ⎬ ⎭

⎧ h ( n) = ⎨ h ( 0 ) h ( 3) ⎩

⎫ h ( 2) h (1) ⎬ ⎭

247

Discrete Fourier Transform and Discrete Systems The output y(n) will be of length 4 as well, and

y ( 0 ) = x ( 0 ) h ( 0 ) + x (1) h ( 3) + x ( 2) h ( 2) + x ( 3) h (1)

To find y(1) we will move (shift) the last value in h(n) and append it to the begin­ ning of the array h(n). The two arrays are now ⎧ x ( n) = ⎨ x ( 0 ) x (1) ⎩

⎫ x ( 2) x ( 3) ⎬ ⎭

⎧ h ( n) = ⎨ h (1) h ( 0 ) ⎩

⎫ h ( 3) h ( 2) ⎬ ⎭

and

y (1) = x ( 0 ) h (1) + x (1) h ( 0 ) + x ( 2) h ( 3) + x ( 3) h ( 2)



To find y(2), we will list the two arrays by again performing the same shifting to get ⎧ x ( n) = ⎨ x ( 0 ) x (1) ⎩

⎫ x ( 2) x ( 3) ⎬ ⎭

⎧ h ( n) = ⎨ h ( 2) h (1) ⎩

⎫ h ( 0 ) h ( 3) ⎬ ⎭

with

y ( 2) = x ( 0 ) h ( 2) + x (1) h (1) + x ( 2) h ( 0 ) + x ( 3) h ( 3 ) For the final value, y(3), we will have

⎧ x ( n) = ⎨ x ( 0 ) x (1) ⎩



x ( 2) x ( 3) ⎬ ⎭

⎧ h ( n) = ⎨ h ( 3) h ( 2) ⎩

⎫ h (1) h ( 0 ) ⎬ ⎭

and

y ( 3) = x ( 0 ) h ( 3) + x (1) h ( 2) + x ( 2) h (1) + x ( 3) h ( 0 )

248

Discrete Signals and Systems with MATLAB®

Example 5.5 Consider the signals x(n) and h(n) with N = 2 and x(0) = h(0) = 1 and x(1) = h(1) = 0. Find the output y(n) of the system given by this h(n). SOLUTION Using circular convolution, we need to find y(0) and y(1). For y(0), we have x ( n) =

{1 0}

h ( n) =

{1 0}

y ( 0 ) = (1)(1) + 0 ( 0 ) = 1 For y(1), we have x ( n) =

{1 0}

h ( n) =

{ 0 1}

y (1) = (1)( 0 ) + 0 (1) = 0 But we also know that y(n) is the inverse DFT of Y(k) = X(k)H(k). To find X(k) and H(k), we need to find X(0), X(1), H(0), and H(1). X (0) =

1



x ( n) e



j 2π ( 0 ) N

= x ( 0 )(1) + x (1)(1) = 1+ 0 = 1

n=0

X (1) =

1

∑x (n) e

− j 2π (1) /N

= x ( 0 )(1) + x (1)( −1) = 1

n=0

In the same way, we have H(0) = 1 and H(1) = 1. Y(k) is the term-by-term multipli­ cation of X(k) and H(k) and is Y ( 0 ) = X ( 0 ) H ( 0 ) = 1(1) = 1 Y (1) = X (1) H (1) = 0 ( 0 ) = 0 y(n) is the inverse DFT of Y(k) and is given by y ( n) =

1 N

N−1

∑Y (k ) e k =0

j 2πnk /N

Discrete Fourier Transform and Discrete Systems

249

with y (0) = y (1) =

5.7.2

1 1 ⎡Y ( 0 )(1) + Y (1)(1) ⎦⎤ = [1+ 1] = 1 2⎣ 2

1 1 ⎡Y ( 0 )(1) + Y (1)( −1) ⎦⎤ = [1− 1] = 0 2⎣ 2

Linear ConvoLution

Consider the two signals, x(n) and h(n), each of length N1 and N2, respectively. If we append zeros to the end of x(n) and h(n) to make the length of both equal to N1 + N2 − 1, then the linear convolution is the same as the circular convolution. It means that we can use the DFT to find linear convolution if both signals have the length N1 + N2 − 1. Example 5.6 Consider x(n), where x(0) = 1 and x(1) = 0, and h(n), where h(0) = 1 and h(1) = 0. Find y(n) = x(n) * h(n) and y(n) = x(n) ⊗ h(n). SOLUTION First, we will make x(n) and h(n) each of length N1 + N2 − 1 = 2 + 2 − 1 = 3 by appending zeros at the end and write

{1 h ( n) = { 1 x ( n) =

} 0 }

0 0 0

With circular convolution, we have y ( 0 ) = 1(1) + 0 ( 0 ) + 0 ( 0 ) = 1 To find y(1), we list the arrays as

{1 h ( n) = { 0 x ( n) =

} 0 }

0 0 1

with y(1) = 1(0) + 0(1) + 0(0) = 0

To find y(2), we list the arrays again as

{1 h ( n) = { 0 x ( n) =

with y(2) = 1(0) + 0(0) + 0(1) = 0

} 1}

0 0 0

250

Discrete Signals and Systems with MATLAB® So y(n) with circular convolution is y ( n) =

{1

0 0

}

Using linear convolution, we get the same result.

5.7.3 approximation to tHe Continuous fourier transform We have seen in Section 5.4.3 that the approximation to the Fourier transform of the signal x(t) is related to the DFT X(k) as in the relation ⎛ 2π X c ⎜ ⎝ NTs

⎞ 1 − e − j 2 πk /N k⎟ = X (k ) ⎠ j 2πk /NTs

We can implement this approximation in MATLAB. Let us look at an example.

Example 5.7 Consider the signal ⎪⎧ 1 x (t ) = ⎨ ⎩⎪ 0

0 0. What is the total energy in the signal? SOLUTION The total energy in the signal is ∞

Et =

∫ (e ) −t

2

dt =

0

1 2

We can compute this value of 1/2 using the DFT. But first let us look at the con­ tinuous Fourier transform of x(t) X (w ) =

1 1+ jw

The magnitude of X(w) is given as 1

X (w ) =

1+ w 2

We can see that for w > 2π(50), the magnitude of X(w) approaches zero. Thus let fs = 2(50) = 100 Hz be the sampling frequency. We can also see that for t > 5, the signal x(t) approaches zero as well. Therefore, we will choose the time interval of 5 s and sample x(t) in this interval. In this case, the number of samples N is T/Ts = 5(100) = 500. We can use MATLAB to calculate the total energy in x(t) as in the script Example5_91. to get Etotal = 0.505 using the time domain

Effttotal = 0.506 using the DFT

Note that if we were given a discrete signal x(n) such that x (0) = 1

x (1) = 0

x ( 2) = 1

x ( 3) = 1

x ( 4) = 0

then N−1

Et =

∑ x (n) = ( x (0)) + ( x (1)) + ( x ( 2)) + ( x (3)) + ( x (4)) 2

2

2

2

2

2

= 1+ 0 + 1+ 1+ 0 = 3

n=0

MATLAB can be used also to compute the total energy in the signal as in the script Example5_92. The result will be Etotal = 3

Effttotal = 3

256

5.7.6

Discrete Signals and Systems with MATLAB®

BLoCk fiLtering

A digital filter can be described by the impulse response h(n). h(n) can change the magnitude of the input signal as well as produce a phase shift. In using the DFT to calculate y(n), the output of the filter h(n), notice that you need the entire x(n) present. In case of huge x(n), this will cause a considerable delay in obtaining y(n). If we break x(n) into blocks of data, we can use the DFT to produce blocks of the output y(n). These blocks then can be arranged to produce the total output y(n). This method will produce outputs faster and will reduce the waiting time for incoming x(n) samples. An example of how to perform this method will be given in the EOCE section later.

5.7.7 CorreLation Correlation is often used in the detection of a target in a radar signal. It can also be used in the estimation of the frequency content of a certain signal. Cross-correlation is the correlation between two different signals and auto-correlation is the correla­ tion with the signal itself. The cross-correlation is given by the relation Rx1x 2 ( p ) =

+∞

∑x ( n ) x ( p + n ) 1

(5.23)

2

n=−∞

Equation (5.23) is similar to the convolution equation with the only difference being that x2(n) is shifted but not reflected. In dealing with discrete signals, we use N samples and assume that the signals are periodic with period NTs. With periodic signals and if 0 ≤ n ≤ N − 1, we have x (−n) = x (−n + N ) The cross-correlation equation can be written then as Rx1x 2 ( p ) =

+∞

∑x ( n) x ( p − ( −n)) = x ( −n) * x ( n) 1

2

1

2

(5.24)

n=−∞

If we take the DFT of Equation (5.24), we will have Rx1x 2 ↔ X1 ( −k ) X 2 ( k )

(5.25)

and then the inverse DFT of X1(−k) X2(k) is R x1x2(p). If x2(n) is real, then X1 ( − k ) = X1 * ( k ) Finally, we have Rx1x 2 ( p ) ↔ X1 ( k ) * X 2 ( k )

(5.26)

257

Discrete Fourier Transform and Discrete Systems

Note that R x1x2(p) ≠ R x2x1 (p). It can be shown that Rx1x 2 ( p ) ↔ x1 ( k ) x 2 ( k ) *

(5.27)

One important application of auto-correlation is the estimation of the energy spec­ trum density of the signal x(n). The auto-correlation process helps to eliminate the noise if it is present in a certain signal. The energy spectrum density estimate is Rxx ( p ) =

1 N

N −1

∑x (n ) x ( p + n) 0 ≤ p ≤ N − 1

(5.28)

1 * X (k ) X (k ) N

(5.29)

n=0

From this relation, we have Rxx ( p ) ↔



We will give an example on how to use this relation later in the EOCE.

5.8

SOME INSIGHTS

5.8.1 Dft is tHe same as tHe fft The DFT is not an approximation to the fft; it is the same as the fft. The fft is a fast and an efficient way of calculating the DFT.

5.8.2 Dft points are tHe sampLes of tHe fourier transform of x(n) The Fourier transform of the discrete signal x(n) for n = 0, 1, …, N − 1 is

( )

X e jθ =

N −1

∑x ( n) e

− jθn

n=0

If we sample X(ejθ) on the unit circle with θ = 2πk/N for k = 0, 1, …, N − 1, then

( )

X ( k ) = X e jθ

θ= 2 πk /N

5.8.3 How Can we Be Certain tHat most of tHe frequenCy Contents of x(t) are in tHe Dft? To get X(k) from x(t), we need first to sample x(t) making sure that fs, the sampling frequency used to produce x(n), is at least twice f m, the maximum frequency in x(t).

258

Discrete Signals and Systems with MATLAB®

This is necessary to avoid aliasing. Next, N samples should be collected from x(t) in

NTs s, where Ts = 2πfs. The number of samples N is inversely related to the frequency

resolution Δf according to Δf =

2π N

The smaller the frequency resolution is, the better is the process of detecting most of the frequency components in x(t).

5.8.4 is tHe CirCuLar ConvoLution tHe same as tHe Linear ConvoLution? The circular convolution between the two signals x1(n) and x2(n) will be the same as the linear convolution if we append zeros to the end of x1(n) and x2(n) so that the number of samples in x1(n) and x2(n) will be N1 + N2 – 1, where N1 is the number of samples in x1(n) and N2 is the number of samples in x2(n).

5.8.5 is |X(w)| ≊ |X(k)|? Due to the inherent factor 1/Ts in calculating the Fourier transform of discrete sig­ nals, the magnitude of the DFT, |X(k)| should be multiplied by Ts to get the approxi­ mation to |X(w)|. Note that this approximation is not as good as the approximation we discussed earlier in this chapter.

5.8.6 frequenCy Leakage anD tHe Dft In the development of the DFT, the signal x(nTs) is made periodic first and then multiplied by the rectangular window of unity magnitude that extends from n = 0 to n = N − 1. The result of this multiplication is the signal x(n). To understand this better, consider the signal x(t) = sin(t). This signal is periodic and there is no need to make it periodic. Its Fourier transform consists of one component at w = 1. If we truncate x(t) by multiplying it with a rectangular window that is centered at t = 0, the Fourier transform of sin(t) multiplied by this window will result in a sinc-shape graph centered at w = 1. From this you can see that the frequency content of x(t) after this multiplication is distorted. This is referred to as frequency leakage. To have better approximation, different windows can be used. Two well-known windows are the Hanning and the Hamming windows. These windows do not have sharp cuts at the edges; they gradually approach zero. The two windows are implemented in MATLAB.

Discrete Fourier Transform and Discrete Systems

259

5.9 END-OF-CHAPTER EXAMPLES EOCE 5.1 Consider the discrete time system represented by h ( n) = ( 0.5)

n

n = 0, 1, 2,  , 10

and consider an input to the system given by x ( n) = u ( n)

n = 0, 1, 2, , 5

Find the output y(n) using the DFT method. SOLUTION We have Nh = 11 samples for h(n) and Nx = 6 samples for x(n). So we need to add 6 − 1 = 5 zeros to h(n) and 11 − 1 = 10 zeros to x(n) so that each signal will have (11 + 6) − 1 = 16 samples. At this point we can use the DFT to calculate y(n). The MATLAB script EOCE5_1 will compute y(n) using the function conv and it will also compute y(n) by inverse transforming Y(k) for comparison. The result is plotted in Figure 5.6. Note that we have h(n) and x(n) each of length 16. This means that the radix-2 fft was used. If we want the faster and more efficient radix-2 to be used, each signal should have 2p as its length where p is a positive integer.

FIGURE 5.6 Plots for EOCE 5.1.

260

Discrete Signals and Systems with MATLAB®

EOCE 5.2 Find an approximation to the magnitude of the Fourier transform of x (t ) = e −10tu (t ) SOLUTION To use the DFT to approximate the Fourier transform of x(t), we need to sample x(t) first. Let us look at the Fourier transform of e −10tu(t) so that we can find the frequency at which X(w) is approaching zero. The Fourier transform is X (w ) =

1 jw + 10

and the magnitude of X(w) is X (w ) =

1 w + 100 2

For w = 30π rad/s, the magnitude of X(w) is approximately zero. Thus we choose ws ≥ 2w = 60π. Let us choose ws = 300π with fs = 150 Hz and Ts = 1/150s. Note that at t = 1 s, x(t) is approximately zero. Let us choose NTs = 1 or N = 1/Ts = 150 samples. We have established a lower limit on N of 150. To use the radix-2 fft, N must be an integer power of 2. The next N then will be 28 = 256. We have seen in this chapter two ways to perform this approximation. In the first method, the approximation was given by 1− e − j 2πk /N X (k ) j ( 2πk /NTs ) and in the second method, the approximation to |X(w)| was Ts (X(k)). In the script EOCE5_2, we use the two methods. The plots are shown in Figure 5.7.

EOCE 5.3 Consider the signal x (t ) = sin ( 2π 2000t ) +

1 sin ( 2π 4000t ) 2

1. Use the DFT to approximate |X(w)| with N = 16, and choose fs such that the Nyquist criterion is observed and fs/N = f1/k1 = f2/k 2, where k1 and k 2 are integers and f1 and f2 are the frequencies of the two components in x(t), 2000 and 4000 Hz. 2. Repeat while fs/N ≠ m1f1 ≠ m2 f2. 3. Can you do a correction to the approximation?

Discrete Fourier Transform and Discrete Systems

FIGURE 5.7 Plots for EOCE 5.2. SOLUTION 1. The highest frequency in x(t) is f2 = 4000 Hz. With fs = 16,000 Hz, fs 16,000 f f = = 1,000 = 1 = 2 N 16 2 4 Therefore, on the frequency axis of the magnitude of |X(k)|, we will see that the frequency content of the first component at f1 = 2000 Hz cor­ responds to k1 = 2, and the frequency content of the second component at f2 = 4000 Hz corresponds to k 2 = 4. In this case, the Fourier transform of x(t), X(w), will match exactly the DFT of x(n), X(k). The MATLAB script to prove that is EOCE5_31. The plot is shown in Figure 5.8. The magnitude of X(2) = 8 is the mag­ nitude of the 2000 Hz term times N divided by 2. This is true because the first term in x(t) has no dc components. 2. If we sample at fs = 10,000 Hz (satisfying the Nyquist rate) and with N = 16 we have fs 10,000 f1 f2 = ≠ ≠ N 16 k1 k2 for any k1 or k 2. In this case there will be distortion in the frequency spec­ trum using the DFT. This is to say that the 2000 and 4000 Hz frequencies will not be observed at any value of k in the DFT magnitude plot. For fs = 10,000 Hz, the approximation to x(t) will be as seen in Figure 5.9.

261

262

Discrete Signals and Systems with MATLAB® 3. If we use the Hanning window instead of the rectangular window inher­ ent in the DFT development, we will get some improvements as seen in Figure 5.9. The MATLAB script for using the Hanning and the rectangular windows is EOCE5_32.

FIGURE 5.8 Plot for EOCE 5.3.

FIGURE 5.9 Plots for EOCE 5.3.

263

Discrete Fourier Transform and Discrete Systems

EOCE 5.4 Consider the signals x(t) and h(t) that are the input and the impulse response of a linear system h (t ) = e −100t

(

x (t ) = sin 2π (1000 ) t

)

Find the output y(n) and display the frequency spectrum of the input and the out­ put using the DFT. SOLUTION The input x(t) is periodic with period T = 0.001. We will sample x(t) at fs = 8000 Hz satisfying the Nyquist rate. For fs = 8000 Hz we have Ts = 1/8000 s. We will sample x(t) for T = 0.001 s. To choose a value for N we use the relation NTs = T or N = T/Ts = 0.001/1/8000 = 8 samples. For h(t) = e −100t we see that if t = 0.1 s, h(t) will be very close to zero in value. The Fourier transform of h(t) is H(w) and is H (w ) =

1 jw + 100

with a magnitude of

H (w ) =

1 w + (100 ) 2

2

With w = 2π(20) rad/s, |H(w)| will approach zero. So we choose ws as ws > 2(2π) (20) to satisfy the Nyquist rate. Let us make ws > 2π(200). Thus fs = 200 and Ts = 1/200 s. So for a time length of 0.1 s (at which h(t) ≈ 0) and with Ts = 1/200, we have ⎛ 1 ⎞ N⎜ = 0.1 or N = 0.1( 200 ) = 20 samples ⎝ 200 ⎠⎟ Now we will find the DFT for x(t) with N = 8 and the DFT for h(t) with N = 20. To find y(n) we will use convolution by making x(n) and h(n) both of length n1 + n2 – 1, where n1 and n2 are the number of samples in x(n) and h(n), respectively. To do that we will pad x(n) and h(n) by zeros. The script EOCE5_4 will do that. The plots are shown in Figure 5.10. Notice in this MATLAB script that the DFT of x(n), h(n), and the inverse transform of Y(k) were calculated using the relation N = length (xn) + length (hn) −1;

But 27 is not an integer power of 2 and hence the radix-2 fft was not used. To use the radix-2 fft, we need not pad x(n) or h(n) with zeros since padding will be made by calling the fft function Xk = fft (xn, N);

264

Discrete Signals and Systems with MATLAB®

FIGURE 5.10 Plots for EOCE 5.4. In this case x(n) will be made of length N where (N − length(xn)) is the number of the padded zeros. We can use this method with h(n) as well. When we use the command Yk = Xk * Hk’;

Yk will be of length N as well.

EOCE 5.5 Consider the discrete system where the input x(n) is the pulse defined as ⎪⎧ 1 x ( n) = ⎨ ⎪⎩ 0

0≤n≤5 otherwise

and the impulse response is defined as h ( n) = (.2) u ( n)

n

Find the output y(n) using the DFT.

SOLUTION The signals here are already sampled. We can see that x(n) is zero for n ≥ 6. Thus the number of samples in x(n) is 6. For h(n), there is no real integer that makes h(n)

Discrete Fourier Transform and Discrete Systems

265

FIGURE 5.11 Plots for EOCE 5.5. zero. But if n = 5, h(n) is close to zero. Thus h(n) will have a value close to zero for n ≥ 5. For this h(n) we will have five samples. To use radix-2 fft, N1 + N2 − 1 should be an integer multiple of 2. N1 + N2 − 1 = 6 + 5 − 1 = 10 ≠ 2p for any inte­ ger p. The next integer 2p greater than 10 is 16 = 24. So we need to use at least 16-point DFT to find y(n) using the radix-2 fft. The MATLAB script EOCE5_5 will be used. The plot is shown in Figure 5.11.

EOCE 5.6 Suppose that we have 2 s of the signal x(t). Let us sample x(t) at fs = 1000 Hz. 1. Find the maximum frequency that can be present if there is to be no aliasing. 2. What analogue frequencies are present in the DFT? 3. What is the frequency resolution?

SOLUTION 1. With fs = 1000 Hz, from the Nyquist condition, we have fs ≥ 2fm or  fm =

fs 1000 = = 500 Hz 2 2

266

Discrete Signals and Systems with MATLAB® 2. The frequency spacing (the frequency resolution) is given by

fs 1 1

= = = 0.5 Hz N Tr 2 where Tr is the total time of observing the signal and is called the record length. 3. From part 2 with fs/N = 0.5, we get

N=

fs 1000

= = 2000 .5 .5

The frequencies in the DFT are at

mfs 1000 1

=m = m Hz N 2000 2

where m is an integer. So they are at

0,

1 3 1

, 1, , 2,  , 500, − 499, − 2 2 2

EOCE 5.7 Consider the two signals x1(n) = x2(n) with

x1 ( 0 ) = 1 1x1 ( ) = 1 x1 ( 2) = 0 and x1 ( 3) = 1 Find the cross-correlation between x1(n) and x2(n), R x1x2 and R x2x1. SOLUTION Note that x1(n) has four samples as well as x2(n). To use the DFT to find the crosscorrelation, we need to make both x1(n) and x2(n) of length 4 + 4 − 1 = 7 samples. We will pad x1(n) with three zeros and we will do the same for x2(n). The MATLAB script EOCE5_71 will accomplish this. The plots are shown in Figure 5.12. We could have used the MATLAB function conv to find the same result. The script EOCE5_72 can be used. The plots are shown in Figure 5.13.

EOCE 5.8 Use MATLAB to generate an N-points random signal x1(n), then add to it the N-points samples of the 1000 Hz signal x2(n) where ⎛ 2π (1,000 ) n ⎞ x2 ( n) = sin ⎜ ⎝ 10,000 ⎟⎠

Find the energy spectral estimate of x(n) where

x ( n) = x1 ( n) + x2 ( x )

Discrete Fourier Transform and Discrete Systems

FIGURE 5.12 Plots for EOCE 5.7.

FIGURE 5.13 Plots for EOCE 5.7.

267

268

Discrete Signals and Systems with MATLAB®

FIGURE 5.14 Plots for EOCE 5.8. SOLUTION We will use MATLAB to generate 51 random values that are uniformly distributed between zero and one. The MATLAB script to calculate the spectral energy esti­ mate is EOCE5_8. The plots are shown in Figure 5.14. You can clearly see that the 1 kHz signal is standing out while the noise is attenuated.

EOCE 5.9 Consider a discrete system with input x ( n) = e −n 0 ≤ n ≤ 20 and impulse response h ( n) = 1     0 ≤ n ≤ 1 Find the output y(n) using block filtering. SOLUTION The impulse response has 2 values and the input has 21 values. If we want to use 8-point DFT then we can divide x(n) into 3 blocks each having 7 values in it. Thus 7 + 2 − 1 = 8 is the length of the DFT output as the result of convolving the

269

Discrete Fourier Transform and Discrete Systems

FIGURE 5.15 Plots for EOCE 5.9. 7-values input with the 2-values impulse response. Let us call the input blocks x1(n), x2(n), and x3(n). The output blocks are then y1(n), y2(n), and y3(n). Note that for 7-values input we will have 8-values output. To find out the final output, we will form the array y(n) as a series of the subarrays y1(n), y2(n), and y3(n), where the eighth value of y3(n) will be added to the first value of y2(n) and the eighth value of y2(n) will be added to the first value of y3(n). This array of y(n) can be viewed as

(

)

(

)

y ( n) = ⎡⎣ y1 ( 0 )y1 (6) y1 (7) + y 2 ( 0 ) y 2 (1 ) y 2 (6) y 2 (7) + y3 ( 0 ) y3 (1)y3 (7) ⎤⎦ The MATLAB script EOCE5_9 will produce y(n) using block filtering with the DFT and regular linear convolution. The plots are shown in Figure 5.15.

EOCE 5.10 High resolution and dense spectrum are two misleading terms. Next we consider an example to show you the difference. Consider the signal x ( n) = sin (.37πn) + sin (.55πn) It is clear that x(n) has the two frequencies at .37π and .55π. Let us take only 20 samples of the 100 samples from x(n) and find the spectrum. Then let us pad the 20-sample signal with 80 zeros and find the spectrum again. Next let us take all 100 samples from x(n) and find the spectrum.

270

Discrete Signals and Systems with MATLAB® SOLUTION

We will use the MATLAB script EOCE5_10 to accomplish this task. The plots are shown in Figure 5.16. Notice that with only 20 samples of x(n) and no zero padding, the spectrum is not dense as it is in the case when 20 sam­ ples are taken with 80 zeros padded. Padding with zeros will make the spectrum denser. This does not mean that the DFT with zero padding will tell more about the frequency contents of the signal. As it is seen in the plot, with few samples and no zero padding and with few samples and zero padding, the magnitude plots are distorted and do not have values of the exact two frequencies of .37π and .55π. However, by taking more points from x(n), we can see the spectrum emphasized at the .37π and .55π frequencies. Thus we can say that zero padding can only make spectrum denser which does not mean good frequency resolution. More points or samples will produce more frequency components and yet good frequency resolution. This is not to say that good frequency resolution comes from more samples only. You need to consider a good time span over which the signal is well known. If the sig­ nal is periodic, you can sample over one period. Taking more samples within this period gives good frequency resolution and yet more frequencies will be detected using the DFT. If the signal is not periodic but its amplitude approaches zero as time reaches a certain limit, then you need to sample the signal for the period of time up to that limit. This is what is known as the record length in digital signal processing.

FIGURE 5.16 Plots for EOCE 5.10.

Discrete Fourier Transform and Discrete Systems

271

EOCE 5.11 In EOCE 1.11, we have acquired an audio signal using the data acquisition toolbox of MATLAB. Here we would like to see how we can FFT the audio signal to iden­ tify its frequency contents. SOLUTION Let us repeat EOCE 1.11 here and modify to get and plot the FFT. To complete this task, you will need a PC microphone or your laptop built-in microphone and a sound card that is also found on your PC or laptop. The sound card will work as the analogue-to-digital converter as will be discussed later in the chapters. Let us start by acquiring 3 s of audio using the sound card. What we speak is an analogue signal and so the sound card will convert the speech to digital samples. Let us use 8000 Hz as the sampling rate on the sound card. We will first create an analogue input object for the sound card. At the MATLAB prompt write AI = analoginput (’winsound’);

to create an input communication channel with the sound card. Then you need to add an input channel to the input object AI. This is done with the MATLAB command addchannel (AI, 1);

to add a single channel to the input object. We need to specify a sampling rate (this topic will be revisited again in later chapters for complete discussion). We will use 8000 Hz for that. We will write Fs=8000;

Set (AI, ’SampleRate’,Fs);

to define the sample rate to MATLAB and associate that with the input object AI. We need to speak through the mice for a limited time of 3 s and tell the channel how many samples per trigger we wish to collect. We do that with Trig_duration = 3;

Set (AI, ’SamplesPerTrigger’,Trig_duration*Fs);

At this stage we can start collecting data for the audio signal we will speak using the mice. Before you hit enter after you type the following command, start speaking for about 5 s. start (AI);

To collect the data samples of the words you just spoke use the command data = gatdata (AI);

Once you have the data, you can apply the FFT algorithm. datafft = abs (fft (data));

272

Discrete Signals and Systems with MATLAB®

and in dB, the magnitude is calculated as magdatafft = 20*log10 (datafft);

magdatafft = mag (1:end/2);

We can plot the fft magnitude as in plot (magdatafft);

We can also see what is the highest and lowest frequency in the spoken words we spoke. We write max (magdatafft)

min (magdatafft)

It is always a good practice to delete the AI object after we finish. Write the command delete (AI);

to delete the AI object

At this time, you can plot the data you just collected.

5.10 END-OF-CHAPTER PROBLEMS EOCP 5.1 A continuous time signal has f m as its highest frequency. If f m = 1 kHz and we desire sampling the signal at 10 times f m, what would be the record length and the number of samples if the frequency resolution is to be 10 Hz? EOCP 5.2 Find the circular convolution between the signals 1. 2. 3. 4. 5.

u(n) for 0 ≤ n ≤ 5 and e−n/.1 for 0 ≤ n ≤ 5 5sin(nπ/3) for 0 ≤ n ≤ 4 and e−n for 0 ≤ n ≤ 4 e−n/2 and itself for 0 ≤ n ≤ 10 x(n) = 1 and itself for 0 ≤ n ≤ 5 cos(nπ/6) for 0 ≤ n ≤ 6 and δ(n) for 0 ≤ n ≤ 6

EOCP 5.3 Find the DFT X(ejθ) of x(n) = e−n/3 for 0 ≤ n ≤ 7. Sample X(ejθ) at θ = 2πk/N with N = 16. Find the first four values X(0), …, X(3) using the DFT equation. Find all eight values for X(k) and compare with the values found in part 2. If x(n) in part 1 is an input to the linear system given by h(n) = e−n/6 for 0 ≤ n ≤ 3, use convolution to find y(n), the output of the system. 6. Use the DFT to find y(n) in part 5.

1. 2. 3. 4. 5.

Discrete Fourier Transform and Discrete Systems

273

EOCP 5.4 Consider the signal ⎧⎪ cos ( nπ /6 ) x (n) = ⎨ ⎪⎩ 0 1. 2. 3. 4.

0≤n≤5 otherwise

Let N = 8, 16, 32, and 64. Find the spectrum for x(n) using the DFT. What conclusion can you draw by completing part 1? If x(n) = cos(nπ/6) for 0 ≤ n ≤ 63, plot the spectrum for x(n) in this case. Compare the results of part 1 and part 3.

EOCP 5.5 Find the DFT of the following signals where n is taken in the interval 0 ≤ n ≤ N − 1. A is a constant. Use 3 different appropriate N values. 1. 2. 3. 4.

Aδ(n) A A sin(2πn/N) A cos(2πn/N)

EOCP 5.6 Consider the signal x ( t ) = sin ( 600 πt ) + sin (1000 πt ) 1. 2. 3. 4. 5. 6.

What is the period of x(t)? What is the minimum sampling frequency? Sample x(t) for one period at fs = 10 f m and plot x(n). Find the DFT of x(n) in 3. Repeat part 3 over two periods. What do you observe? Keep N as in part 3. Find the DFT of x(n) in part 5. What do you notice?

EOCP 5.7 Use the DFT to find the energy spectrum density for the signals 2πn ⎞ 1. x ( n ) = sin ⎜⎛ 0 ≤ n ≤ 15 ⎝ 11 ⎟⎠ 2πn ⎞ 2. x ( n ) = e −n /3sin ⎜⎛ 0 ≤ n ≤ 15 ⎝ 11 ⎟⎠

274

Discrete Signals and Systems with MATLAB®

EOCP 5.8 Use the DFT to find the cross-correlation between the signals given in EOCP 5.7. EOCP 5.9 Use the DFT to approximate the Fourier transform for the signals 1. x(t) = e−tu(t)

2πt ⎞ 2. x ( t ) = 20cos ⎜⎛ ⎟ ⎝ 13 ⎠

⎧ 1 3. x ( t ) = ⎨ ⎪⎩ 0

0 ≤ t ≤ 1

otherwise

EOCP 5.10 Consider the system h ( n ) = e −n 0 ≤ n ≤ 10 If x(n) = u(n) for 0 ≤ n ≤ 5, find y(n) using linear convolution via the DFT. EOCP 5.11 Consider the system h ( t ) = e −t /3u ( t ) 1. If the input is x(t) = e−5tu(t), use the DFT to find y(n). 2. If the input is x(t) = 10sin(2π(500)t) + 10, find the output y(n) using the DFT. 3. Is there any dc component in the output? Use the DFT to check. EOCP 5.12 Consider the signals ⎛ 3π ⎞ ⎞ x ( t ) = sin ( 2πt ) + cos ⎜ ⎜⎛ ⎟ t ⎟ ⎝⎝ 4 ⎠ ⎠ 3 x ( t ) = e −10t sin ( 2πt ) + cos ⎛⎜ t ⎞⎟ ⎝4 ⎠ 1. Are the signals periodic? 2. Find the Fourier series coefficient and/or the Fourier transform (approxima­ tion) using the DFT for the signals. 3. What is the average power/total energy in the signals x(t)?

Discrete Fourier Transform and Discrete Systems

275

EOCP 5.13 Consider the signal x ( t ) = e −t /10 u ( t ) 1. Find the total energy in the signal using the DFT. 2. If x(t) is multiplied by sin(t), what would be the approximation to the total energy in the signal using the DFT. EOCP 5.14 Consider the signal x ( t ) = e −10t sin ( t ) u ( t ) as an input to the system h ( t ) = e −4t u ( t ) 1. Find y(n) using convolution and the DFT. 2. Subdivide the input signal into blocks and use block filtering to find y(n) again. 3. Compare the results in part 1 and part 2. 4. Find the total energy in both signals using the DFT. EOCP 5.15 Consider the signal x ( t ) = cos ( 2π ( 300 ) t ) 1. 2. 3. 4.

Find the approximation to the Fourier transform of x(t). Use the Hamming windowing method and repeat part 1. Use the Hanning windowing method and repeat part 1. Comment on the results.

EOCP 5.16 Consider the signal x ( t ) = 10sin ( 2π ( 700 ) t ) + sin ( 2π ( 300 ) t ) 1. Choose an fs and a suitable N so that only the 700 and the 300 Hz will appear in the DFT magnitude plot. Plot the DFT magnitude.

276

Discrete Signals and Systems with MATLAB®

2. Choose fs (you should satisfy the sampling Nyquist rate in this part, too) and a suitable N so that the frequencies in x(t) will appear distorted on the DFT magnitude plot. Plot the DFT magnitude. 3. How can you get a more accurate plot in part 2 to suppress the frequency distortion? Plot the DFT magnitude. EOCP 5.17 A continuous signal has a duration of 2 s and is sampled at 64 equally spaced values. 1. What is the distance between successive frequency points? 2. What is the highest frequency in the spectrum? 3. What is the maximum frequency in the continuous signal if there is to be no aliasing?

6

State-Space and Discrete Systems

6.1 INTRODUCTION As the interest in many scientific fields increased, modeling systems using linear time-invariant equations and tools such as transfer functions were not adequate. The state-space approach is superior to other classical methods of modeling. This mod­ ern approach can handle systems with nonzero initial conditions (modeling using transfer functions requires that initial conditions be set to zero) as well as timevariant systems. It can also handle linear and nonlinear systems. We also have been considering systems with single-input single-output. The state-space approach can handle multiple-input multiple-output systems. Systems can have many variables. An example is an electrical circuit where the variables are the inductor current, the capacitor voltage, and the resistor voltage among others. With the state-space approach, we can solve for a selected set of these variables. The other variables in the circuit system can be found using the solution for the selected variables. Using the state-space approach, we will follow the subsequent procedure. We will select specific variables in the system and call them state variables. No state variable selected can be written as a linear combination of the other state variables. Linear combination means that if v1 ( t ) = 3v3 ( t ) + 2v2 ( t )

(6.1)

where v1(t), v2(t), and v3(t) are state variables, we say that v1(t) is a linear combina­ tion of v2(t) and v3(t). If we have a first-order differential or difference equation, we will have only one state variable. If the differential or the difference equation is second order, we will have only two state variables. Similarly, if we have an nth-order differential or difference equation, we will have only n state variables. Once we select or decide on the state variables in the system under consider­ ation, we will write a set of first-order simultaneous differential or difference equations, where the right side of these equations is a function only of the state variables (no derivatives or shifts) and the inputs to the system, and the number of these equations is determined by the number of state variables selected. We will call this set the state equation set. These state equations will be solved for the selected state variables. All other variables in the system under consideration can be solved using the solutions of these selected state variables and the inputs to the system. We can use any approach we desire to solve for these selected states. The equations we write to a set of selected outputs in the system are called output equations. 277

278

Discrete Signals and Systems with MATLAB®

The earlier discussion relates closely to continuous systems and explains the evolution of state equations from real physical systems. In many cases, we derive discrete systems from continuous systems by many means such as sampling or trans­ formation. The equivalence of the differential equations is the difference equations where the basic unit is the delay element. From these difference equations, the states in discrete form are obtained. Some systems are inherently discrete and the differ­ ence equation is readily obtained. The concept of the state is best understood with dynamic physical systems and that is how we explain it here.

6.2

REVIEW ON MATRIX ALGEBRA

What follows is a brief review of some of the concepts and definitions we need in this chapter. We will deal with second-order systems when we deal with hand solutions. For matrices of higher dimensions, you can consult any linear algebra book.

6.2.1 Definition, General terms, anD notations A matrix is a collection of elements arranged in a rectangular or square array. The size of the matrix is determined by the number of rows and the number of columns in the matrix. A matrix A of m rows and n column is represented as A m × n. If m = 1, then A is a row vector and is written as A1 × n. If n = 1, then A is a column vector and is written as A m × 1. If n = m, then A is a square matrix and we write it as A n × n or A m × m. If all elements in the matrix are zeros, we say A is a null matrix or a zero matrix.

6.2.2 iDentity matrix The identity matrix is the square matrix where elements along the main diagonal are 1s and elements off the main diagonal are 0s. A two-by-two identity matrix is ⎛ 1 I 2× 2 = ⎜ ⎝ 0

0 ⎞   1 ⎟⎠

(6.2)

6.2.3 aDDinG two matrices ⎛ a If A = ⎜ ⎝ c

⎛ e b ⎞

and B = ⎜ ⎟ d ⎠ ⎝ g

f ⎞

⎟ then h ⎠

⎛ a+e A+B=⎜ ⎝ c+g

b+ f ⎞ ⎟ d+h ⎠

(6.3)

To add two matrices, they must be of the same size. If the matrices are of higher order, the procedure is the same; we add the corresponding entries.

279

State-Space and Discrete Systems

6.2.4 subtractinG two matrices ⎛ a If A = ⎜ ⎝ c

⎛ e b ⎞

B =

and ⎜ d ⎟⎠ ⎝ g

f ⎞

⎟ then h ⎠

⎛ a−e A−B=⎜ ⎝ c−g

b− f ⎞ ⎟ d−h ⎠

(6.4)

To subtract two matrices, they must be of the same size. If the matrices are of higher order, the procedure is the same; we subtract the corresponding entries.

6.2.5 multiplyinG a matrix by a constant ⎛ a If A = ⎜ ⎝ c

b ⎞ and k is any given constant, then d ⎟⎠ ⎛ a k⎜ ⎝ c

b ⎞ ⎛ ka = d ⎟⎠ ⎜⎝ kc

kb ⎞

kd ⎟⎠

(6.5)

If the matrix A is of higher order, then k is multiplied by each entry in A.

6.2.6 Determinant of a two-by-two matrix Consider the A2 × 2 following matrix: ⎛ a A2 × 2 = ⎜ ⎝ c

b ⎞ d ⎟⎠

The determinant of A is det ( A ) = ad − bc

⎛ a If A = ⎜ ⎝ c

(6.6)

b ⎞

, then the transpose of A is given by d ⎟⎠ ⎛ a AT = ⎜ ⎝ c

b ⎞

d ⎟⎠

(6.7)

This works for higher order matrices as well, where the first column in A becomes the first row in AT and so on.

280

Discrete Signals and Systems with MATLAB®

6.2.7 inverse of a matrix ⎛ a If A = ⎜ ⎝ c

b ⎞ , then the inverse of A is d ⎟⎠ A −1 =

1 ⎛ d ad − bc ⎜⎝ −c

−b ⎞ a ⎟⎠

(6.8)

and since 1/(ad − bc) is a constant, we can write the inverse as ⎛

d ⎜ ad − bc A −1 = ⎜ − c ⎜ ⎜⎝ ad − bc

− b ad − bc a ad − bc



⎟ ⎟ ⎟ ⎟⎠

The inverse of a square matrix exists if the determinant of the matrix is not zero. Also, to find an inverse of a certain matrix, that matrix has to be square. The aforementioned procedure for finding the inverse is only for a 2 × 2 matrices. For higher order matrices, the procedure is different and is found in any linear algebra book.

6.2.8

matrix multiplication

We can multiply two matrices A and B if the number of columns in A is equal to the number of rows in B. If Am × n is to be multiplied by Br × p, then n must be equal to r and the resulting matrix should have m rows and p columns: If ⎛ a A=⎜ ⎝ c

⎛ e b ⎞  and   B = ⎜ ⎟ d ⎠ ⎝ g

f ⎞ ⎟ h ⎠

then if we multiply A by B and let matrix C hold the resulting product, the size of C is 2 × 2. We could multiply A by B because the number of columns in A, which is two, is equal to the number of rows in B, which is also two. The multiplication of A by B is C and it is ⎛ a C = AB = ⎜ ⎝ c

b ⎞⎛ e ⎜ d ⎟⎠ ⎝ g

f ⎞ ⎛ ae + bg ⎟ =⎜ h ⎠ ⎝ ce + dg

af + bh ⎞ ⎟ cf + dh ⎠

(6.9)

We multiply the first row of A, element by element, by all the columns of B. Similarly, we take the second row of A and multiply it by all the columns of B. Note that in general AB is not the same as BA. The rules for multiplication have to be observed.

State-Space and Discrete Systems

281

6.2.9 eiGenvalues of a matrix The eigenvalues of a matrix A are the roots of the determinant of (λI − A), where I is the identity matrix and λ is a variable.

6.2.10 DiaGonal form of a matrix A matrix A is in diagonal form if all elements in the matrix that are off the diagonal are zeros. If A is not diagonal, we can make it diagonal by finding the matrix P that contains the eigenvectors of A. So if A is not a diagonal matrix, then (P −1AP) will transform A into a diagonal matrix. If the eigenvalues of A are distinct (distinct means that no one eigenvalue is equal to the other), then P −1AP will look like a diagonal matrix, where the elements on the main diagonal are the eigenvalues of A. If some of the eigenvalues of A are repeated, then the matrix P −1AP will be in a block diagonal form or what is known as Jordan form.

6.2.11 eiGenvectors of a matrix The eigenvectors of a matrix A are the nonzero roots of the homogeneous matrix equation

( λ i I − A ) pi = 0

(6.10)

where pi is a column vector that represents the eigenvector for a certain eigenvalue λi. All eigenvectors must be independent. If we have n distinct eigenvalues, then we will have n independent eigenvectors for each eigenvalue, and each eigenvector is obtained as the nonzero solution to

( λ i I − A ) pi = 0. If A is n × n and we have n − k distinct eigenvalues (again distinct means no one eigenvalue is equal to any of the remaining n − 1 eigenvalues), then we will have n − k independent eigenvectors for each distinct eigenvalue and each eigenvector is obtained as the nonzero solution of (λiI − A)pi = 0. Each remaining eigenvalue in the set k of eigenvalues is therefore not distinct. We may have groups of repeated eigenvalues in the k set of eigenvalues. We will assume here that we have only one set, which is k and thus we have k repeated eigenvalues. The following procedure can be applied to other repeated sets in the set k. Assume that k = 3. Let the repeated eigenvalues be denoted as λr and let us denote the eigenvectors as p1r, p2r , and p3r . To find p1r, we will find the nonzero solution to (λrI − A)p1r = 0. To find p2r, we will find the nonzero solution to (λrI − A)p2r = p1r . To find p3r, we will find the nonzero solution to (λrI − A)p3r = p2r . These are called generalized eigenvectors corresponding to the three repeated eigen­ values. In some situations, even if we have repeated eigenvalues, we still can get independent eigenvectors if the matrix A is symmetric. We do that by finding a non­ zero solution to (λiI − A)pi = 0, where λi is the repeated eigenvalue.

282

6.3

Discrete Signals and Systems with MATLAB®

GENERAL REPRESENTATION OF SYSTEMS IN STATE SPACE

Thus far, we have seen many representations of discrete linear time-invariant sys­ tems. We have seen the difference equation representation, the block diagram repre­ sentation, the z-transform representation, and the impulse response representation. Given any representation we should be able to deduce the other. In this section, we will study the state-space representation starting with the difference equation. Using state-space representation, a difference equation of order n can be reduced to n firstorder difference equations.

6.3.1 recursive systems Consider the following fourth-order equation: y ( n ) − a1 y ( n − 1) − a2 y ( n − 2 ) − a3 y ( n − 3) − a 4 y ( n − 4 ) = b0 x ( n ) We will have four states v1 through v4 since we have a fourth-order difference equation. Let v1 ( n ) = 4y ( n −

)

v2 ( n ) = 3y ( n −

)

v3 ( n ) = 2y ( n −

)

v4 ( n ) = 1y ( n −

)

from which we write v1 ( n + 1 ) = y ( n − 4 + 1) = y ( n − 3) v2 ( n ) v2 ( n + 1 ) = y ( n − 3 + 1) = y ( n − 2 ) v3 ( n ) v3 ( n + 1 ) = y ( n − 2 + 1) = y ( n − 1) v4 ( n ) and we can also write the output as y ( n ) = a1 y ( n − 1) − a2 y ( n − 2 ) − a3 y ( n − 3) − a4 y ( n − 4 ) = b0 x ( n ) = a1 v4 ( n ) + a2 v3 ( n ) + a3 v2 ( n ) + a4 v1 ( n ) + b0 x ( n ) Therefore, we can finally write v1 ( n + 1) = v2 ( n ) v2 ( n + 1) = v3 ( n )

v3 ( n + 1) = v4 ( n ) v4 ( n + 1) = a4 v1 ( n ) + a3 v2 ( n ) + a2 v3 ( n ) + a1 v4 ( n ) + b0 x ( n )

283

State-Space and Discrete Systems

Notice that the right side of all of these four state equations is a function of the states v1(n) through v4(n) and the input. This should be the case. No term such as v1(n − 1) or v2(n − 3) should appear on the right side of these equations. We can now arrange the state equations in matrix form and write ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜⎝

v1 ( n + 1) ⎞ ⎛ ⎟ v2 ( n + 1) ⎟ ⎜ ⎟ =⎜ v3 ( n + 1) ⎟ ⎜ ⎟ ⎜ v4 ( n + 1) ⎟ ⎝ ⎠

0 0

1 0

 

0 a4

 

0 a3

0 1 0 a2

0 0

 

1 a1

⎞⎛ ⎟ ⎜⎜ ⎟ ⎟ ⎜⎜ ⎟⎜ ⎠⎝

v1 ( n ) ⎞ ⎛ ⎟ v2 ( n ) ⎟ ⎜ ⎟ +⎜ v3 ( n ) ⎟ ⎜ ⎜ v4 ( n ) ⎟ ⎜⎝ ⎠

0 0 0 b0





⎟ x (n) ⎟ ⎟ ⎟⎠

and for the output equation, we have ⎛ ⎜ ⎜ y ( n ) = ( a4 a3 a2 a1 ) ⎜ ⎜ ⎜ ⎝

v1 ( n ) v2 ( n ) v3 ( n ) v4 ( n )

⎞ ⎟ ⎟ ⎟ + b0 x ( n ) ⎟ ⎟ ⎠

with ⎛ ⎜ A=⎜ ⎜ ⎜ ⎝

0 0 0 a4

 

1 0 0 a3

 

0 1 0 a2

0 0

 

1 a1

⎛ ⎞ ⎜ ⎟ ⎟  B = ⎜ ⎜ ⎟ ⎜ ⎟ ⎜⎝ ⎠

0 0 0 b0





⎟   C = ( a   a a   a )  D = ( b ) 4 32 1 0 ⎟



⎟⎠

We can write the state and output equations in matrix form as v ( n + 1) = A v ( n ) + B x ( n ) y (n) = C v (n) + D x (n) When v(n + 1) is a 4 × 1 matrix, A is 4 × 4 matrix, B is 4 × 1 matrix, C is a 1 × 4 matrix, and D is a 1 × 1 matrix. Notice that these state equations are now in the form of a first-order matrix difference equation.

6.3.2 NoNrecursive systems Consider the following difference equation: y ( n ) = a0 x ( n ) + a1 x ( n − 1) + a2 x ( n − 2 ) + a3 x ( n − 3)

284

Discrete Signals and Systems with MATLAB®

Let v1 ( n ) = x ( n − 3) v2 ( n ) = x ( n − 2 ) v3 ( n ) = x ( n − 1) Then v1 ( n + 1) = x ( n − 2 ) = v2 ( n ) v2 ( n + 1) = x ( n − 1) = v3 ( n ) v3 ( n + 1) = x ( n ) and the output equation is y ( n ) = a0 x ( n ) + a1 x ( n − 1) + a2 x ( n − 2 ) + a3 x ( n − 3) Substituting the states in this output equation gives y ( n ) = a0 x ( n ) + a1 v3 ( n ) + a2 v2 ( n ) + a3 v1 ( n ) The state matrix equations are then ⎛ v1 ( n + 1) ⎜ ⎜ v2 ( n + 1) ⎜ ⎝ v3 ( n + 1)

⎞ ⎛ ⎟ ⎜ 0 ⎟ = ⎜ 0 ⎟ ⎝ 0 ⎠

1 0 0

0 1 0

⎞ ⎛ v1 ( n ) ⎟ ⎜ v2 ( n ) ⎟⎜ ⎠ ⎜⎝ v3 ( n )

⎛ v1 ( n ) ⎜ y ( n ) = ( a3   a2   a1 ) ⎜ v2 ( n ) ⎜ ⎝ v3 ( n )

⎞ ⎛ 0 ⎞ ⎟ ⎜ ⎟ ⎟ + ⎜ 0 ⎟ x (n) ⎟ ⎝ 1 ⎠ ⎠

⎞ ⎟ ⎟ + a0 x ( n ) ⎟ ⎠

where in this case, ⎛ 0 A=⎜ 0 ⎜ ⎝ 0

1 0 0

0 1 0

⎞ ⎛ 0 ⎞ ⎟  B = ⎜ 0 ⎟   C = (   a3  a2  a1 ) D = ( a0 ) ⎟ ⎜ ⎟ ⎝ 1 ⎠ ⎠

State-Space and Discrete Systems

285

6.3.3 From the Block Diagram to state space Consider the block diagram shown in Figure 6.1. To obtain the states from the block diagram, we need first to determine the order of the system so that we know how many states to consider. Then we will let the output of every delay represent a state. Since the system is second order, we will have two states v1(n) and v2(n). Let the out­ put of the first delay from the input side be denoted as v1(n). Then the input of this delay is v1(n + 1). Therefore, from the graph, we have v1 ( n + 1) = x ( n ) + a0 y ( n ) Let the output of the second delay be v2(n). Then v1 ( n + 1) = x ( n ) + a0 [ b0 x ( n ) + v2 ( n )] or v1 ( n + 1) = [1 + a0 b0 ] x ( n ) + a0 v2 ( n ) The input to the second delay is v2(n + 1) and is v2 ( n + 1) = v1 ( n ) + a1 y ( n ) = v1 ( n ) + a1 [ b0 x ( n ) + v2 ( n )] = v1 ( n ) + a1b0 x ( n ) + a1 v2 ( n ) Also, the output y(n) is y ( n ) = b0 x ( n ) + v2 ( n )

FIGURE 6.1

Block diagram representation 1.

286

Discrete Signals and Systems with MATLAB®

Therefore, the state and the output matrix equations are ⎛ v1 ( n + 1) ⎜ ⎜⎝ v2 ( n + 1)

⎞ ⎛ 0 ⎟ =⎜ ⎟⎠ ⎝ 1

y (n) =

(

0

a0 ⎞ ⎛ v1 ( n ) ⎜ a1 ⎠⎟ ⎝⎜ v2 ( n )

1

⎞ ⎛ 1 + a0 b0 ⎞ ⎟ +⎜ ⎟ x (n) a1b0 ⎠ ⎠⎟ ⎝

⎛ v1 ( n ) ⎞ ⎟ + b0 x ( n ) ⎝ v2 ( n ) ⎟⎠

) ⎜⎜

where ⎛ 0 A=⎜ ⎝ 1

⎛ 1 + a0 b0 ⎞ a0 ⎞  B = ⎜ ⎟  C = ⎟ a1b0 a1 ⎠ ⎝ ⎠

(

0

1

)  D = ( b ) 0

Consider another block diagram shown in Figure 6.2. This system is third order and must have three states. Let the output of the first delay from the input side be v1(n), the output of the second delay be v2(n), and the output of the last delay be v3(n). The input of the first delay is v1 ( n + 1) = x ( n ) + a0 v1 ( n ) The input of the second delay is v2 ( n + 1) = v1 ( n ) + a1 v2 ( n ) The input of the third delay is v3 ( n + 1) = v2 ( n ) + a2 v3 ( n ) The output y(n) is y ( n ) = v3 ( n )

FIGURE 6.2 Block diagram representation 2.

287

State-Space and Discrete Systems

We then have the state-space system in matrix form as ⎛ v1 ( n + 1) ⎜ ⎜ v2 ( n + 1) ⎜ ⎝ v3 ( n + 1)

⎞⎛ a ⎟⎜ 0 ⎟⎜ 1 ⎟⎜ 0 ⎠⎝

y (n) =

(

0 a1 0

0

0

0 0 a2

)

1

⎞ ⎛ v1 ( n ) ⎟⎜ v n ⎟⎜ 2( ) ⎟⎠ ⎜ v3 ( n ) ⎝

⎛ v1 ( n ) ⎜ ⎜ v2 ( n ) ⎜ v3 ( n ) ⎝

⎞ ⎛ 1 ⎞ ⎟ ⎜ ⎟ ⎟ + ⎜ 0 ⎟ x (n) ⎟ ⎝ 0 ⎠ ⎠

⎞ ⎟ ⎟ + (0) x (n) ⎟ ⎠

where ⎛ a0 A = ⎜⎜ 1 ⎝⎜ 0

6.3.4

0 a1 0

0 0 a2

⎞ ⎛ 1 ⎞ ⎟  B = ⎜ 0 ⎟  C = ⎟ ⎜ ⎟ ⎝ 0 ⎠ ⎠⎟

(

0

0

1

) 0D = (

)

from the transfer function H(z) to state space

Given H(z), the transfer function is the z-domain. We can obtain the state-space real­ ization in many ways. We will illustrate that using an example. Example 6.1 Consider the following system:

H ( z) =

z − 4

z 2 + 5z + 6

What is the state-space representation?

SOLUTION 1. Using direct realization, the block diagram for H(z) is shown in Figure 6.3. Let the output of the first delay be v1(n). Then, v1 ( n + 1) = −4x ( n) − 6y ( n) = −4x ( n) − 6 ⎣⎡v 2 ( n) ⎤⎦ −6v 2 ( n) − 4x ( n)

288

Discrete Signals and Systems with MATLAB®

FIGURE 6.3

Block diagram for Example 6.1.

where v2(n) is the output of the second delay. Also, v 2 ( n + 1) = v1 ( n) − 5v 2 ( n) = v1 ( n) − 5⎡x ⎣ ( n) + v 2 ( n) ⎤⎦ = v1 ( n) − 5v 2 ( n) The output is y ( n) = v 2 ( n) Then the state-space representation is ⎛ v1 ( n + 1) ⎜ ⎜⎝ v 2 ( n + 1)

⎛ −6 ⎞ ⎜ v1 ( n) ⎟ −5 ⎠ ⎜ v 2 ( n) ⎝

⎞ ⎛ ⎟ =⎜ 0 1 ⎠⎟ ⎝

y ( n) =

(

0

1

⎞ ⎛ ⎞ ⎟ + ⎜ −4 ⎟ x ( n) ⎟⎠ ⎝ 0 ⎠

⎛ v1 ( n) ⎞ ⎟ + ( 0 ) x ( n) ⎝ v 2 ( n) ⎟⎠

) ⎜⎜

With

⎛ 0 A=⎜ ⎝ 1

⎛ −4 ⎞

−6 ⎞  B = ⎜ ⎟  C = −5 ⎟⎠ ⎝ 0 ⎠

(

0

1

) D0 = (

)

2. The transfer function can also be written as

H ( z) =

z − 4 1

z2 + 2 z + 3

This is what we call the cascade system realization, and the block dia­ gram can be drawn as in Figure 6.4. Again the system is still second order

289

State-Space and Discrete Systems

FIGURE 6.4 Block diagram for Example 6.1 in cascade form.

and if we let the output of the first delay be v1(n) and the output of the second delay be v2(n), then v1 ( n + 1) = −4x ( n) − 2x ( n) − 2v1 ( n) v 2 ( n + 1) = x ( n) + v1 ( n) − 3y ( n) = x ( n) + v1 ( n) − 3 ⎡v ⎣ 2 ( n) ⎤⎦ The output is y ( n) = v 2 ( n) We can now clean the previous state equations and write v1 ( n + 1) = −2v1 ( n) − 6x ( n) v 2 ( n + 1) = v1 ( n) − 3v 2 ( n) + 1x ( n) y ( n) = v 2 ( n) with ⎛ v1 ( n + 1) ⎜ ⎜⎝ v 2 ( n + 1)

⎞ ⎛ ⎟ = ⎜ −2 ⎟⎠ ⎝ −1

y ( n) =

(

0

⎛ 0 ⎞ ⎜ v1 ( n) −3 ⎟⎠ ⎜ v 2 ( n) ⎝

1

⎞ ⎛ ⎞ ⎟ + ⎜ −6 ⎟ x ( n) −1 ⎠ ⎠⎟ ⎝

⎛ v1 ( n) ⎞ ⎟ + ( 0 ) x ( n) ⎟⎠ v n ( ) 2 ⎝

) ⎜⎜

Where ⎛ −2 A=⎜ ⎝ −1

⎛ −6 ⎞ 0 ⎞  B = ⎜ ⎟ ⎟  C = −3 ⎠ ⎝ −1 ⎠

(

0

1

) D0 = (

)

290

Discrete Signals and Systems with MATLAB®

FIGURE 6.5

Block diagram for Example 6.1 in parallel form.

3. We can also write H(z) in a parallel realization form as H ( z) =

−6 −7 z+2 z+3

The block diagram is shown in Figure 6.5. Let v1(n) be the output of the upper delay and v2(n) be the output of the lower delay. Then v1 ( n + 1) = −6x ( n) − 2v1 ( n) and v 2 ( n + 1) = −7x ( n) − 3v 2 ( n) The output is y ( n) = v1 ( n) + v 2 ( n) The state-space system is then ⎛ v1 ( n + 1) ⎜ ⎜⎝ v 2 ( n + 1)

⎞ ⎛ −2 ⎟ =⎜ ⎜ 0 ⎠⎟ ⎝

y ( n) =

(

1

0 ⎞ ⎛ v1 ( n) ⎟⎜ −3 ⎟⎠ ⎜ v 2 ( n) ⎝

1

⎞ ⎛ ⎞ ⎟ + ⎜ −6 ⎟ x ( n) ⎟⎠ ⎝ 7 ⎠

⎛ v1 ( n) ⎞ ⎟ + ( 0 ) x ( n) ⎝ v 2 ( n) ⎠⎟

) ⎜⎜

with ⎛ −2 A=⎜ ⎝ 0

⎛ −6 ⎞ 0 ⎞  B = ⎜ ⎟  C = −3 ⎟⎠ ⎝ 7 ⎠

(

1

1

) D0 = (

)

291

State-Space and Discrete Systems 4. Let us now draw a simulation diagram from

H ( z) =

z − 4

z 2 + 5z + 6

that is different from the diagram we drew earlier in this example. From H ( z) =

Y ( z) X ( z)

we have Y ( z ) ⎡⎣ z 2 + 5z + 6 ⎤⎦ = X ( z ) [ z − 4 ] By taking the inverse z-transform, we get the following difference equation: 6y ( n) + 5y ( n + 1) + y ( n + 2) = −4x ( n) + x ( n + 1) This is a second-order difference equation and its block diagram is shown in Figure 6.6. Let the output of the first delay on the top be v2(n) and the output of the lower delay be v1(n). Then we have the state and the output equations as v 2 ( n + 1) = x ( n) − 5v 2 ( n) − 6v1 ( n) v1 ( n + 1) = v 2 ( n) y ( n) = v 2 ( n) − 4v1 ( n)

FIGURE 6.6

Block diagram for Example 6.1.

292

Discrete Signals and Systems with MATLAB® Then the matrix state-space representation is ⎛ v1 ( n + 1) ⎜ ⎝⎜ v 2 ( n + 1)

⎞ ⎛ 0 ⎟ =⎜ ⎟⎠ ⎝ −6 y=

(

−4

⎛ v1 ( n) 1 ⎞ ⎟⎜ −5 ⎠ ⎝⎜ v 2 ( n) 1

⎞ ⎛ ⎞ ⎟ + ⎜ 0 ⎟ x ( n) ⎟⎠ ⎝ 1 ⎠

⎛ v1 ( n) ⎞ ⎟ + ( 0 ) x ( n) ⎝ v 2 ( n) ⎟⎠

) ⎜⎜

with ⎛ 0 A=⎜ ⎝ −6

⎛ 0 ⎞ 1 ⎞ ⎟  B = ⎜ ⎟  C = −5 ⎠ ⎝ 1 ⎠

(

0

−4

1

) D0 = ( )

Notice that in all of these four state-space realizations we had different A, B, C, and D matrices. To check that each system is a true realization, the eigenvalues in each case should be the same. In case 1, ⎛ 0 A=⎜ ⎝ 1

−6 ⎞ −5 ⎠⎟

and the eigenvalues for the system are the roots of the determinant of (λI − A). ⎛ 1 λ⎜ ⎝ 0

0 ⎞ ⎛ 0 − 1 ⎟⎠ ⎜⎝ 1

−6 ⎞ ⎛ λ = −5 ⎟⎠ ⎜⎝ −1

⎞ 6 λ + 5 ⎟⎠

det (λI − A) = λ2 + 5λ + 6 and the eigenvalues are at −2 and −3. In case 2 ⎛ −2 A=⎜ ⎝⎜ 1

⎛ λ+2 0 ⎞ ⎟ and det ( λI  −  A ) = det ⎜ ⎟ −3 ⎠ 1 ⎝

⎞ 0 = λ 2 + 5λ + 6 ⎟ λ+3 ⎠

The eigenvalues are at −2 and −3. In case 3, ⎛ −2 A=⎜ ⎜⎝ 0

⎛ λ+2 0 ⎞ ⎟ and det(λI  − )A = det ⎜ −3 ⎟⎠ 1 ⎝

⎞ 0 = λ 2 + 5λ + 6 λ + 3 ⎠⎟

The eigenvalues are at −2 and −3. In the last case, ⎛ 0 A=⎜ ⎝ −6

1 ⎞ A) = λ2 + λ + 6 ⎟ and det ( λI  − 5 −5 ⎠

The eigenvalues are at −2 and −3.

293

State-Space and Discrete Systems

Example 6.2 Consider the system b0 z 5 + b1z 4 + b2z 3 + b3z 2 + b4 z + b5

z 5 + a1z 4 + a2z 3 + a3z 2 + a4 z + a5

with the coefficient of z5 in the denominator always unity. What is the state-space representation? SOLUTION We start by the block diagram shown in Figure 6.7. From the graph we see that the state equations are v1 ( n + 1) = v 2 ( n)



v 2 ( n + 1) = v3 ( n)



v3 ( n + 1) = v 4 ( n)



v 4 ( n + 1) = v5 ( n)



v5 ( n + 1) = x ( n) − a1v5 ( n) − a2v 4 ( n) − a3v3 ( n) − a4v 2 ( n) − a5 v1 ( n)

FIGURE 6.7

Block diagram for Example 6.2.

294

Discrete Signals and Systems with MATLAB®

and the output equation is y ( n) = ( b5 − a5b0 ) v1 ( n) + ( b4 − a4b0 ) v 2 ( n) + ( b3 − a3b0 ) v3 ( n) + ( b2 − a2b0 ) v 4 ( n) + ( b1 − a1b0 ) v5 ( n) + b0 x ( n)

The state equations and the output equation in state-space matrix form are ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝

⎛ v1 ( n + 1) ⎞ ⎛ 0 0 1 0 0 ⎞⎜ ⎟ ⎜ ⎟ v 2 ( n + 1) ⎟ ⎜ 0 1 0 0 0 ⎟⎜ ⎟ ⎜ ⎟⎜ v3 ( n + 1) ⎟ = ⎜ 0   0   0   1   0 ⎟ ⎜ ⎟ ⎜ 0 0 0 1 ⎟⎜ v 4 ( n + 1) ⎟ ⎜⎜ 0 ⎟ ⎟ −a3 −a4 −a2 −a1 ⎟ ⎜ v5 ( n + 1) ⎟ ⎜⎝ −a5 ⎠ ⎜⎝ ⎠

v1 ( n) ⎞ ⎟ ⎛ 0 ⎞

v 2 ( n) ⎟ ⎜ 0 ⎟ ⎟ ⎜ ⎟

v3 ( n) ⎟ + ⎜ 0 ⎟ x ( n ) ⎟ ⎜ ⎟

v 4 ( n) ⎟ ⎜ 0 ⎟

⎟ ⎜ 1 ⎟⎠ v 5 ( n) ⎟ ⎝ ⎠

⎛ ⎜ ⎜ ⎜ y ( n) = ⎣⎡( b5 − a5b0 )( b4 − a4 b0 )( b3 − a3b0 )( b2 − a2b0 )( b1 − a1b0 ) ⎦⎤ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝

v1 ( n) ⎞ ⎟ v 2 ( n) ⎟ ⎟ v3 ( n) ⎟ + ( b0 ) x ( n) ⎟ v 4 ( n) ⎟ ⎟ v 5 ( n) ⎟ ⎠

Example 6.3 Given the system H ( z) =

2z 2 + 3z 2 + 4z + 8 z 2 + 5z 2 + 6z + 10

What is the state-space representation? Find A, B, C, and D.

SOLUTION From Example 6.2, we can write these matrices by inspection and get ⎛ 0 ⎜ A=⎜ 0 ⎜⎝ −10 C=

(

8 − 10 ( 2)

4 − 6 ( 2)

1 0 −6

0 ⎞ ⎛ 0 ⎞ ⎟ 1 ⎟  B = ⎜⎜ 0 ⎟⎟ ⎝⎜ 1 ⎟⎠ −5 ⎟⎠

3 − 5 ( 2)

)=(

−12

−8

−7

) D2 = (

)

295

State-Space and Discrete Systems

6.4 SOLUTION OF THE STATE-SPACE EQUATIONS IN THE z-DOMAIN We are given the state-space system v ( n + 1) = Av ( n ) + Bx ( n ) y ( n ) = Cv ( n ) + Dx ( n ) By taking the z-transform on the previous state equations, we will get zV ( z ) − zv ( 0 ) = AV ( z ) + BX ( z ) Notice that z is a scalar and cannot be subtracted from A. Therefore, we write the previous equations as

( zI − A ) V ( z ) = zv ( 0 ) + BX ( z ) where I is the identity matrix. Solving the previous equation for the states, we get V ( z ) = z ( zI − A ) v ( 0 ) + ( zI − A ) BX ( z ) −1

−1

(6.11)

v(n) is the inverse transform of the previous equation. For the output y(n), we have Y ( z ) = CV ( z ) + DX ( z ) = C ⎡⎣ z ( zI − A ) v ( 0 ) + ( zI − A ) BX ( z ) ⎦⎤ + DX ( z ) −1

−1

This is a good place to try to find H(z) from the state-space equations. With v(0) = 0, we have Y ( z ) = CV ( z ) + DX ( z ) Y(z) ⎡ −1 = ⎣ C ( zI − A ) B + D ⎤⎦ X(z) or Y(z) ⎡ −1 = C ( zI − A ) B + D ⎤ ⎦ X ( z ) ⎣

6.5 GENERAL SOLUTION OF THE STATE EQUATION IN REAL TIME The state equation in matrix form is repeated here v ( n + 1) = Av ( n ) + Bx ( n )

(6.12)

296

Discrete Signals and Systems with MATLAB®

Assume that the initial condition vector v(0) is known for n = 0. For n = 0, the state equation becomes v (1) = Av ( 0 ) + Bx ( 0 ) For n = 1, the state equation is v ( 2 ) = Av (1) + Bx (1) If we substitute v(1) in the equation for v(2), we get A [ Av ( 0 ) + Bx ( 0 )] + Bx (1) = A 2 v ( 0 ) + ABx ( 0 ) + Bx (1) For n = 2, the state equation is 2 v ( 3) = Av ( 2 ) + Bx ( 2 ) = A ⎡A ⎣ v ( 0 ) + ABx ( 0 ) + Bx (1)⎤⎦ + Bx ( 2 )

= A3 v ( 0 ) + A 2 Bx ( 0 ) + ABx (1) + Bx ( 2 ) From the previous equation, we deduce that for n ≥ 0 the states are given by v ( n ) = An v ( 0 ) +

n−1

∑A

Bx ( k )

( n −1− k )

(6.13)

k =0

Let An = φ(n) the state transition matrix. Then the solution for v(n) becomes v ( n ) = ϕ ( n) v ( 0 ) +

n−1

∑ϕ ( n − 1 − k ) Bx ( k )

(6.14)

k −0

y ( n ) = Cϕ ϕ ( n) v ( 0 ) +

n−1

∑Cϕϕ ( n − 1 − k ) Bx ( k ) + Dx ( n)

(6.15)

k =0

In general, we do not attempt to solve for An as a function of n. But we use recursion to solve for v(n). Now let us compare the solutions for the state vector using the time domain given by v ( n ) = ϕ ( n) v ( 0 ) +

n−1

∑ϕ ( n − 1 − k ) Bx ( k ) k =0

and the solution using the z-domain given as V ( z ) = z ( zI − A ) v ( 0 ) + ( zI − A ) BX ( z ) −1

−1

297

State-Space and Discrete Systems

A close look at these solutions reveals that the transition matrix is found by compar­ ing the coefficients of v(0) and it is the inverse transform of z ( zI − A )

6.6

−1

(6.16)

PROPERTIES OF AN AND ITS EVALUATION

In real time, we will use the computer to solve for the states v(n). We can also use the z-transform method to find a closed-form solution for the states if the system order is reasonably low. The transition matrix An has some interesting properties. 1. The response to a system with zero input is

v ( n ) = φ ( n) v ( 0 ) For n = 0, v(0) = φ(0)v(0). This indicates that φ(0) = I, where I is the identity matrix. This result is useful if we want to confirm the correctness of φ(n). 2. With ϕ(n) = An, let n = n1 + n2 to write φ ( n1 + n2 ) = A n1 + n2 = A n1 A n2 = φ ( n1 ) φ ( n2 ) 3. With ϕ(n) = An, let n = −m to get φ ( −m ) = A − m = ( A m ) = φ−1 ( m ) −1

Thus, we can write φ−1 ( n ) = φ ( −n ) Example 6.4 Consider the following system: ⎛ −1 v ( n + 1) = ⎜ ⎜⎝ 0 y ( n) =

(

0

0 ⎞ ⎛ 0 ⎞ ⎟ v ( n) + ⎜ ⎟ x ( n) −2 ⎟⎠ ⎝ 1 ⎠ 1

) v ( n )

Find the states and the output, v(n) and y(n).

⎛ 0 ⎞ with x(n) = 0. ⎝ 1 ⎠⎟

Let v ( 0 ) = ⎜

298

Discrete Signals and Systems with MATLAB® SOLUTION

In real time, we can use recursion to solve for v(n) and y(n). The state solution is v ( n) = A nv ( 0 ) +

n−1

∑A(

Bx ( k )

n −1−k )

k =0

But with x(n) = 0, v ( n) = A nv ( 0 ) Now we start the iteration and write ⎛ −1 v (1) = Av ( 0 ) = ⎜ ⎜⎝ 0

0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ =⎜ ⎟ ⎟ −2 ⎟⎠ ⎜⎝ 1 ⎟⎠ ⎝ −2 ⎠

⎛ −1 v ( 2) = Av (1) = ⎜ ⎜⎝ 0

0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ ⎟⎜ ⎟= −2 ⎠⎟ ⎝ −2 ⎠ ⎜⎝ 4 ⎟⎠

⎛ −1 v ( 3) Av ( 2) = ⎜ ⎝⎜ 0

0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ =⎜ ⎟ ⎟ −2 ⎟⎠ ⎜⎝ 4 ⎟⎠ ⎝ −8 ⎠

and so on. But since A is in a diagonal form, we have ⎛ An = ⎜ ⎜ ⎝

( −1)n

0

0

( −2)n

⎞ ⎟ ⎟ ⎠

and therefore the state solution is ⎛ 0 ⎞ v ( n) = A n ⎜ ⎟ ⎝ 1 ⎠ Thus, ⎛ 0 ⎞ ⎛ 1 v (0) = A 0 ⎜ ⎟ =⎜ ⎝ 1 ⎠ ⎝ 0 ⎛ −1 v (1) = ⎜ ⎝⎜ 0 ⎛ 1 v ( 2) = ⎜ ⎝ 0 ⎛ −1 v ( 3) = ⎜ ⎜⎝ 0

0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ = 1 ⎟⎠ ⎜⎝ 1 ⎟⎠ ⎜⎝ 1 ⎟⎠

0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ =⎜ ⎟ ⎟ −2 ⎠⎟ ⎜⎝ 1 ⎟⎠ ⎝ −2 ⎠ 0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ = 4 ⎠⎟ ⎝⎜ 1 ⎠⎟ ⎝⎜ 4 ⎠⎟ 0 ⎞⎛ 0 ⎞ ⎛ 0 ⎞ =⎜ ⎟ ⎟ −8 ⎟⎠ ⎜⎝ 1 ⎟⎠ ⎝ −8 ⎠

299

State-Space and Discrete Systems Finally, the closed-form solution is ⎛ v ( n) = ⎜ ⎜ ⎝

( −1)n

0

0

( −2)n

⎞ ⎟ ⎟ ⎠

v (0)

n≥0

Using the z-transform, we have V ( z ) = z ( zI − A ) v ( 0 ) + ( zI − A ) BX ( z ) −1

−1

But again with x(n) = 0, we have

⎛ z ⎝ 0

0 ⎞ ⎛ −1 − z ⎟⎠ ⎝⎜ 0

( zI − A ) = ⎜ ⎛ ⎜ ( zI − A )−1 = ⎜⎜ ⎜ ⎜⎝

z+2 ( z + 1) ( z + 2)

0 ⎞ ⎛ z +1 = 0 −2 ⎟⎠ ⎜⎝ ⎞ ⎛ ⎟ ⎜ ⎟ =⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎠ ⎝

0

( z + 1)( z + 2) z +1

0

( z + 1)( z + 2)

( z + 1)( z + 2)



0 z + 2 ⎠⎟ ⎞ ⎟ ⎟ 1 ⎟ z + 2 ⎟⎠

1 z +1

0

0

Now, we substitute this matrix inversion in the states solution to get ⎛ ⎜ V (z) = z ⎜ ⎜ ⎜⎝

1 z +1 0

⎞ ⎛ ⎟⎛ ⎞ ⎟⎜ 0 ⎟ =⎜ 1 ⎟ ⎝ 1 ⎠ ⎜⎜ ⎝ z + 2 ⎟⎠

0

0 z z+2

⎞ ⎟ ⎟ ⎟⎠

and the inverse of V(z) is v(n) which is

⎛ v ( n) = ⎜ ⎝⎜

0

( −2) u ( n) n

⎞ ⎟ ⎠⎟

For comparison we find the first few values next. ⎛ 0 ⎞ v (0) = ⎜ ⎟ ⎝ 1 ⎠

⎛ 0 ⎞ v (1) = ⎜ ⎟ ⎝ −2 ⎠

⎛ 0 ⎞ v ( 2) = ⎜ ⎟ ⎝ 4 ⎠

⎛ 0 ⎞ v ( 3) = ⎜ ⎟ ⎝ −8 ⎠

We can also see that the inverse z-transform of ⎛ ⎜ −1 z ( zI − A ) = ⎜ ⎜ ⎜⎝

z z +1 0

⎞ ⎟ ⎟ z ⎟ z + 2 ⎟⎠ 0

300

Discrete Signals and Systems with MATLAB®

is ⎛ φ ( n) = ⎜ ⎜ ⎝

( −1)n u ( n)

0

0

( −2)n u ( n)

⎞ ⎟ ⎟ ⎠

as obtained earlier in real time. You can also see here that the transition matrix at n = 0 is

⎛ 1 φ ( 0 ) = ⎜ ⎝ 0

0 ⎞ 1 ⎟⎠

which is the identity matrix.

6.7

TRANSFORMATIONS FOR STATE-SPACE REPRESENTATIONS

Let us define another state vector called w(n) such that w ( n ) = Pv ( n )

(6.17)

where P is called the transformation matrix. With w(n) = Pv(n), we have v ( n ) = P −1w ( n )

(6.18)

But we know that the original state equation is v ( n + 1) = Av ( n ) + Bx ( n ) and using the new transformation, we have v ( n + 1) = P −1w ( n + 1)

(6.19)

Then, by substituting in the original state equation, we get P −1w ( n + 1) = AP −1w ( n ) + Bx ( n )

(6.20)

Multiply both sides of Equation (5.20) by P to get w ( n + 1) = PAP −1w ( n ) + PBx ( n )

(6.21)

and for the output, we have y ( n ) = CP −1w ( n ) + ( D ) x ( n )

(6.22)

301

State-Space and Discrete Systems

These are the new state and output equations. The transfer function of the original system is Hold ( z ) = C ( zI − A ) B + D For the new system, the transfer function is

(

H new ( z ) = CP −1 zI − PAP −1

(

H new ( z ) = CP −1 zPP −1 − PAP

)

−1 −1

)

−1

PB + D −1

PB + D = CP −1 ⎣⎡ P ( zI − A ) P −1 ⎤⎦ PB + D (6.23)

Knowing that I = PP −1

( LMN )−1 = N −1M −1L−1

and

we write the new transfer function as H new ( z ) = CP −1P ( zI − A ) P −1 PB + D = C ( zI − A ) B + D −1

−1

(6.24)

You can see clearly now that Hold ( z ) = H new ( z ) This also means that the eigenvalues are the same for the new transformed system. Assume that the old system has the initial condition vector v(0). Then with w(n) = Pv(n), w ( 0 ) = Pv ( 0 )

(6.25)

P −1w ( 0 ) = v ( 0 )

(6.26)

and

The solutions of the old system in z-domain for the states and the outputs are V ( z ) = z ( z I − A ) v ( 0 ) + ( zI − A ) BX ( z )

(6.27)

Y ( z ) = CV ( z ) + DX ( z )

(6.28)

−1

−1

and the solutions of the new system in the z-domain are

(

)

W ( z ) = z z I − PAP −1

−1

(

w ( 0 ) + zI − PAP −1

Y ( z ) CP −1 W ( z ) + DX ( z )

)

−1

PBX ( z )

(6.29) (6.30)

302

Discrete Signals and Systems with MATLAB®

If the matrix P is the matrix that contains the eigenvectors of A, then PAP−1 is a diag­ onal or a block diagonal matrix depending on the eigenvalues of A as we discussed at the beginning of the chapter. When the matrix A is transformed into a diagonal matrix, where the eigenvalues are located on the main diagonal, the state equations are decoupled and can be solved one by one easily.

6.8

SOME INSIGHTS: POLES AND STABILITY

The objective of this chapter is to represent linear systems in state-space form and to look for ways of solving for the states. In that, the process was to represent an nth-order system (nth-order difference equation) as n first-order difference equations and arrange these equations in what we call state-space representation as v ( n + 1) = Av ( n ) + BX ( n ) y ( n ) = Cv ( n ) + Dx ( n ) where x is the input vector (assuming multiple inputs). y is the output vector (assuming multiple outputs). The v vector is the vector that contains the states of the system. The A matrix is the matrix that contains the parameters that control the dynamics of the system. As we saw in previous chapters, in every system representation, there was a way to find the eigenvalues of the system. In state-space representation, the roots of the determinant of the matrix, (sI − A), where I is the identity matrix, are the eigenvalues of the sys­ tem, the poles. And as we mentioned before, these poles determine the shape of the transients of the system under investigation. Consider the case where the dynamics matrix A is ⎛ 0 A=⎜ ⎝ −6 ⎛ λ ⎝ 0

( λI − A ) = ⎜

0 ⎞ ⎛ 0 − λ ⎠⎟ ⎝⎜ −0

1 ⎞ −5 ⎟⎠ 1 ⎞ ⎛ λ = −5 ⎠⎟ ⎝⎜ 6

−1 ⎞ λ + 5 ⎟⎠

The eigenvalues are the roots of the determinant of (λI − A). They are the roots of λ2 + 5λ + 6 = 0. The eigenvalues are at −3 and −2. Thus, we expect a solution that will contain the terms c1(−3)n + c2(−2)n. The stability of this system depends entirely on the eigenvalues, not on the constants c1 and c2. These eigenvalues are the roots of (λI − A). They are also the roots of the characteristic equation derived from the difference equation and also the roots of the denominator in the transfer function representing the system in the z-domain. To summarize, if the system is given in state-space form, the stability of the sys­ tem is determined by finding the roots of det(λI − A). If all the roots are within the

303

State-Space and Discrete Systems

unit circle, the system is stable. If one of the roots is not, the system is unstable. And again, the roots will determine the shape of the transients.

6.9 END-OF-CHAPTER EXAMPLES EOCE 6.1 Consider the following matrices: ⎛ −2 A = ⎜ ⎜⎝ 0

0 ⎞ ⎟ −3 ⎟⎠

⎛ 0 ⎞ B=⎜ ⎟ ⎝ 1 ⎠

C=

(

1

2

)

D = ( 5)

Find the following: 1. 2. 3. 4. 5.

AB − B and (AB)T + C A− and AA− 1 The eigenvalues for A and A 2 CDB + D BC − A SOLUTION

We will use MATLAB to find the answers to the previous questions. The MATLAB script is EOCE6_1. The result is ®

ABminusB =

0 −4

−1 −1



−0.5000 0

invA = 0 −0.3333

  1 0

AinvA = 0 1

−3

eigA = −2

4

eigAA = 9

CDBplusD = 15

2 0

BCminusA = 1 5 ABtransplusC =

EOCE 6.2 Consider the following matrices: ⎛ 2 A=⎜ ⎝ 0

9 ⎞ 1 ⎟⎠

⎛ 1 B=⎜ ⎝ 0

2 ⎞ 1 ⎟⎠

⎛ 1 C=⎜ ⎝ 0

0 ⎞ 1 ⎠⎟

304

Discrete Signals and Systems with MATLAB®

Find 1. 2. 3. 4. 5.

Eigenvalues for A and B A− and B−1 (AB) − and B− A−1 BCBC and CA−1 (CA) −1 and (BC) −1 A SOLUTION

MATLAB is used again here. The script is EOCE6_2. The result is Ainv = 0.5000 −4.5000 0 1.0000 1 −2 Binv = 0 1

0.5000 −6.5000

ABinv = 0 1.0000

BinvAinv = 0.5000 −6.5000

0 1.0000

1 4

BCBC = 0 1

0.5000 −4.5000

CinvA = 0 1.0000 CAinv = 0.5000 −4.5000 0 1.0000 2 7 BCinvA = 0 1

EOCE 6.3 Consider the following matrices: ⎛ −1 A=⎜ ⎝ 0

0 ⎞ −2 ⎟⎠

⎛ −3 B=⎜ ⎝ 0

0 ⎞ 4 ⎟⎠

⎛ 1 C=⎜ ⎝ 0

1 ⎞ 2 ⎟⎠

1. Find eigenvalues and eigenvectors for A and B. 2. Find eigenvalues and eigenvectors for A 2 and B2. 3. Put C in the diagonal form by first calculating P, the matrix of the eigen­ vector for C. 4. What are the eigenvectors and eigenvalues of P−1CP? SOLUTION We will use MATLAB again. The MATLAB command [V, D] = eig(A, B)

produces a diagonal matrix D of eigenvalues usually on the main diagonal and a matrix V with eigenvector columns. The script is EOCE6_3.

305

State-Space and Discrete Systems The result is Aeigvectors = 0 1

1 0

0

Aeigenvalues = −2 0 −1

Beigvectors = 1 0

0 1

−3 0

Beigenvalues = 0 4

1 0

AAeigvectors = 0 1

AAeigenvalues = 1 0

0 4

1 0

BBeigvectors = 0 1

9 0

BBeigenvalues = 0 16 07071 Pofeigenvectors = 1.0000 0 0.7071 1 0 Cindiagonalform = 0 2

1 0

PinvCPeigvectors = 0 1 PinvCPeigenvalues = 1 0

0 2

EOCE 6.4 Put the following system in state-space form: y ( n) − 2y ( n − 1) + 3y ( n − 3) = 4x ( n) SOLUTION Let v1 ( n) = y ( n − 3) v 2 ( n) = y ( n − 2) v3 ( n) = y ( n − 1) We have three states since our system is third order. Thus, we have v1 ( n + 1) = y ( n − 2) = v 2 ( n) v 2 ( n + 1) = y ( n − 1) = v3 ( n) v3 ( n + 1) = 2y ( n − 1) − 3y ( n − 3) + 4x ( n) = 2v3 ( n) − 3v1 ( n) + 4x ( n)

306

Discrete Signals and Systems with MATLAB®

The output y(n) is

y ( n) = 2v3 ( n) − 3v1 ( n) + 4x ( n)



and the state and output equations are

⎛ 0 ⎜ v ( n + 1) = ⎜ 0 ⎝⎜ −3 y ( n) =

(

−3

0

0 ⎞ ⎛ 0 ⎞ ⎟ 1 ⎟  v ( n) + ⎜⎜ 0 ⎟⎟ x ( n) ⎜⎝ 4 ⎟⎠ 2 ⎟⎠

0

2

1 0

) v ( n) + ( 4 ) x ( n)

EOCE 6.5 Consider the following system:

H ( z) =

2z + 1

z 3 + 3z 2 + 2z + 8

Write the state and output equations for this system.

SOLUTION We can deduce the difference equation from H(z) first, then find the state equations. From the transfer function, we can write Y ( z ) ⎡⎣ z 3 + 3z 2 + 2z + 1⎤⎦ = [ 2z + 1] X ( z ) By taking the inverse transform, we get

y ( n) + 2y ( n + 1) + 3y ( n + 2) + y ( n + 3) = x ( n) + 2x ( n + 1 ) Let us draw the block diagram first. The block diagram is shown in Figure 6.8. From the figure, we see that the states are v3 ( n + 1) = x ( n) − 3v3 ( n) − 2v 2 ( n) − v1 ( n) v 2 ( n + 1) = v3 ( n) v1 ( n + 1) = v 2 ( n)



and the output is

y ( n) = v1 ( n) + 2v 2 ( n)

307

State-Space and Discrete Systems

FIGURE 6.8

Block diagram for EOCE 6.5.

From the state and the output equations, we can form the state-space matrix equations as ⎛ 0 1 v ( n + 1) = ⎜ 0 0 ⎜ ⎝⎜ −1 −2 y ( n) =

(

1

2

0 1 −3 0

⎞ ⎛ 0 ⎞ ⎟  v ( n) + ⎜ 0 ⎟ x ( n) ⎟ ⎜ ⎟ ⎝⎜ 1 ⎠⎟ ⎠⎟

) v ( n) + ( 0 ) x ( n)

We can also write different state equations using Example 6.2. Referring to Example 6.2, we have H ( z) =

b0 z 3 + b1z 2 + b2z + b3 0z 3 + 0z 2 + 2z + 1 = 3 z 3 + a1 z 2 + a2z + a3 z + 3z 2 + 2z + 1

in our present case. Then by inspection, we have ⎛ 0 ⎜ v ( n + 1) = ⎜ 0 ⎜⎝ −1

(

y ( n) = b3 − a3 ( b0 )

1 0 −2

0 ⎞ ⎛ 0 ⎞ ⎟ 1 ⎟ v ( n) + ⎜⎜ 0 ⎟⎟ x ( n) ⎜⎝ 1 ⎟⎠ −3 ⎠⎟

b2 − a2 ( b0 )

)

b1 − a1 ( b0 ) v ( n) + b0 x ( n)

308

Discrete Signals and Systems with MATLAB®

After substitution, we arrive at

y ( n) =

(

1

2

0

) v ( n) + ( 0 ) x ( n)



EOCE 6.6 Consider the following system in Figure 6.9. Write the state equations in matrix form.

SOLUTION Let the output of the first delay be v1(n), v2(n) for the second delay, and v3(n) for the third delay. Then the state equations are v1 ( n + +1) = x ( n) − 2v1 ( n) v 2 ( n + 1) = x ( n) − 3v 2 ( n) + v1 ( n) v3 ( n + 1) = x ( n) − 5v3 ( n) + v 2 ( n)



The output equation is

y ( n) = x ( n) + v 3 ( n) The state and output equations in state-space matrix form then are

⎛ −2 ⎜ v ( n + 1) = ⎜ 1 ⎜ ⎝ 0 y ( n) =

FIGURE 6.9

(

0 ⎞ ⎛ 1 ⎞

⎟ 0 ⎟ v ( n) + ⎜ 1 ⎟ x ( n) ⎟ ⎜ ⎝ 1 ⎠ −5 ⎠⎟

0 −3 0

0

0

Block diagram for EOCE 6.6.

1

) v ( n) + x ( n)

309

State-Space and Discrete Systems

EOCE 6.7 Consider the following system: ⎛ 1 v ( n + 1) = ⎜ ⎝ 1

⎛ 0 ⎞ 0 ⎞ v ( n) + ⎜ ⎟ ⎟ x ( n) k ⎠ ⎝ 1 ⎠

y ( n) =

(

0

1

) v ( n)

1. For what values of k is the system stable? 2. For a value of k that stabilizes the system, find H(z) = Y(z)/X(z). 3. Use recursion to solve for v(0), v(1), v(2), v(3), and v(4) with x(n) = u(n) ⎛ 0 ⎞ and v ( 0 ) = ⎜ ⎟. ⎝ 1 ⎠ 4. Use the z-transform to solve for v(n) for n ≥ 0. 5. What is the transition matrix?

SOLUTION 1. The eigenvalues of this system are the roots of the characteristic equation, which is the determinant of (λI − A) set equal to zero. ⎛ λ ⎝ 0

0 ⎞ ⎛ 1 − λ ⎟⎠ ⎜⎝ 1

( λI − A ) = ⎜

0 ⎞ ⎛ λ −1 = k ⎟⎠ ⎜⎝ −1

⎞ 0 λ − k ⎟⎠

det ( λI − A ) = ( λ − 1)( λ − k ) This system is stable if the eigenvalues of the system matrix A are all within the unit circle. The eigenvalues are at 1 and k. Therefore, for sta­ bility, the value of k has to be within the unit circle. 2. For k = −1/2, the state matrices are ⎛ 1 A=⎜ ⎜ 1 ⎝⎜

0 1 − 2



⎟  B = ⎛ 0 ⎞  C = ⎜ ⎟ ⎟ ⎝ 1 ⎠ ⎟⎠

(

0

The transfer function in this case is H ( z ) = C ( zI − A ) B + D −1

1

) D0 = (

)

310

Discrete Signals and Systems with MATLAB®

H( z ) =

H( z) =

(

0

1

( 0

1

⎛ z −1 ⎜ ⎜ ⎜ −1 ⎜⎝

)

⎞ ⎟ 1 ⎟ z+ ⎟ 2 ⎟⎠ 0

−1

⎛ 0 ⎞ ⎜ ⎟ ⎜ 1 ⎟ ⎝ ⎠

⎛ 1 ⎜ z+ 1 2 ⎜ ( z + 1/ 2)( z − 1) ⎜ ⎜⎝ 1

)

⎞ ⎟⎛ 0 ⎞ ⎟ ⎟⎜ ⎟ ⎜⎝ 1 ⎟⎠ z − 1 ⎟⎠ 0

⎞⎛ 0 ⎞ z −1 z −1 ⎟= ⎟⎜ ( z + 1/ 2)( z − 1) ⎟ ⎜ 1 ⎟ (z + 1/ 2)( z − 1) ⎠⎝ ⎠

⎛ 1 H( z) = ⎜ ⎜⎝ (z + 1/ 2)( z − 1)

We use MATLAB to find the transfer function H(z) from the matrices A, B, C, and D. We will use the MATLAB function ss2tf (state space to transfer function) to do that in the script EOCE6_71. to get num = 0

1

den = 1.0000

−1 −0.5000

−0.5000

and the transfer function is H( z) =

(

z −1 z −1 = ( z + 1/ 2)( z − 1) z − (1/ 2) z − 1/ 2

)

2

3. To use recursion to solve for v(n), we will use the equation v ( n + 1) = Av ( n) + Bx ( n) and y ( n) = Cv ( n) + Dx ( n) We will have the initial sate as ⎛ 0 ⎞ v (0) = ⎜ ⎟ ⎝ 1 ⎠ y (0) =

(

0

1

⎛ 0 ⎞ =1 1 ⎠⎟

) ⎝⎜

311

State-Space and Discrete Systems The other few terms of the state vector and the output are given as follows: ⎛ 1 v (1) = ⎜ ⎜ 1 ⎝⎜

0 1 − 2

⎞ ⎛ ⎛ 0 ⎞ 0 ⎞ ⎛ 0 ⎞ ⎜ ⎟ ⎛ 0 ⎞ + ⎛ 0 ⎞ (1) = ⎜ ⎟+ ⎟ = 1 ⎟ ⎝⎜ 1 ⎠⎟ ⎝⎜ 1 ⎠⎟ ⎜ − ⎟ ⎜⎝ 1 ⎟⎠ ⎜ 1 ⎟ ⎟⎠ ⎜⎝ 2 ⎟⎠ ⎝⎜ 2 ⎠⎟

y (1) =

⎛ 0 v ( 2) = ⎜ ⎜ ⎜⎝ 1

0 1 − 2

(

0

1

⎛ 0 ⎞ 1 =⎜ 1 ⎟ = ⎜ ⎟ 2 ⎜⎝ 2 ⎟⎠

)

⎞⎛ 0 ⎞ ⎛ ⎛ 0 ⎞ ⎛ 0 ⎞ ⎜ ⎟ ⎜ 1 ⎟ + ⎛ 0 ⎞ (1) = ⎜ ⎟+ = 1 ⎟ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎜ ⎟ ⎜ ⎟⎠ ⎜⎝ 2 ⎟⎠ ⎝ 1 ⎠ ⎜⎝ − 4 ⎟⎠ ⎝ 1 ⎠ ⎜⎝

y ( 2) =

(



0

1

) ⎜⎜ ⎜⎝

0 3 4

0 3 4

⎞ ⎟ ⎟ ⎟⎠

⎞ ⎟= 3 ⎟ 4 ⎠⎟

and so on. We can use MATLAB to do this recursion. We will do that in the script EOCE6_72 to get the same results as we had before. 4. We can also use the z-transform method to find the output and the state values V ( z ) = z ( zI − A ) v ( 0 ) + ( zI − A ) BX ( z ) −1

V ( z) =

−1

⎛ 1 z ⎜ z+ 2 ( z + 1/ 2)( z − 1) ⎜⎜ 1 ⎝

+5

⎛ ⎜ V ( z) = ⎜ ⎜ ⎝

⎛ 1 1 ⎜ z+ 2 ( z + 1/ 2)( z − 1) ⎜⎜ 1 ⎝ 0 z ( z − 1) ( z + 1/ 2)( z − 1)

⎞ ⎛ ⎟ ⎜ ⎟ +⎜ ⎟ ⎜⎝ ⎠

⎞ ⎟⎛ 0 ⎞ ⎟ ⎝⎜ 1 ⎟⎠ z − 1 ⎟⎠ 0

⎞ ⎟⎛ 0 ⎞ z ⎟ ⎜⎝ 1 ⎟⎠ z − 1 z − 1 ⎟⎠ 0

0 z −1 ( z + 1/ 2)( z − 1)

⎞ ⎟ z ⎟ z −1 ⎟⎠

0 z2 ( z + 1/ 2)( z − 1)

⎞ ⎟ ⎟ ⎟ ⎠

After some simplifications, we arrive at ⎛ ⎜ V ( z) = ⎜ ⎜ ⎝

0 z ( z − 1) + z ( z + 1/ 2)( z − 1)

⎞ ⎛ ⎟ ⎜ ⎟ =⎜ ⎟ ⎜ ⎠ ⎝

312

Discrete Signals and Systems with MATLAB® and the output in the z-domain is given by Y ( z ) = CV ( z ) =

(

0

1

)v

z

=

z2 ( z + 1/ 2)( z − 1)

The output is one-dimensional or scalar. We can do partial fraction expansion using MATLAB and write the script EOCE6_73. to get r = 0.6667 p = 1.0000

0.3333

−0.500

Therefore, with the help of MATLAB, we arrive at Y ( z) =

z (1/3) 0.6667z + z −1 z + (1/ 2)

and by taking the inverse transform, we get n ⎡ 1 ⎛ 1⎞ ⎤ n y ( n) = v 2 ( n) = ⎢0.6667 (1) + ⎜ − ⎟ ⎥ u ( n) 3 ⎝ 2 ⎠ ⎥⎦ ⎢⎣

If we substitute values for n, we can verify the results we arrived at ear­ lier. Try that. 5. The transition matrix An is the inverse transform of ⎛ ⎜ −1 z ( zI − A ) = ⎜ ⎜ ⎜ ⎝⎜ ⎛ ⎜ −1 z ( zI − A ) = ⎜ ⎜ ⎜ ⎜⎝

⎞ ⎟ ⎟ ⎟ z ⎟ z + 1/ 2 ⎟⎠

z ( z − 1)

0

z ( z + 1/ 2)( z − 1)

z ( z − 1)

0

0.6667 1/3 + ( z − 1) z + 1/ 2

z ( z + 1/ 2)

⎞ ⎟ ⎟ ⎟ ⎟ ⎟⎠

By taking the inverse z-transform, we find the transition matrix as ⎛ (1)n ⎜ n A =⎜ 1 1 n ⎜ 0.6667 (1) + ⎛⎜ ⎞⎟ ⎛⎜ − ⎞⎟ ⎜⎝ ⎝ 3 ⎠ ⎝ 2⎠ n

0 ⎛ 1⎞ ⎜⎝ − ⎟⎠ 2

n

⎞ ⎟ ⎟ u ( n) ⎟ ⎟⎠

313

State-Space and Discrete Systems 0 ⎞ as an indication that the transition 1 ⎟⎠

⎛ 1 You can see that A n = ⎜ ⎝ 0

matrix is correct. We can also use MATLAB to verify the entries in the transition matrix An. For the first entry, we have φ11(z) = z/(z − 1). We will write the MATLAB script EOCE6_74 to find φ11(n). The result is 1u(n) as expected.

EOCE 6.8 Consider the system in Figure 6.10. 1. Write down the state and output equations. 2. What is the transition matrix? ⎛ ⎞ 3. With x(n) = 0 and an initial state vector of ⎜ 1 ⎟ , what is the state vector ⎝ 0 ⎠ and the output? 4. Is the system stable? ⎛ ⎞ 5. Use MATLAB to find y(n), for x(n) = u(n) and the initial state of ⎜ 1 ⎟ . ⎝ 0 ⎠ 6. Find the transfer function H(z).

SOLUTION 1. From Figure 6.10 and by taking v1(n) as the output of the upper delay and v2(n) as the output of the lower delay, we have the state equations v1 ( n + 1) = x ( n) − v1 ( n) v 2 ( n + 1) = x ( n) − 2v 2 ( n)

FIGURE 6.10

Block diagram for EOCE 6.8.

314

Discrete Signals and Systems with MATLAB® The output equation is y ( n) = v1 ( n) + v 2 ( n) Then the state and output equations are grouped as

⎛ −1 v ( n + 1) = ⎜ ⎝ 0 y ( n) = ⎛ 2. With A = ⎜ −1 ⎝ 0

(

1

⎛ 1 ⎞ 0 ⎞ v ( n) ⎜ ⎟ ⎟ x ( n) −2 ⎠ ⎝ 1 ⎠

) v ( n) + ( 0 ) x ( n)

1

0 ⎞ , the state transition matrix is the inverse trans­ −2 ⎟⎠

form of z(zI − A)−1. We have

( zI − A )

−1

⎛ z +1 =⎜ 0 ⎝

⎞ 0 z + 2 ⎠⎟

−1

⎛ z+2 =⎜ 0 ⎝

1 0 ⎞

z + 1 ⎠⎟ ( z + 1)( z + 2)

and

( zI − A )

−1

⎛ ⎜ =⎜ ⎜ ⎜⎝

⎞ ⎟ ⎟ z ⎟ z + 2 ⎟⎠

z z +1

0

0

The transition matrix written is the inverse transform of z(zI − A)−1 and is ⎛ An = ⎜ ⎜ ⎝

( −1)n u ( n)

0

0

( −2)n u ( n)

⎞ ⎟ ⎟ ⎠

But since A is in diagonal form, we could have found An by inspection. With ⎛ −1 A=⎜ ⎝ 0

0 ⎞ −2 ⎠⎟

⎛ A =⎜ ⎜ ⎝ n

( −1)n u ( n)

0

0

( −2)n u ( n)

3. With x(n) = 0, the state vector becomes v ( n + 1) = Av ( n)

⎞ ⎟ ⎟ ⎠

315

State-Space and Discrete Systems For n = 0, we have

⎛ 1 ⎞ v (0) = ⎜ ⎟ ⎝ 0 ⎠ y ( 0 ) = v1 ( 0 ) + v 2 ( 0 ) = 1 For n = 1, we get

⎛ −1 v (1) = ⎜ ⎝ 0

0 ⎞ ⎛ 1 ⎞ ⎛ −1 ⎞

= −2 ⎟⎠ ⎝⎜ 0 ⎠⎟ ⎝⎜ 0 ⎠⎟

y (1) = v1 (1) + v 2 (1) = −1+ 0 = −1 For n = 2, we have

⎛ −1 v ( 2) = ⎜ ⎝ 0

0 ⎞ ⎛ 1 ⎞ ⎛ 1 ⎞ = −2 ⎟⎠ ⎜⎝ 0 ⎟⎠ ⎜⎝ 0 ⎟⎠

y ( 2) = v1 ( 2) + v 2 ( 2) = 1+ 0 = 1 For n = 3, we get

⎛ −1 v ( 3) = ⎜ ⎝ 0

0 ⎞ ⎛ 1 ⎞ ⎛ −1 ⎞

= −2 ⎟⎠ ⎝⎜ 0 ⎠⎟ ⎝⎜ 0 ⎠⎟

y ( 3) = v1 ( 3) + v 2 ( 3) = 1+ 0 = −1 For n = 4, we get

⎛ −1 v ( 4) = ⎜ ⎝ 0

0 ⎞ ⎛ −1 ⎞ ⎛ 1 ⎞

= −2 ⎟⎠ ⎝⎜ 0 ⎠⎟ ⎝⎜ 0 ⎠⎟

y ( 4 ) = v1 ( 4 ) + v 2 ( 4 ) = 1+ 0 = 1 Then by induction, we can see that ⎛ v ( n) = ⎜ ⎜⎝

( −1)n u ( n) 0

and y ( n) = ( −1) u ( n) n

⎞ ⎟ ⎟⎠

316

Discrete Signals and Systems with MATLAB®

FIGURE 6.11

Plot for EOCE 6.8.

Using MATLAB, we can use recursion and write the script EOCE6_81 to solve for the output and the state vector. And the result will be identical to what we just found. We can also plot y(n) versus n by using the MATLAB function dlsim as in the EOCE6_82 script. The plots are shown in Figure 6.11. 4. The stability of the system depends on the location of the poles. One of the poles is not within the unit circle. Thus, the system is not stable. 5. With x(n) = u(n) and the initial conditions, v1(0) = 1 and v2(0) = 0, we can use MATLAB to find y(n) as in the EOCE6_83 script. The plots are shown in Figure 6.12. 6. The transfer function H(z) is calculated using the equation H ( z ) = C ( zI − A ) B + D −1

H(z) =

(

1

1

)

⎛ ⎜ ⎜ ⎜ ⎜⎝

1 z +1 0

⎞ ⎟⎛ ⎛ ⎞ ⎟ ⎜ 1 ⎟ + (0 ) = ⎜ 1 1 ⎟⎝ ⎠ ⎝ z + 2 ⎟⎠ 0

1 z +1

Finally, H( z) =

1 1 z + z + 2+1 2z + 3 + = = z + 1 z + 2 ( z + 1)( z + 2) z 2 + 3z + 2

⎞⎛ 1 ⎞ 1 ⎟ z + 2 ⎠ ⎜⎝ 1 ⎟⎠

317

State-Space and Discrete Systems

FIGURE 6.12

Plot for EOCE 6.8.

We can use MATLAB to verify this result as in the EOCE6_84 script. to get num = 0 2 3 den = 1 3 2 which verifies the result.

EOCE 6.9 We have seen in this chapter that the state-space representation is not unique. To illustrate that, consider the following system v ( n + 1) = Av ( n) + Bx ( n) y ( n) = Cv ( n) + (D) x ( n) With ⎛ 2 A=⎜ ⎝ 0

⎛ 0 ⎞ 0 ⎞  B = ⎜ ⎟  C =   3 ⎟⎠ ⎝ 1 ⎠

(

0

1

)  D =  (0)

What are the other state-space representations? SOLUTION Let us define another state vector called w(n) such that w(n) = Pv(n), where P is called the transformation matrix. Let ⎛ 1 P=⎜ ⎝ 0

0 ⎞ 2 ⎟⎠

318

Discrete Signals and Systems with MATLAB®

Then the new system is w ( n + 1) = PAP −1w ( n) + PBx ( n) and for the output, we have y ( n) = CP −1w ( n) + (D) x ( n) ⎛ 1 ⎞ Assume that the old system has the initial condition vector v ( 0 ) = ⎜ ⎟ . Then ⎝ 0 ⎠ with w(n) = Pv(n), w(0) = Pv(0), and P−1w(0) = v(0). The solutions of the new system in the z-domain are

(

W ( z ) = z zI − PAP −1

)

−1 

(

w ( 0 ) + zI − PAP −1

)

−1

PBX ( z )

and Y ( z ) = CP −1W ( z ) + DX ( z ) Let us now use MATLAB to find the step response with zero initial conditions to the old system; we will then consider the new system and see that the two outputs are the same. The MATLAB script is EOCE6_91. The plots are shown in Figure 6.13. We can also use MATLAB to check the stability and the eigenvalues for both systems as in the EOCE6_92 script. to get Aeigenvalues = 0.4000 0.5000 Aneweigenvalues =

FIGURE 6.13

0.4000 0.5000

Plot for EOCE 6.9.

319

State-Space and Discrete Systems

EOCE 6.10 Consider the following system: y ( n) + y ( n − 1) + y ( n − 2) = x1 ( n) + x2 ( n) 1. Is the system stable? 2. Find y(n) if x1(n) = (.1)n u(n) and x2(n) = (.1)n u(n). 3. Find the transfer function H(z). SOLUTION 1. Let us write the state and output equations first. Let

v1 ( n) = y ( n − 2)

v 2 ( n) = y ( n − 1) Then,

v1 ( n + 1) = y ( n − 1) = v 2 ( n) and v 2 ( n + 1) = y ( n) = x1 ( n) + x2 ( n) − y ( n − 1) − y ( n − 2) = x1 ( n) + x2 ( n) − v 2 ( n) − v1 ( n) The state and output equations are then ⎛ 0 v ( n + 1) = ⎜ ⎝ −1 y ( n) =

(

−1

⎛ 0 ⎞ ⎜ x1 ( n) 1 ⎟⎠ ⎜ x2 ( n) ⎝

⎛ 0 0 ⎞ v ( n) + ⎜ ⎟ −1 ⎠ ⎝ 1

−1

)

v ( n) +

(

1

1

)

⎛ x1 ( n) ⎜ ⎝⎜ x2 ( n)

⎞ ⎟ ⎟⎠

⎞ ⎟ ⎟⎠

with

⎛ 0 A=⎜ ⎝ −1

⎛ 0 1 ⎞  B = ⎜ −1 ⎟⎠ ⎝ 1

0 ⎞  C =   1 ⎟⎠

(

−1

)

−1  D =  

(



The eigenvalues for A are the roots of the determinant of (zI − A). ⎛⎛ z det ( zI − A ) = det ⎜ ⎜ ⎝⎝ 1 det ( zI − A ) = z 2 + z + 1

−1 ⎞ ⎞ ⎟ z + 1 ⎟⎠ ⎠

1

)

320

Discrete Signals and Systems with MATLAB® The roots are z1,2 =

−1 ± 1− 4 −1 3 = ±j 2 2 2

The magnitude of the roots is unity. This means that the system is on the verge of instability or we can call it unstable. 2. With zero initial conditions, V ( z ) = ( zI − A ) BX ( z ) −1

Y ( z ) = CV ( z ) + DX ( z ) We can substitute in the previous state equation and write ⎛ ⎜ V ( z) = ⎜ ⎜ ⎜⎝

z +1 z + z +1 −1 z2 + z + 1

1 z + z +1 z z2 + z + 1

⎞ ⎟⎛ ⎟⎜ 0 ⎟⎝ 1 ⎟⎠

⎛ ⎜ =⎜ ⎜ ⎜⎝

1 z + z +1 z z2 + z + 1

1 z + z +1 z z2 + z + 1

⎞⎛ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎠ ⎜ ⎝

⎛ ⎜ ⎜ V ( z) = ⎜ ⎜ ⎜ ⎝

2

2

2

2

z

z z − .1 z z + .1

z z − .1 z z + .1

⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠

z

( z + .1) ( z 2 + z + 1)

)

( z + .1) ( z 2 + z + 1)

z2 ( z − .1) z 2 + z + 1

⎞ ⎟ ⎟ ⎟ ⎟ ⎠

⎞ ⎟ ⎟ ⎟ ⎟ ⎠

+

( z − .1) ( z 2 + z + 1)

(

⎛ ⎜ 0 ⎞⎜ 1 ⎠⎟ ⎜ ⎜ ⎝

z

The output equation in the z-domain is

Y ( z) =

(

−1

−1

) V ( z) + (

1

1

)

⎛ ⎜ ⎜ ⎜ ⎜ ⎝

⎞ ⎟ ⎟ ⎟ ⎟ ⎠

z z − .1 z z + .1

or Y ( z) =

−z −z −z 2 + + 2 2 ( z − .1) z + z + 1 ( z + .1) z + z + 1 ( z − .1) z 2 + z + 1

(

+

)

(

−z z z + + 2 z − .1 z + .1 z + .1 z + z + 1 ( )

(

)

)

(

)

321

State-Space and Discrete Systems

FIGURE 6.14

Plots for EOCE 6.10.

We can use MATLAB to find the inverse transform of Y(z) and get y(n). We will leave that as an exercise. We can also use MATLAB to find y(n) as in the following script. We will use superposition first. This means that we will kill the inputs one at a time. In this case, only the B and the D matrices will change. ⎛ 0 A=⎜ ⎝ −1

⎛ 0 ⎞ 1 ⎞  B = ⎜ ⎟  C = −1 ⎟⎠ ⎝ 1 ⎠

(

−1

−1

) D1 = ( )

We will then apply both inputs at once. The matrices in this case are ⎛ 0 A=⎜ ⎝ −1

⎛ 0 1 ⎞  B = ⎜ −1 ⎟⎠ ⎝ 1

0 ⎞  C = 1 ⎟⎠

(

−1

)

(

1

1

)

0 ⎞ + 1 ⎠⎟

(

1

1

)

−1  D =

The MATLAB script is EOCE6_101.

The plots are shown in Figure 6.14.

3. The transfer function H(z) is H ( z ) = C ( zI − A ) B + D −1

=

(

−1

−1

)

⎛ ⎜ ⎜ ⎜ ⎜⎝

z +1 z + z +1 −1 z2 + z + 1 2

1 z + z +1 z z2 + z + 1 2

⎞ ⎟⎛ ⎟⎜ 0 ⎟⎝ 1 ⎟⎠

322

Discrete Signals and Systems with MATLAB®

⎛ − ( z + 1) 1 H( z) = ⎜ − 2 + z + z + 1 z2 + z + 1 ⎝ ⎛ H( z) = ⎜ ⎝

−z ⎞ ⎛ 0 −1 + 2 ⎟ z + z + 1⎠ ⎝⎜ 1 z + z +1 2

⎞ −1 −z + ⎟+ z2 + z + 1 z2 + z + 1 ⎠

−1 −z + z2 + z + 1 z2 + z + 1

(

1

0 ⎞ + 1 ⎠⎟

1

(

1

)

Since we had two inputs and single output, we should have one row in H(z) with two entries. They are H11 ( z ) =

−1 ( −z ) + 1 = z 2 = Y ( z ) + 2 z + z +1 z + z +1 z 2 + z + 1 X1 ( z )

H12 ( z ) =

−1 ( −z ) + 1 = z 2 = Y ( z ) + 2 z + z +1 z + z +1 z2 + z + 1 X2 ( z)

2

2

We can also use MATLAB to find H(z) as in the script EOCE6_102. The result is num1 =1 0 0

den = 1.0000 1.0000 1.0000

num2 = 1 0 0

den = 1.0000 1.0000 1.0000

which agrees with the analytical results obtained previously.

EOCE 6.11 Consider the following system: H ( z) =

z 3 + 3z 2 + 2z + 0 z 3 − 6z 2 + 11z − 6

Find the output y(n) if the input is x(n) = u(n). Use as many different state-space representations as you wish. SOLUTION 1. Using Example 6.2 we can write the first state-space representation by inspection. We have the state equation as ⎛ 0 ⎜ v ( n + 1) = ⎜ 0 ⎜⎝ 6

1 0 −11

0 ⎞ ⎛ 0 ⎞ ⎟ 1 ⎟  v ( n) + ⎜⎜ 0 ⎟⎟  x ( n) ⎜⎝ 1 ⎟⎠ 6 ⎟⎠

1

)

323

State-Space and Discrete Systems and the output equation as y ( n) = ⎡⎣0 − ( −6)(1)  2 − 11(1)  3 − ( −6)(1) ⎤⎦ v ( n) + (1) x ( n) =

(

6

−9

−9

) v ( n) + (1) x (n)

2. Series connections. The transfer function can be written as

H ( z) =

( ) = z ( z + 2)( z + 1 ) ( z − 2)( z − 3)( z − 1) ( z − 2)( z − 3)( z − 1)

H ( z) =

z z + 2 z +1 z − 2 z − 3 z −1

z z 2 + 3z + 1

The block diagram is shown in Figure 6.15. From Figure 6.15, we have the state equations as v3 ( n + 1) = x ( n) + 2v3 ( n)



v 2 ( n + 1) = x ( n) + 2v3 ( n) + 3v 2 ( n)



v1 ( n + 1) = 2v 2 ( n) + x ( n) + 2v3 ( n) + 3v 2 ( n) + v1 ( n) and the output equation is y ( n) = 2v 2 ( n) + x ( n) + 2v3 ( n) + 3v 2 ( n) + 2v1 ( n) Thus, the state-space system is ⎛ 1 v ( n + 1) = ⎜ 0 ⎜ ⎝⎜ 0 y ( n) =

FIGURE 6.15

(

2

5 3 0

2 2 2

⎞ ⎛ 1 ⎞ ⎟ v ( n) + ⎜ 1 ⎟ x ( n) ⎟ ⎜ ⎟ ⎝ 1 ⎠ ⎠⎟

5

2

) v ( n) + (1) x (n)

Block diagram for EOCE 6.11.

324

Discrete Signals and Systems with MATLAB® 3. Using partial fraction expansion, we can write the transfer function as H ( z) =

8z 10z 3z z − 2 z − 3 z − 1

The block diagram is shown in Figure 6.16. From Figure 6.16, we can see that the states are v1 ( n + 1) = x ( n) + 2v1 ( n) v 2 ( n + 1) = x ( n) + 3 v 2 ( n) v3 ( n + 1) = x ( n) + v3 ( n) and the output is y ( n) = 8x ( n) + 16v1 ( n) + 10 x ( n) + 30v 2 ( n) + 3x ( n) + 3v3 ( n) The states and output equations in matrix form are

⎛ 2 v ( n + 1) = ⎜ 0 ⎜ ⎜⎝ 0 y ( n) =

(

16

0 3 0 30

⎞ ⎛ 1 ⎞ ⎟ v ( n) + ⎜ 1 ⎟ x ( n ) ⎟ ⎟ ⎜ ⎟⎠ ⎝ 1 ⎠

0 0 1 3

FIGURE 6.16 Block diagram for EOCE 6.11.

) v ( n) + ( 21) x ( n )

325

State-Space and Discrete Systems

FIGURE 6.17 Block diagram for EOCE 6.11.

4. We can represent the system in the block diagram shown in Figure 6.17. Let the output of the first delay be v1(n). Then v1 ( n + 1) = 6y ( n) = 6 ⎡⎣ x ( n) + v3 ( n) ⎤⎦ = 6v3 ( n) + 6x ( n) Let the output of the second delay be v2(n) and the output of the third delay be v3(n). Thus, v 2 ( n + 1) = 2x ( n) + v1 ( n) − 11v3 ( n) − 11x ( n) v3 ( n + 1) = 3x ( n) + v 2 ( n) − 6v3 ( n) + 6 x ( n) The output from the figure is given by y ( n) = x ( n) + v 3 ( n) The state and output equations are then ⎛ 0 v ( n + 1) = ⎜ 1 ⎜ ⎜⎝ 0 y ( n) =

(

0

0 0 1

6 −11 6

0

1

⎛ 6 ⎞ ⎞ ⎟ v ( n) + ⎜ −9 ⎟ x ( n) ⎜ ⎟ ⎟ ⎝⎜ 9 ⎠⎟ ⎠⎟

) v ( n) + (1) x (n)

We will use MATLAB next as in EOCE6_11 to find the step response, y(n), for all four representations and show that y(n) for all four representa­ tions is the same. Let us also use zero initial conditions. The plots are shown in Figure 6.18. Note in this example that the A matrix in the third case is diagonal. So for analytical solutions it is desirable that you do partial fraction expansion and then draw the block

326

Discrete Signals and Systems with MATLAB®

FIGURE 6.18

Plots for EOCE 6.11.

diagram from which you will obtain the A matrix in its diagonal form Note also that if ⎛ a1 ⎜ A=⎜ 0 ⎜⎝ 0

0 a2 0

0 0 a3

⎞ ⎟ ⎟ ⎟⎠

then ⎛ ⎜ An = ⎜ ⎜ ⎜ ⎝

( a1)n

0

0

0

( a2 )n

0

0

0

( a3 )n

⎞ ⎟ ⎟ ⎟ ⎟ ⎠

6.10 END-OF-CHAPTER PROBLEMS EOCP 6.1 Let ⎛ 0 A = ⎜ 0 ⎜

⎝ −3

0 0 −2

0 1 −6

⎞ ⎛ 0 ⎟  and   B =   ⎜ 1 ⎟



⎠ ⎝ 0

0

0

1

−1 −2 −3

1. Find A2, A3, A−1 and the eigenvalues and eigenvectors for A. 2. Find B2, B3, B−1, eigenvalues and eigenvectors for B.



⎟ ⎟



327

State-Space and Discrete Systems

EOCP 6.2 For ⎛ −2 ⎜ B= 0 ⎜ ⎝ 0 1. 2. 3. 4.

−3 0 1

−4 1 0

⎞ ⎟ ⎟ ⎠

Find eigenvalues and eigenvectors for B. Form the matrix P, which has the eigenvectors as its columns. Find P−1BP. Is it diagonal? Find the eigenvalues for P−1BP.

EOCP 6.3 With ⎛ 2 ⎜ A = 0 ⎜

⎝ 0

0 3 0

0 0 4



⎛ 0 ⎟  B = ⎜ 0 ⎟





⎝ −2

0 0 − 1

0

1 −3



⎛ 0 ⎟  C = ⎜ 0 ⎟





⎝ 0

0

1

0

−1 −2 −3



⎟ ⎟



Find An, Bn, and Cn. EOCP 6.4 Consider the following difference equations: 1. 2. 3. 4. 5. 6.

y ( n ) + a1 y ( n − 1) + a2 y ( n − 2 ) = b0 x ( n ) y ( n ) + a2 y ( n − 2 ) = b0 x ( n ) y ( n ) + a3 y ( n − 3) + a4 y ( n − 4 ) = b1 x ( n − 1) y ( n ) + a1 y ( n − 1) + a2 y ( n − 2 ) = b0 x1 ( n ) + b1 x 2 ( n ) y ( n ) − a4 y ( n − 4 ) = b0 x 0 ( n ) + b1 x 2 ( n ) y ( n ) − y ( n − 3) = x ( n )

Find the state-space representation for each system given earlier. Find A, B, C, and D. EOCP 6.5 Given the following impulse responses 1. 2. 3. 4. 5.

h ( n ) = (.1) u ( n ) + ( −.1) u ( n )

n h ( n ) = (.1) sin ( n ) u ( n ) n h ( n ) = n (.1) cos ( 3π2 n ) u ( n ) n−1 h ( n ) = ( n − 1)(.1) u ( n − 1) n n h ( n ) = (.1) u ( n ) * (.5) u ( n ) n

n

Find the state-space representation for each system. Find A, B, C, and D.

328

Discrete Signals and Systems with MATLAB®

EOCP 6.6 Consider the following blocks in Figures 6.19–6.23. Find the state-space representation for all blocks. Find A, B, C, and D.

FIGURE 6.19

Block diagram for EOCP 6.6.

FIGURE 6.20

Block diagram for EOCP 6.6.

FIGURE 6.21

Block diagram for EOCP 6.6.

FIGURE 6.22 Block diagram for EOCP 6.6.

State-Space and Discrete Systems

329

FIGURE 6.23 Block diagram for EOCP 6.6.

EOCP 6.7 Consider the following transfer functions: 1. H ( z ) =

( z − 1)( z − .5) ( z + 1)( z + .5)

2. H ( z ) =

z

( z + 1)( z + .5)( z − 1)

3. H ( z ) =

( z − 1)( z − .5)

( z + 1)

z 2 − 1

z 3 3 z + 3z 2 + 2z + 1

5. H ( z ) = 3 z + 4z 2 + 2z + 3

4. H ( z ) =

Find four different state-space representations for each transfer function. EOCP 6.8 Consider the system y ( n ) + ky ( n − 1) + 3 y ( n − 2 ) = x ( n ) Use the state space in all parts. 1. For what value k is the system stable? 2. Take a value for k that makes the system stable and find the eigenvalues of the system. 3. For the value of k in part 2, find the output y(n) for x(n) = u(n) using MATLAB. 4. Repeat part 3 in the list using the z-transform method. 5. Find the transition matrix An. 6. Find H(z) from the state equations analytically. 7. Find H(z) using MATLAB. 8. Use MATLAB to find h(n) from H(z). Find the residues using MATLAB.

330

Discrete Signals and Systems with MATLAB®

EOCP 6.9 Consider the system y ( n ) + 0.1y ( n − 1) + y ( n − 2 ) = x1 ( n ) + x 2 ( n ) with y(−1) = 0 and y(−2) = 1. 1. 2. 3. 4. 5. 6. 7.

Is the system stable? Put the system in state space. Use MATLAB to find h(n) using the state equations. Use MATLAB to find y(n), the step response. Use MATLAB to find the derived initial conditions with x1(0) = x2(0) = 0. Find H(z) using MATLAB and identify each entry with the H(z) matrix. Find An.

EOCP 6.10 Consider the following systems: H (z) =

z+2 z + z +1

H (z) =

1 z 2 − .6z + .05

2

For both systems using the state-space method 1. 2. 3. 4. 5.

Find two state-space representations. Find h(n). Find An. Find the step response. Check stability for both systems.

EOCP 6.11 Consider the following system: H (z) = 1. 2. 3. 4.

z2 + z + 1 z + k z + .05 2

Write the state-space representation. For what value(s) of k is the system stable? Find the difference equation representing H(z). Pick a k that makes the system stable and find the output y(n) for x(n) = n sin(n)u(n). Use the MATLAB function dlsim to do that. 5. Find An for a given k.

State-Space and Discrete Systems

331

EOCP 6.12 Consider the system y1 ( n ) − y2 ( n − 1) = x1 ( n ) y2 ( n ) − y1 ( n − 1) = x 2 ( n ) where y1(n) and y2(n) are the outputs and x1(n) and x2(n) are the inputs. 1. 2. 3. 4. 5. 6. 7.

Write the state-space equations describing the system. Is the system stable? Find the eigenvalues for A. With x1(n) = x2(n) = u(n), find y1(n) and y2(n). Find the transfer function matrix H(z) from A, B, C, and D. Find the state transition matrix. Find the impulse response of the system. Draw the block diagram for the system and obtain a different state-space representation. 8. Find the step and impulse responses for the representation in part 7 in the list. 9. What are the eigenvalues for the new representation in part 7 in the list?

EOCP 6.13 Consider the system in Figure 6.24. 1. 2. 3. 4. 5. 6. 7.

Write the state equations for this system. Is the system stable? What is the transition matrix? What is the transfer matrix H(z)? Find y1(n) and y2(n) for x(n) = 10 cos((2πn/3) + .1)u(n). Find the impulse response for the system. Write the coupled two difference equations describing the system.

FIGURE 6.24 System for EOCP 6.13.

332

Discrete Signals and Systems with MATLAB®

EOCP 6.14 Consider the following systems: ⎛ ⎜ (a) H ( z ) = ⎜ ⎜ ⎜ ⎝ 1. 2. 3. 4. 5. 6.

z z + z +1 2

z +1 z + z +1 2

⎞ z2 + 1 ⎟ z + z +1 ⎟ (b ⎟ z2 + z ⎟ z2 + z + 1 ⎠ 2



) H (z) = ⎜



z z +1 2

Draw the block diagram for these systems. What are the state-space representations for both systems? What is the transition matrix for both systems? Find the step response for both systems. Find the impulse response for both systems. Are the systems stable?

z +1 ⎞ z 2 + 1 ⎟⎠

Index

Note: Page numbers in italics indicate figures and bold indicate tables in the text.

A

C

AC voltage source, 28

Addition

complex numbers, 126

of discrete signals, 22

two matrices, 278

Algebra, easy-to-manipulate, 144; see also Matrix algebra Algebraic equations, 81, 101; see also Equations

auxiliary, 83–84

roots, 84

transfer function, 193

Aliasing, 258

Amplitude scaling, 18

Analogue frequency, 140; see also Frequency(ies)

Analogue-to-digital converter, 242, 271

Auto-correlation, 81; see also Correlation

application of, 257

defined, 82–83

input noise, 117

signals and, 256

Auxiliary equation; see also Equations

algebraic, 83–84

system, 193

Average power, 25, 29, 131, 251–254, 254;

see also Power

Capacitor

charging and discharging of, 1

voltage, 277

Cascade system realization, 288–289, 289

Causal systems, 56–57; see also Systems

Characteristic equation, 80, 93; see also

Equations

eigenvalues, 193, 309

homogeneous solution, 64–65, 68, 94–95

roots of, 66, 110, 302, 309

stability of linear discrete systems, 70–73

systems, 64

Circle of unity magnitude radius, 175

Circular convolution, 244–249

linear convolution and, 249, 258

properties of DFT, 233

Coefficients

characteristic equation, 71

constant, 83–84

Fourier series, 130–131, 251–254, 254

Combined operations of discrete signals, 23–25, 24; see also Discrete signals; Signal(s)

Communication channel, 42, 271

Complex discrete signal, 12–13; see also Discrete

signals Complex number(s), 125–128; see also Rational number

addition, 126

definition, 125

division, 127

multiplication, 127

from polar to rectangular, 128, 128

from rectangular to polar, 128, 128

subtraction, 126

written in polar form, 67

Constant coefficients, 83–84; see also Coefficients Continuous Fourier transform; see also Fourier transform

approximation to, 250–251, 251

DFT and continuous Fourier transform of x(t),

240–241

DFT and Fourier transform of x(n), 239

DFT and z-transform of x(n), 239–240

Continuous frequency, 231; see also

Frequency(ies)

Continuous radian frequency, 9, 239

B BIBO, see Bounded-input bounded-output (BIBO) Bilateral z-transform, 171–173, 172; see also Z-domain; Z-transform and discrete systems Block diagrams

cascade system realization, 288–289, 289

difference equations, 75–79, 77–79

representation, 102–104, 283

linear discrete systems, 73–75, 73–75 transfer function, 185–186, 185–186

second-order difference equation, 291, 291

state equations, 323, 323

to state-space, 285–286, 285–287

z-domain, 223

Block filtering, 256, 268–269, 275

Bounded discrete signals, 27

Bounded-input bounded-output (BIBO), 58–59

Bounded systems, 87–88; see also Systems

333

334 Continuous signal(s), 1, 9; see also Signal(s)

analogue frequency, 140

analogue systems, 3

DFT, 237

discrete signals, 2, 2, 48, 51, 129, 140

Fourier series coefficients, 251

Fourier transform, 231

time constant, 21

Continuous systems; see also Systems

discrete systems, 278

reason for discretizing, 3

state equations, 278

Continuous wave, 1

Convergence; see also Region of convergence

(ROC)

conditions, 141

z-transform and discrete systems, 175–178,

190–192

Converter, see Analogue-to-digital converter

Convolution, 59–63, 60

circular, 233, 244–249, 258

cross-correlation, 82

equation, 256

Fourier transform, 143–144

frequency domain, 144

linear, 245–246, 249–250, 258

MATLAB®, 197

sum, 62, 95–96, 120, 150

transform domain, 186

between two signals, 82

z-transform, 184, 187, 221

Correlation, 81–83, 256–257; see also Auto-correlation

auto-correlation, 82–83

cross-correlation, 81–82

signals for DFT, 234

Cross-correlation, 81–82

application of, 116

discrete sequence, 82

equation, 81–82, 256

normal distribution, 117

output and input noise, 118

between two different signals and auto-

correlation, 256

Current; see also Power

continuous signal for, 9

inductor, 277

voltages and, 1

D Decaying exponential discrete signal, 6; see also Discrete signals Decaying sinusoidal discrete signal, 10; see also Discrete signals

Decimation in time, 243; see also Time

Delay element, 73, 73

Index Dense spectrum, 269

DFT, see Discrete Fourier transform (DFT)

Diagonal form of matrix, 281

Difference equations, 94–95, 97, 101–106, 108,

110–113; see also Equations

block diagrams, 75–79, 77–79, 282

characteristic equation, 302

with constant coefficients, 83–84

discrete, 63, 273

first-order, 63, 136, 277, 283, 302

fourth-order, 282

homogeneous, 63–67, 93–94

inverse z-transform, 291

nonhomogeneous, 67–69

nth-order, 207, 277, 302

of physical systems, 63

second-order, 291

solving using z-transform, 188–189

state-space representation, 282

Differentiation property, 196

Digital filter, 256; see also Filter

Digital frequency, 129, 140, 148, 231; see also

Frequency(ies)

Discrete Fourier transform (DFT), 231–276

applications, 244–257

approximation to coefficients of Fourier

series, 251–254, 254

approximation to continuous Fourier

transform, 250–251, 251

average power of periodic signal,

251–254, 254

block filtering, 256

circular convolution, 244–249

linear convolution, 249–250

total energy in signal, 254–255

examples, 259–272 fast Fourier transform, 243–244 finite-duration discrete signals and, 232–233 insights, 257–258 circular convolution and linear

convolution, 258

DFT points are samples of Fourier

transform of x(n), 257

DFT same as fft, 257

frequency contents of x(t) in DFT,

257–258

frequency leakage and DFT, 258

|X(w)|, 258

numerical computation, 242

overview, 231

problems, 272–276

properties, 233, 233–238

defining equation, 234

DFT linearity, 236–237

DFT symmetry, 234–236

magnitude of DFT, 237–238, 238

meaning of DFT, 237

Index relation with Fourier transform of discrete signals, 239–242 DFT and continuous Fourier transform of x(t), 240–241

DFT and Fourier transform of x(n), 239

DFT and z-transform of x(n), 239–240

Discrete linear system, 70–73, 101, 171, 231, 244;

see also Systems

Discrete signals, 51; see also Signal(s)

addition/subtraction, 22

average power, 25

basic operations on, 22–25

bounded, 27

combined operations, 23–25, 24

complex, 12–13

continuous signals, 2, 2, 48, 51, 129, 140

decaying exponential, 6

decaying sinusoidal, 10

energy, 25–27

even and odd, 19, 19–20

example of, 2

finite-duration, 232–233

Fourier transform of, 140–141, 147–150,

149–150, 239–242

in frequency domain, 126

growing exponential, 7

growing sinusoidal, 10

impulses, 4, 5, 15–16, 15–16

irregularly decaying modulated sinusoidal,

11

irregularly growing modulated sinusoidal, 11

modulation, 22

nonperiodic, 3

periodic, 3, 3–4, 25, 125, 129–131

power, 25–27

ramp, 5, 6

real exponential, 6, 6–7

scalar multiplication, 22

sinusoidal, 7–9, 8, 10

state-space, see State-space and discrete

systems

time constant, 21–22

time invariance and, 54–56

total energy, 25–26

unbounded, 27

unit step, 4, 5

Discrete systems, 51–124, 135–139; see also Discrete Fourier transform (DFT); Systems; Z-transform and discrete systems bilateral z-transform, 171–173, 172

block diagram representation of linear

discrete systems, 73–75

delay element, 73, 73

multiplier, 74–75, 74–75

summing/subtracting junction, 73, 73

335 from block diagram to difference equation, 75–76, 75–76

causal systems, 56–57

continuous systems, 278

convolution, 59–63, 60

correlation, 81–83

auto-correlation, 82–83 cross-correlation, 81–82

difference equations of physical systems, 63

from difference equation to block diagram,

76–79, 77–79

examples, 84–118

homogeneous difference equation and

solution, 63–67

case when roots are all distinct, 66

case when two roots are complex,

66–67 case when two roots are real and equal, 66

impulse response, 79–81

input and output, 51, 52

insights, 83–84

eigenvalues, 83–84 stability and eigenvalues, 84

inverse of system, 57–58, 58

linear discrete systems, 52–54

nonhomogeneous difference equations and

solution, 67–69

particular solution, 69, 70

with periodic inputs, 131–135

periodicity property, 137

problems, 118–124

properties, 137–139

stability of linear discrete systems, 70–73

depending on values of poles, 70

from jury test, 70–73

stable systems, 58, 58–59

symmetry property, 138–139, 139

systems with memory, 56

time invariance and discrete signals, 54–56

z-transform, 175–178, 190–192

Discrete time; see also Time

constant, 22

domain, 179, 221

index, 129

signal, 21, 232

system, 259

Discrete-time-shifting property, Fourier transform, 142

Division, complex numbers, 127

Domain

discrete, 144, 179, 246

Fourier, 145

frequency, 125, 126, 144, 171, 184, 231

representation, 171

time, 218, 221

Dynamics matrix, 302; see also Matrix

336 E Eigenvalues, 83–84, 99, 105, 194

block diagonal matrix, 302

characteristic equation, 193, 309

MATLAB®, 70

matrix, 281

roots of determinant, 292, 302

stability, 84

system matrix, 309

transformed system, 301

Eigenvectors of matrix, 281, 302

Electrical switch, 28

Electromagnetic signal, 1; see also Signal(s)

Element-by-element multiplication, 25, 36;

see also Multiplication

Elevator system, 51; see also Systems

Ending index, 91

Energy; see also Power; Total energy

approximate, 254

calculations, 146–147

discrete signals, 25–27

infinite, 27

Parseval’s relation and, 146–147

power and, 25–27

signals, 82, 131

spectrum density, 257, 273

total, see Total energy

Equations

algebraic, see Algebraic equations

continuous systems state, 278

convolution, 95–96, 256

cross-correlation, 81–82

difference, 94–95, 97, 101–106

block diagram, 75–79, 75–79

homogeneous, 63–67, 93–94

nonhomogeneous, 67–69

physical systems, 63

solving using z-transform,

188–189

differential, 278

even and odd part of x(n), 40

linear time-invariant, 277

n first order difference, 282, 302

output matrix, 286

state, 277–278, 283–284, 286, 289

state-space, 294–295

Even and odd discrete signal, 19, 19–20; see also Discrete signals Exponential signal, 21, 33; see also Signal(s)

decaying, MATLAB®, 34

modulated sinusoidal, 10–11, 10–11

F Fast Fourier transform, 131, 243–244; see also Fourier transform

Index Filter/filtering; see also Block filtering

digital, 256

function, 97, 111, 200, 206–207, 209

to solve difference equations, 97

Final value theorem, z-transform, 192

Finite duration signals, 81, 88–91, 89–91, 125,

232–233

First-order difference equation, 63, 74, 83, 136,

277, 302

First-order system, 83

Fourier, J., 125

Fourier series

coefficients of, 130–131, 251–254, 254

of discrete periodic signals, 129–131

Fourier series and Fourier transform of discrete signals, 125–169; see also Discrete signals complex numbers, 125–128

addition, 126

definition, 125

division, 127

multiplication, 127

from polar to rectangular, 128, 128

from rectangular to polar, 128, 128

subtraction, 126

convergence conditions, 141

discrete system with periodic inputs, 131–135

examples, 151–163

Fourier series of discrete periodic signals,

129–131 Fourier transform of discrete signals, 140–141, 147–150, 149–150 frequency response of discrete systems, 135–139

periodicity property, 137

properties, 137–139

symmetry property, 138–139, 139

insights, 150–151

ease in analysis and design, 150

sinusoidal analysis, 151

overview, 125

Parseval’s relation and energy calculations,

146–147

problems, 163–169

steady-state response, 131–135

Fourier transform continuous, 231, see also Continuous Fourier transform

convolution property, 143–144

DFT points samples of, 257

of discrete signals, 140–141, 147–150,

149–150, 239–242

discrete-time-shifting property, 142

fast, 243–244

frequency-shifting property, 142–143

linearity property, 142

numerical evaluation of, 147–150, 149–150

337

Index pairs, 145

periodicity property, 141–142

properties, 141–146, 145

reflection property, 143

z-transform, 175

Fourth-order difference equation, 282

Fraction expansion, see Partial fraction expansion

Frequency(ies)

analogue, 140

angular, 7

components, 130, 237, 258

contents, 130, 150, 171, 256, 270

contents of x(t) in DFT, 257–258

continuous, 9, 231, 239

digital, 129, 140, 148, 231

domain, 125, 126, 144, 171, 184, 231

index, 129, 237

input, 135, 151

leakage and DFT, 258

magnitude, 237

radian, 134

resolution, 237, 258, 270

response, 135–140, 148–150, 152–154, 152–155

sampling, 237

shift, 142, 233

signal, 131

spacing, 149

Frequency-shifting property, Fourier transform,

142–143

Fundamental period, 8–9, 12–13, 129

G General form for yss (n), steady-state response,

134

Growing exponential discrete signal, 7

Growing sinusoidal discrete signal, 10

Gulf war, 28

H Hamming windows, 258

Hanning windows, 258, 262

High resolution, 269

Homogeneous difference equations, 63–67,

93–94

Homogeneous solution, 63–67

characteristic equation, 64–65, 68, 94–95

complex roots in, 66–67

distinct roots in, 66

equal roots in, 66

zero and nonzero, 63

I Identity matrix, 278, 281, 295, 297, 300, 302;

see also Matrix

Impulses

discrete signals, 4, 5, 15–16, 15–16

response, 79–81, 92, 96, 101–102, 104–106,

110–113, 116–118, 131–132, 135

shifted, 15

signal, 13, 16, 28, 31, 33, 33, 37, 59–60, 60,

100, 117, 246

Index, 36, 91

Inductor current, 277

Infinite energy, 27; see also Energy

Infinite series, 141

Initial condition vector, 208–209, 296, 301, 318

Initial index, 36

Initial-value theorem, z-transform, 192–193

Input; see also Output

computer, 51

continuous, 3

digital systems, 3

discrete, 22, 51, 52, 131–135

external, 65

frequency, 135

noise, 117–118

solutions for selected, 70

zero, 63

Inspection, 68, 100, 294, 307, 314, 322

Inverse of matrix, 280; see also Matrix

Inverse of system, 57–58, 58

Inverse transform

DFT, 263

MATLAB® function, 205

ROC, 202–203

state transition matrix, 314

transition matrix An, 312

z-transform, 210

Inverse z-transform, 178–181

long division, 181

partial fraction expansion, 178–180

Irregularly decaying modulated sinusoidal

discrete signal, 11

Irregularly growing modulated sinusoidal

discrete signal, 11

J Jury test, 70–73

L Lindex, 37

Linear convolution, 245–246, 249–250, 258;

see also Convolution

Linearity property

Fourier transform, 142

z-transform and discrete systems, 182

Linear system(s), 84–86

design, 150

discrete, 52–54, 70–75, 73–75, 101, 171, 231

338 input, 51

nonlinear and, 277

output, 60

representation, 52

state-space form, 302

time-invariant, 83–84, 134, 194

types, 231

Long division

inverse z-transform, 181

partial function expansion and, 199

transfer function, 190

Low-frequency signals, 138; see also Signal(s)

M Magnitude bounded, 27

changes, 29

circle of unity radius, 175

complex number, 127

constant force, 28

DFT, 237–238, 238, 258

eigenvalues, 83

Fourier series, 130

Fourier transform, 260

frequency, 135, 139, 148, 155, 161, 237

infinite, 28

input frequency, 158

input signal, 151, 256

phase spectrum, 150

response, 138

of roots, 70, 320

signals, 125

transfer function, 151

MATLAB®

calculation of average power using, 29

command, 105

convolution, 197

editor, 37

eigenvalues, 70

element-by-element multiplication, 36

exponential decaying signal, 34

to find total energy, 29, 255

function roots, 70

generated impulse signal, 33

generated sinusoidal signal, 34

generated step signal, 32

script, 98, 106, 108

step response, 318, 325, 330

transfer function, 310

Matrix; see also Transition matrix

diagonal form of, 281

dynamics, 302

eigenvalues, 281

eigenvectors of, 281, 302

identity, 278, 281, 295, 297, 300, 302

inverse of, 280

Index multiplication, 280

output, 286

state-space, 292, 294, 307–308

system, 309

transformation, 300, 317

two-by-two, 279

Matrix algebra, 278–281

adding two matrices, 278

definition, general terms, and notations, 278

determinant of two-by-two matrix, 279

diagonal form of matrix, 281

eigenvalues of matrix, 281

eigenvectors of a matrix, 281

identity matrix, 278

inverse of matrix, 280

matrix multiplication, 280

multiplying matrix by constant, 279

subtracting two matrices, 279

Modulation of discrete signals, 22

Multiplication

complex, 244

complex numbers, 127

by e −an, z-transform, 184

element-by-element, 25, 36

frequency domain, 144

matrix, 279–280

scalar, 22

term-by-term, 248

transform domain, 186

z-domain, 184, 197

Multiplier element, 74–75, 74–75

N Noise auto-correlation, 117; see also

Auto-correlation

Nonhomogeneous difference equations, 67–69, 79

Nonperiodic discrete signals, 3; see also Discrete

signals

Nonrecursive systems, 283–284; see also Systems

Numbers, see Complex number(s); Rational

number; Real number

Numerical computation of DFT, 242

Nyquist sampling rate, 254

O Orthogonality, 130

Output; see also Input

computer, 51

digital signals, 3

discrete systems, 51, 52

equations, 277

linear systems, 60

matrix, 286

noise, 118

state vector, 311

339

Index P Parseval’s Theorem, 146–147, 233

Partial fraction expansion, 178–180, 188, 201,

203, 211, 213, 220, 312, 324, 325

Particular solution, 69, 70, 79, 80, 94–96,

193

Periodic discrete signals, 3, 3–4; see also

Discrete signals

Periodicity property, 137, 141–142

Periodic signal, 3, 25, 29, 130, 251–254, 254,

256

Physical systems, 63, 278; see also Systems

Polar form, complex number written in, 128,

128, 175

Polar to rectangular, complex numbers from,

128, 128

Poles

stability and, 70, 218, 302–303

of system, 193–194, 206

zeroes and, 193–194

Power; see also Energy

average, 25, 29, 131, 251–254

characteristic equation, 71

discrete signals, 25–27

energy and, 25–27

finite, 27

integer, 250, 260, 263

signals, 82–83

Pulse

defined, 264

discrete, 14

rectangular, 28–29

signal, 14, 14, 28

R Radian frequency, 9, 134, 239; see also

Frequency(ies)

Ramp discrete signal, 5, 6

Ramp signal, 28

Random signal, 29, 266

Rational number, 8–9, 12–13; see also Complex

number(s); Real number

Real exponential discrete signal, 6, 6–7

Real number, 12, 21, 27, 58; see also Complex

number(s); Rational number

Record length, 270

Rectangular pulse, 28–29

Rectangular to polar, complex numbers from,

128, 128

Rectangular window, 258, 262

Recursive systems, 282–283; see also

Systems

Reflected signal, 16, 17

Reflection operation, 16, 17

Reflection property, Fourier transform, 143

Region of convergence (ROC), 176–178, 179

Rindex, 37

Roots

algebraic equation, 84

characteristic equation, 66, 110, 302, 309

complex, 66–67

of determinant eigenvalues, 292, 302

distinct, 66

magnitude of, 70, 320

of numerator, 194

real and equal, 66

S Sampling

complex sinusoid, 237–238

continuous exponential signal, 21

continuous signal, 1, 2, 129

continuous systems, 278

frequency, 237, 255, 257

interval, 9, 51, 130, 173, 239, 252

period, 2, 129, 140, 231, 250

rate, 42, 46, 254, 271

Scalar multiplication of discrete signals, 22; see also Discrete signals Scaling

amplitude, 18

factor, 22

Second-order difference equation, block diagrams, 291, 291

Second-order system, 83, 194, 278

Series connection, 323

Shifted impulse, 15; see also Impulses

Shifted step, 14–15

Shifting operation, 13, 14–15

Shifting property, z-transform, 182–183

Signal(s); see also Discrete signals; Sinusoidal

discrete signal; Sinusoidal signal

auto-correlation and, 256

bounded discrete, 27

complex discrete, 12–13

continuous, see Continuous signal(s)

convolution between two, 82

decaying exponential discrete, 6

decaying sinusoidal discrete, 10

discretizing, 321

electromagnetic, 1

even and odd discrete, 19, 19–20

exponentially modulated sinusoidal, 10–11,

10–11

finite duration, 81, 88–91, 89–91

Fourier series of discrete periodic, 129–131

Fourier transform of discrete, 140–141

growing exponential discrete, 7

growing sinusoidal discrete, 10

impulse, 4, 5, 13, 16, 28, 31, 33, 33, 37, 59–60,

60, 100, 117, 246

340 irregularly decaying modulated sinusoidal

discrete, 11

irregularly growing modulated sinusoidal

discrete, 11

low-frequency, 138

magnitude, 125

noncausal, 190

nonperiodic discrete, 3

periodic, 3, 3–4, 251–254, 254

power, 25–27, 82–83

pulse, 14, 14

ramp, 5, 6, 28

real exponential discrete, 6, 6–7

in real world, 27–29

reflected, 16, 17

shifted step, 14–15

sinusoidal, 28

step, 28

unit step discrete, 4, 5

z-transform, 171

Signal representation, 1–49

amplitude scaling, 18

basic operations on discrete signals, 22–25

addition/subtraction, 22

combined operations, 23–25, 24

modulation, 22

scalar multiplication, 22

discrete

bounded, 27

complex, 12–13

energy and power, 25–27

even and odd, 19, 19–20

impulse, 4, 5

nonperiodic, 3

periodic, 3, 3–4

ramp, 5, 6

real exponential, 6, 6–7

representing using impulses, 15–16, 15–16

sinusoidal, 7–9, 8, 10

time constant, 21–22

unbounded, 27

unit step, 4, 5

examples, 29–46

exponentially modulated sinusoidal signal,

10–11, 10–11

overview, 1–2

problems, 46–49

reason for discretizing continuous systems, 3

reflection operation, 16, 17

shifting operation, 13, 14–15

signals in real world, 27–29

impulse signal, 28

other signals, 28–29

ramp signal, 28

sinusoidal signal, 28

step signal, 28

time scaling, 17

Index Sindex, 37

Sinusoidal analysis, 151

Sinusoidal discrete signal; see also Discrete

signals; Signal(s)

decaying, 10

growing, 10

irregularly decaying modulated, 11

irregularly growing modulated, 11

signal representation, 7–9, 8, 10

Sinusoidal response, 96

Sinusoidal signal, 28; see also Signal(s)

bounded, 27

discrete, 126

exponentially modulated, 10–11, 10–11

MATLAB®-generated, 34

Solution, see Particular solution

Spectral energy estimate, calculation of, 268

Stability

eigenvalues, 84

systems, 58, 58–59, 194

Starting index, 91

State equations; see also Equations

block diagrams, 323, 323

decoupling, 302

evolution, 278

matrix form, 283–284

in real time, 295–297

set, 277

state-space matrix, 294

z-transform, 295

State-space

block diagram to, 285–286, 285–287

difference equation, 282

matrix, 292, 294, 307–308

representation of systems in, 282–294

system, 287, 290, 295, 323

transfer function H(z) to, 287–294, 288–291,

293

transfer function in z-domain, 287

transformations, 300–302

State-space and discrete systems, 277–332; see also Discrete systems

examples, 303–326

matrix algebra, 278–281

adding two matrices, 278

definition, general terms, and notations,

278

determinant of two-by-two matrix,

279

diagonal form of matrix, 281

eigenvalues of matrix, 281

eigenvectors of a matrix, 281

identity matrix, 278

inverse of matrix, 280

matrix multiplication, 280

multiplying matrix by constant, 279

subtracting two matrices, 279

341

Index overview, 277–278 poles and stability, 302–303 problems, 326–332 properties of An and evaluation, 297–300 representation of systems in state space, 282–294 block diagram to state-space, 285–286, 285–287 nonrecursive systems, 283–284 recursive systems, 282–283 transfer function H(z) to state-space, 287–294, 288–291, 293

solution of state equation in real time,

295–297

solution of state-space equations in z-domain,

295

transformations for state-space

representations, 300–302

State values, use of z-transform method to find,

311–312

State vector, 300

output, 311

time domain, 296

z-domain, 296

Steady-state response, 131–135, 140, 154,

160–161, 164–165, 167–168, 193

Steady-state solution, 151

Step input, 209; see also Input

Step response, 124, 210–211

block diagram, 224–225

output, 211

sinusoidal responses, 96

use of MATLAB® to find, 318, 325, 330

zero initial conditions, 318

Step signals, 28; see also Signal(s)

bounded, 27

discrete, 14, 14–15

impulse signals, 31, 37

MATLAB®, 31, 32

MATLAB® functions, 111

not summable, 141

Subtraction; see also Addition

complex numbers, 126

of discrete signals, 22

junction, 73, 73

two matrices, 279

Summation equation, 95–96, 184; see also Equations

Summing junction, 73, 73, 75–77

Superposition, 132, 155, 321

Symmetry property, 138–139, 139

Systems

analogue, 3

auxiliary equation, 193

bounded, 87–88

cascade realization, 288–289, 289

causal, 56–57

characteristic equation, 64

defined, 51

difference equations of physical, 63

discrete, 111–113

frequency response of discrete, 135–139

inverse of system, 57–58, 58

linear, 84–86

linear discrete, 52–54, 70–75, 73–75

with memory, 56

nonrecursive, 283–284

poles, 193–194, 206

recursive, 282–283

representation in state space, 282–294

stability, 58, 58–59, 194

time-variant, 86–87

T Thermal interferences, 3

Third-order systems, output for, 83

Third-order transfer function, 185

Time

constant of discrete signals, 21–22

decimation in, 243

invariance of discrete signals, 54–56

scaling, 17

Time domain

discrete, 179

output, 218, 221

state vector, 296

Time-variant systems, 86–87; see also Systems Total energy; see also Energy

discrete signals, 25–26

MATLAB® to calculate, 255

nonperiodic signals, 29, 30, 254

signals, 146, 254–255

Transfer function, 194

algebraic equations, 193

H(z) to state-space, 287–294, 288–291, 293

linear time-invariant system, 193–194, 277

long division, 190

magnitude, 151

partial fraction expansion, 201, 324

representation as block diagrams, 185–186,

185–186

ROC, 206

state-space representations, 329

system, 143, 151, 210, 301

third-order, 185

use MATLAB® to find, 310

in z-domain, 190, 202–204, 287, 302

z-transform, 210, 219

Transformation discrete systems from continuous systems, 278

matrix, 300, 317

state-space representations, 300–302

342 Transform domain, convolution, 186

Transition matrix; see also Matrix

coefficients, 297

inverse transform, 297, 312, 314

inverse z-transform, 312

An, 297, 313

state, 296, 314

Trigonometric identities, 101

Two-by-two matrix, 279

U Unbounded discrete signals, 27; see also Discrete signals

Unilateral z-transform, 173–175

Unique set, 129–130

Unit circle, 239, 257

eigenvalues, 309

inside ROC, 204

magnitude, 70

output, 194

poles, 192, 194, 216, 218–219, 316

roots, 70, 210, 302–303

z-plane, 176

Unit step discrete signal, 4, 5, 173; see also Discrete signals; Signal(s)

V

Vector, see Initial condition vector; State vector Voltage

AC source, 28

capacitor, 277

constant, 28–29

current and, 1

magnitude, 28

resistor, 277

source, 28–29

transmission, 1

value, 1

W Wave, see Continuous wave Window

Index Hamming, 258

Hanning, 258, 262

rectangular, 258, 262

X

X(n), h(n), y(n), and z-transform, 186–187

Z Z-domain

block diagrams, 223

multiplication, 184, 197

solution of state-space equations in, 295

state vector, 296

transfer function, 190, 202–204, 287, 302

Zero input, response to system with, 297

Zero padding, 270

Zeros of system, 194; see also Systems

Z-transform and discrete systems, 171–229

bilateral z-transform, 171–173, 172

convergence, 175–178, 190–192

examples, 194–221

final value theorem, 192

initial-value theorem, 192–193

inverse z-transform, 178–181

long division, 181

partial fraction expansion, 178–180

overview, 171

pairs, 179

poles of the system, 193

problems, 222–229

properties of z-transform, 179, 182–184

convolution, 184

linearity property, 182

multiplication by e −an, 184

shifting property, 182–183

representation of transfer functions as block diagrams, 185–186, 185–186 solving difference equation using z-transform, 188–189

stability of the system, 194

unilateral z-transform, 173–175

x(n), h(n), y(n), and z-transform, 186–187

zeros of the system, 194