Signals and Systems Laboratory with MATLAB® TThhiiss ppaaggee iinntteennttiioonnaallllyy lleefftt bbllaannkk Alex Palamides Anastasia Veloni Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group, an informa business MATLAB® and Simulink® are trademarks of the MathWorks, Inc. and are 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® and Simulink® software or related products does not constitute endorsement or sponsorship by the MathWorks of a particular pedagogi- cal approach or particular use of the MATLAB® and Simulink® software. CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2011 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Version Date: 20110714 International Standard Book Number-13: 978-1-4398-9429-3 (eBook - PDF) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid- ity 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 uti- lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy- ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http:// www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com To Zoe A.P. To John A.V. TThhiiss ppaaggee iinntteennttiioonnaallllyy lleefftt bbllaannkk Contents Preface.......................................................................................................................................... xiii Authors....................................................................................................................................... xvii 1. Introduction to MATLAB.....................................................................................................1 1.1 What Is MATLAB?.......................................................................................................1 1.2 Working Environment.................................................................................................1 1.3 Getting Started..............................................................................................................2 1.3.1 Simple Arithmetic Operations.......................................................................3 1.3.2 Comments........................................................................................................3 1.3.3 The Variable ans..............................................................................................3 1.3.4 Priority of Operations.....................................................................................3 1.3.5 Constants..........................................................................................................4 1.3.6 Built-In Functions............................................................................................5 1.3.7 Variables...........................................................................................................6 1.3.8 Format...............................................................................................................7 1.3.9 Help in MATLAB............................................................................................7 1.4 Memory Management.................................................................................................8 1.4.1 Commandssave-load-exit-quit.........................................................9 1.4.2 The Command clear..................................................................................10 1.5 Commandsdiary and clc.....................................................................................10 1.6 Vectors.........................................................................................................................11 1.6.1 Row Vectors...................................................................................................11 1.6.2 Commandslength=size..........................................................................11 1.6.3 Addition=Subtraction...................................................................................12 1.6.4 Multiplication, Division, and Power..........................................................13 1.6.5 Column Vectors.............................................................................................14 1.6.6 Dot Product of Two Vectors........................................................................14 1.6.7 Useful Commands........................................................................................15 1.7 Matrices........................................................................................................................16 1.7.1 Matrix Concatenation...................................................................................17 1.7.2 WorkingwithMatrices................................................................................17 1.7.3 Addition=Subtraction...................................................................................19 1.7.4 Multiplication of Matrices............................................................................19 1.7.4.1 The DotProductas aSpecial Case of Matrix Multiplication.................................................................................21 1.7.5 Power of a Matrix.........................................................................................21 1.7.6 Inverse of a Matrix........................................................................................22 1.7.7 Determinant of a Matrix..............................................................................22 1.7.8 Divisionof Matrices......................................................................................23 1.7.9 Transpose of aMatrix...................................................................................24 1.7.10 Special Forms of Matrices............................................................................25 1.7.11 Useful Commands........................................................................................26 1.8 Plotting with MATLAB.............................................................................................27 1.8.1 Plotting in Two Dimensions........................................................................27 v vi Contents 1.8.2 The Fig File.....................................................................................................29 1.8.3 The Command linspace...........................................................................29 1.8.4 Plotting SeveralFunctions in OneFigure..................................................30 1.8.5 Formatting a Figure......................................................................................32 1.8.6 Plotting in Different Figures........................................................................34 1.8.7 Commandsfor Plotting................................................................................36 1.8.8 Plotting Discrete-Time Functions................................................................38 1.8.9 Graph in Polar Coordinates.........................................................................39 1.8.10 Piecewise Functions......................................................................................39 1.8.11 Plotting in ThreeDimensions......................................................................40 1.8.11.1 PlottingCurves in ThreeDimensions........................................41 1.8.11.2 PlottingSurfaces in ThreeDimensions......................................41 1.9 Complex Numbers.....................................................................................................43 1.9.1 Useful Commands........................................................................................43 1.9.2 Forms of ComplexNumbers.......................................................................44 1.9.3 Operations with Complex Numbers..........................................................45 1.9.4 Graph ofComplex Numbers.......................................................................46 1.10 M-Files.........................................................................................................................48 1.10.1 Scripts..............................................................................................................48 1.10.2 Functions........................................................................................................51 1.11 Input=Output Commands........................................................................................54 1.12 File Management........................................................................................................55 1.13 Logical=Relational Operators...................................................................................57 1.14 Control Flow...............................................................................................................58 1.15 SymbolicVariables.....................................................................................................62 1.15.1 Differentiation of a Function.......................................................................62 1.15.2 Integration of a Function.............................................................................63 1.15.3 Summationof a Function............................................................................63 1.15.4 RationalForm................................................................................................64 1.15.5 Solving AlgebraicEquations.......................................................................64 1.15.6 Solving DifferentialEquations....................................................................65 1.15.7 The Command subs....................................................................................66 1.16 Polynomials.................................................................................................................66 1.17 (Pseudo)Random Numbers......................................................................................68 1.18 Solved Problems.........................................................................................................69 1.19 HomeworkProblems.................................................................................................75 2. Signals....................................................................................................................................77 2.1 Categorization by the Variable Type......................................................................77 2.1.1 Continuous-Time Signals.............................................................................77 2.1.2 Discrete-Time Signals...................................................................................78 2.1.3 Digital Signals................................................................................................79 2.2 Basic Continuous-TimeSignals................................................................................81 2.2.1 SinusoidalSignals.........................................................................................81 2.2.2 Exponential Signals.......................................................................................82 2.2.3 Complex Exponential Signals......................................................................83 2.2.4 Unit Step Function........................................................................................84 2.2.5 Unit Impulse or Dirac Delta Function.......................................................89 Contents vii 2.2.6 Ramp Function..............................................................................................93 2.2.7 RectangularPulse Function.........................................................................96 2.3 Discrete-Time Signals................................................................................................99 2.3.1 Unit Impulse Sequence...............................................................................100 2.3.2 Unit Step Sequence.....................................................................................102 2.3.3 Real Exponential Sequence........................................................................104 2.3.4 Complex Exponential Sequence................................................................105 2.3.5 SinusoidalSequence...................................................................................109 2.4 Properties of Signals................................................................................................111 2.4.1 Periodic Signals...........................................................................................111 2.4.1.1 Sum of PeriodicContinuous-TimeSignals..............................112 2.4.1.2 Construction of PeriodicSignals...............................................114 2.4.2 Causal Signals..............................................................................................118 2.4.3 Even and Odd Signals................................................................................119 2.4.4 Energy and Power Signals.........................................................................121 2.4.5 Deterministic and StochasticSignals........................................................124 2.5 Transformations of the Time Variable for Continuous-TimeSignals..............126 2.5.1 Time Reversalor Reflection.......................................................................126 2.5.2 Time Scaling.................................................................................................127 2.5.3 Time Shifting................................................................................................129 2.6 Transformations of the Time Variable for Discrete-Time Signals.....................132 2.7 Solved Problems.......................................................................................................135 2.8 HomeworkProblems...............................................................................................145 3. Systems................................................................................................................................147 3.1 Systems Classification..............................................................................................147 3.1.1 Classification according to the Number of Inputs and Outputs.........147 3.1.2 Continuous-Time and Discrete-Time Signals.........................................151 3.1.3 Deterministic and StochasticSystems......................................................151 3.2 Properties of Systems...............................................................................................151 3.2.1 Causal and NoncausalSystems................................................................151 3.2.2 Static (Memoryless) and Dynamic(with Memory) Systems................152 3.2.3 Linear and Nonlinear Systems..................................................................155 3.2.4 Time-Invariant andTime-VariantSystems.............................................158 3.2.5 Invertibleand Non-InvertibleSystems....................................................165 3.2.5.1 Construction of the Inverse System..........................................166 3.2.6 Stable and Unstable Systems.....................................................................167 3.3 Solved Problems.......................................................................................................168 3.4 HomeworkProblems...............................................................................................176 4. Time DomainSystemAnalysis......................................................................................179 4.1 Impulse Response.....................................................................................................179 4.2 Continuous-Time Convolution..............................................................................179 4.2.1 Computation of Convolution....................................................................180 4.2.2 The Command conv..................................................................................186 4.2.3 Deconvolution.............................................................................................188 4.2.4 Continuous-Time Convolution Examples...............................................189 4.3 Convolution Properties...........................................................................................199
Description: