Signals and Systems With MATLAB Computing and Simulink Modeling
Signals and Systems With MATLAB Computing and Simulink Modeling
Includes step-by-step X[ m ] =
N 1
n=0
x [n ]e
mn j2 -- --- N
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright 2008 Orchard Publications. All rights reserved. Printed in the United States of America. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a data base or retrieval system, without the prior written permission of the publisher. Direct all inquiries to Orchard Publications, [email protected] Product and corporate names are trademarks or registered trademarks of the Microsoft Corporation and The MathWorks Inc. They are used only for identification and explanation, without intent to infringe.
Preface
This text contains a comprehensive discussion on continuous and discrete time signals and systems with many MATLAB and several Simulink examples. It is written for junior and senior electrical and computer engineering students, and for selfstudy by working professionals. The prerequisites are a basic course in differential and integral calculus, and basic electric circuit theory. This book can be used in a twoquarter, or one semester course. This author has taught the subject material for many years and was able to cover all material in 16 weeks, with 2 lecture hours per week. To get the most out of this text, it is highly recommended that Appendix A is thoroughly reviewed. This appendix serves as an introduction to MATLAB, and is intended for those who are not familiar with it. The Student Edition of MATLAB is an inexpensive, and yet a very powerful software package; it can be found in many college bookstores, or can be obtained directly from The MathWorks Inc., 3 Apple Hill Drive, Natick, MA 017602098 Phone: 508 6477000, Fax: 508 6477001 http://www.mathworks.com email: [email protected] The elementary signals are reviewed in Chapter 1, and several examples are given. The purpose of this chapter is to enable the reader to express any waveform in terms of the unit step function, and subsequently the derivation of the Laplace transform of it. Chapters 2 through 4 are devoted to Laplace transformation and circuit analysis using this transform. Chapter 5 is an introduction to statespace and contains many illustrative examples. Chapter 6 discusses the impulse response. Chapters 7 and 8 are devoted to Fourier series and transform respectively. Chapter 9 introduces discretetime signals and the Z transform. Considerable time was spent on Chapter 10 to present the Discrete Fourier transform and FFT with the simplest possible explanations. Chapter 11 contains a thorough discussion to analog and digital filters analysis and design procedures. As mentioned above, Appendix A is an introduction to MATLAB. Appendix B is an introduction to Simulink, Appendix C contains a review of complex numbers, and Appendix D is an introduction to matrix theory. New to the Second Edition This is an extensive revision of the first edition. The most notable change is the inclusion of the solutions to all exercises at the end of each chapter. It is in response to many readers who expressed a desire to obtain the solutions in order to check their solutions to those of the author and thereby enhancing their knowledge. Another reason is that this text is written also for self
study by practicing engineers who need a review before taking more advanced courses such as digital image processing. Another major change is the addition of a rather comprehensive summary at the end of each chapter. Hopefully, this will be a valuable aid to instructors for preparation of view foils for presenting the material to their class. New to the Third Edition The most notable change is the inclusion of Simulink modeling examples. The pages where they appear can be found in the Table of Contents section of this text. Another change is the improvement of the plots generated by the latest revisions of the MATLAB Student Version, Release 14. The author wishes to express his gratitude to the staff of The MathWorks, the developers of MATLAB and Simulink, especially to Ms. Courtney Esposito, for the encouragement and unlimited support they have provided me with during the production of this text. Our heartfelt thanks also to Ms. Sally Wright, P.E., of Renewable Energy Research Laboratory University of Massachusetts, Amherst, for bringing some errors on the previous editions to our attention. New to the Fourth Edition The most notable change is the inclusion of Appendix E on window functions. The plots were generated generated with the latest revisions of the MATLAB R2008a edition. Also, two endof- chapter exercises were added in Chapter 10 to illustrate the use of the fft and ifft MATLAB functions The author wishes to express his gratitude to the staff of The MathWorks, the developers of MATLAB and Simulink, especially to The MathWorks Book Program Team, for the encouragement and unlimited support they have provided me with during the production of this and all other texts by this publisher.
11
Signals Described in Math Form .............................................................................11 The Unit Step Function ..........................................................................................12 The Unit Ramp Function ......................................................................................110 The Delta Function ............................................................................................... 111 1.4.1 The Sampling Property of the Delta Function ............................................112 1.4.2 The Sifting Property of the Delta Function ................................................113 Higher Order Delta Functions...............................................................................114 Summary ................................................................................................................122 Exercises.................................................................................................................123 Solutions to EndofChapter Exercises ................................................................124
21
2.1 Definition of the Laplace Transformation...............................................................21 2.2 Properties and Theorems of the Laplace Transform ...............................................22 2.2.1 Linearity Property ........................................................................................23 2.2.2 Time Shifting Property .................................................................................23 2.2.3 Frequency Shifting Property ........................................................................24 2.2.4 Scaling Property ...........................................................................................24 2.2.5 Differentiation in Time Domain Property ...................................................24 2.2.6 Differentiation in Complex Frequency Domain Property ...........................26 2.2.7 Integration in Time Domain Property .........................................................26 2.2.8 Integration in Complex Frequency Domain Property .................................28 2.2.9 Time Periodicity Property ............................................................................28 2.2.10 Initial Value Theorem..................................................................................29 2.2.11 Final Value Theorem .................................................................................210 2.2.12 Convolution in Time Domain Property.....................................................211 2.2.13 Convolution in Complex Frequency Domain Property.............................212 2.3 The Laplace Transform of Common Functions of Time.......................................214 2.3.1 The Laplace Transform of the Unit Step Function u 0 ( t ) ..........................214 2.3.2 The Laplace Transform of the Ramp Function u 1 ( t ) ................................214 2.3.3 The Laplace Transform of t n u0 ( t ) ..............................................................215 Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
2.4
2.3.4 The Laplace Transform of the Delta Function ( t ) ................................. 218 2.3.5 The Laplace Transform of the Delayed Delta Function ( t a ) .............. 218 2.3.6 The Laplace Transform of e at u 0 ( t ) .......................................................... 219 at 2.3.7 The Laplace Transform of t n e u 0 ( t ) ....................................................... 219 2.3.8 The Laplace Transform of sin t u 0 t ......................................................... 220 2.3.9 The Laplace Transform of cos t u 0 t ......................................................... 220 2.3.10 The Laplace Transform of e at sin t u 0 ( t ) ................................................. 221 2.3.11 The Laplace Transform of e at cos t u 0 ( t ) ................................................. 222 The Laplace Transform of Common Waveforms .................................................. 223 2.4.1 The Laplace Transform of a Pulse............................................................... 223 2.4.2 The Laplace Transform of a Linear Segment .............................................. 223 2.4.3 The Laplace Transform of a Triangular Waveform .................................... 224 2.4.4 The Laplace Transform of a Rectangular Periodic Waveform.................... 225 2.4.5 The Laplace Transform of a HalfRectified Sine Waveform ..................... 226 Using MATLAB for Finding the Laplace Transforms of Time Functions ............ 227 Summary ................................................................................................................ 228 Exercises................................................................................................................. 231 The Laplace Transform of a Sawtooth Periodic Waveform ............................... 232 The Laplace Transform of a FullRectified Sine Waveform.............................. 232 Solutions to EndofChapter Exercises................................................................. 233 31
3.1 The Inverse Laplace Transform Integral ..................................................................31 3.2 Partial Fraction Expansion........................................................................................31 3.2.1 Distinct Poles..................................................................................................32 3.2.2 Complex Poles ................................................................................................35 3.2.3 Multiple (Repeated) Poles..............................................................................38 3.3 Case where F(s) is Improper Rational Function.....................................................313 3.4 Alternate Method of Partial Fraction Expansion...................................................315 3.5 Summary .................................................................................................................319 3.6 Exercises..................................................................................................................321 3.7 Solutions to EndofChapter Exercises .................................................................322 MATLAB Computing Pages 33, 34, 35, 36, 38, 310, 312, 313, 314, 322
41
4.1 Circuit Transformation from Time to Complex Frequency.................................... 41 4.1.1 Resistive Network Transformation ............................................................... 41 4.1.2 Inductive Network Transformation .............................................................. 41 4.1.3 Capacitive Network Transformation ............................................................ 41
ii
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
Complex Impedance Z(s).........................................................................................48 Complex Admittance Y(s) .....................................................................................411 Transfer Functions .................................................................................................413 Using the Simulink Transfer Fcn Block.................................................................417 Summary.................................................................................................................420 Exercises .................................................................................................................421 Solutions to EndofChapter Exercises.................................................................424
MATLAB Computing Pages 46, 48, 412, 416, 417, 418, 426, 427, 428, 429, 434 Simulink Modeling Page 417
51
Expressing Differential Equations in State Equation Form................................... 51 Solution of Single State Equations ........................................................................ 56 The State Transition Matrix ................................................................................. 59 Computation of the State Transition Matrix ...................................................... 511 5.4.1 Distinct Eigenvalues ................................................................................. 511 5.4.2 Multiple (Repeated) Eigenvalues ............................................................. 515 5.5 Eigenvectors......................................................................................................... 518 5.6 Circuit Analysis with State Variables.................................................................. 522 5.7 Relationship between State Equations and Laplace Transform.......................... 530 5.8 Summary .............................................................................................................. 538 5.9 Exercises .............................................................................................................. 541 5.10 Solutions to EndofChapter Exercises .............................................................. 543 MATLAB Computing Pages 514, 515, 518, 526, 536, 548, 551 Simulink Modeling Pages 527, 537, 545
The Impulse Response and Convolution 6.1 6.2 6.3 6.4 6.5 6.6 6.7
61
The Impulse Response in Time Domain ................................................................ 61 Even and Odd Functions of Time .......................................................................... 64 Convolution ............................................................................................................ 67 Graphical Evaluation of the Convolution Integral................................................. 68 Circuit Analysis with the Convolution Integral ................................................... 618 Summary ............................................................................................................... 621 Exercises................................................................................................................ 623
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
iii
6.8 Solutions to EndofChapter Exercises................................................................ 625 MATLAB Applications Pages 612, 615, 630
Fourier Series
71
7.1 Wave Analysis......................................................................................................... 71 7.2 Evaluation of the Coefficients................................................................................. 72 7.3 Symmetry in Trigonometric Fourier Series ............................................................. 76 7.3.1 Symmetry in Square Waveform..................................................................... 78 7.3.2 Symmetry in Square Waveform with Ordinate Axis Shifted ........................ 78 7.3.3 Symmetry in Sawtooth Waveform................................................................. 79 7.3.4 Symmetry in Triangular Waveform ............................................................... 79 7.3.5 Symmetry in Fundamental, Second, and Third Harmonics........................ 710 7.4 Trigonometric Form of Fourier Series for Common Waveforms.......................... 710 7.4.1 Trigonometric Fourier Series for Square Waveform ................................... 711 7.4.2 Trigonometric Fourier Series for Sawtooth Waveform............................... 714 7.4.3 Trigonometric Fourier Series for Triangular Waveform ............................. 716 7.4.4 Trigonometric Fourier Series for HalfWave Rectifier Waveform............. 717 7.4.5 Trigonometric Fourier Series for FullWave Rectifier Waveform.............. 720 7.5 Gibbs Phenomenon ............................................................................................... 724 7.6 Alternate Forms of the Trigonometric Fourier Series .......................................... 724 7.7 Circuit Analysis with Trigonometric Fourier Series............................................. 728 7.8 The Exponential Form of the Fourier Series........................................................ 731 7.9 Symmetry in Exponential Fourier Series .............................................................. 733 7.9.1 Even Functions ........................................................................................... 733 7.9.2 Odd Functions ............................................................................................ 734 7.9.3 Half-Wave Symmetry ................................................................................. 734 7.9.4 No Symmetry .............................................................................................. 734 7.9.5 Relation of C n to C n ................................................................................ 734 7.10 Line Spectra.......................................................................................................... 736 7.11 Computation of RMS Values from Fourier Series................................................ 741 7.12 Computation of Average Power from Fourier Series ........................................... 744 7.13 Evaluation of Fourier Coefficients Using Excel ................................................ 746 7.14 Evaluation of Fourier Coefficients Using MATLAB ........................................ 747 7.15 Summary ............................................................................................................... 750 7.16 Exercises ............................................................................................................... 753 7.17 Solutions to EndofChapter Exercises ............................................................... 755 MATLAB Computing Pages 738, 747
iv
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
81
8.4
Definition and Special Forms ................................................................................ 81 Special Forms of the Fourier Transform ................................................................ 82 8.2.1 Real Time Functions.................................................................................. 83 8.2.2 Imaginary Time Functions ......................................................................... 86 Properties and Theorems of the Fourier Transform .............................................. 89 8.3.1 Linearity...................................................................................................... 89 8.3.2 Symmetry.................................................................................................... 89 8.3.3 Time Scaling............................................................................................. 810 8.3.4 Time Shifting............................................................................................ 811 8.3.5 Frequency Shifting ................................................................................... 811 8.3.6 Time Differentiation ................................................................................ 812 8.3.7 Frequency Differentiation ........................................................................ 813 8.3.8 Time Integration ...................................................................................... 813 8.3.9 Conjugate Time and Frequency Functions.............................................. 813 8.3.10 Time Convolution .................................................................................... 814 8.3.11 Frequency Convolution............................................................................ 815 8.3.12 Area Under f ( t ) ........................................................................................ 815 8.3.13 Area Under F ( ) ...................................................................................... 815 8.3.14 Parsevals Theorem................................................................................... 816 Fourier Transform Pairs of Common Functions.................................................. 818 8.4.1 The Delta Function Pair .......................................................................... 818 8.4.2 The Constant Function Pair .................................................................... 818 8.4.3 The Cosine Function Pair ........................................................................ 819 8.4.4 The Sine Function Pair............................................................................. 820 8.4.5 The Signum Function Pair........................................................................ 820 8.4.6 The Unit Step Function Pair .................................................................... 822 8.4.7 The e
j 0 t
u0 ( t )
8.4.8 The ( cos 0 t ) ( u 0 t ) Function Pair ............................................................... 824 8.4.9 The ( sin 0 t ) ( u 0 t ) Function Pair ............................................................... 825 8.5 8.6 Derivation of the Fourier Transform from the Laplace Transform .................... 825 Fourier Transforms of Common Waveforms ...................................................... 827 8.6.1 The Transform of f ( t ) = A [ u 0 ( t + T ) u 0 ( t T ) ] ....................................... 827 8.6.2 The Transform of f ( t ) = A [ u 0 ( t ) u 0 ( t 2T ) ] ........................................... 828 8.6.3 The Transform of f ( t ) = A [ u 0 ( t + T ) + u 0 ( t ) u 0 ( t T ) u 0 ( t 2T ) ] ........... 829 Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
8.6.4 The Transform of f ( t ) = A cos 0 t [ u0 ( t + T ) u 0 ( t T ) ] .............................. 830 8.6.5 The Transform of a Periodic Time Function with Period T..................... 831 8.6.6 The Transform of the Periodic Time Function f ( t ) = A 8.7 8.8 8.9 8.10 8.11
n =
( t nT ) .... 832
Using MATLAB for Finding the Fourier Transform of Time Functions............ 833 The System Function and Applications to Circuit Analysis............................... 834 Summary .............................................................................................................. 842 Exercises............................................................................................................... 847 Solutions to EndofChapter Exercises .............................................................. 849
MATLAB Computing Pages 833, 834, 850, 854, 855, 856, 859, 860
91
Definition and Special Forms of the Z Transform ............................................... 91 Properties and Theorems of the Z Transform...................................................... 93 9.2.1 Linearity ..................................................................................................... 93 9.2.2 Shift of f [ n ]u 0 [ n ] in the DiscreteTime Domain ..................................... 93 9.2.3 Right Shift in the DiscreteTime Domain ................................................ 94 9.2.4 Left Shift in the DiscreteTime Domain................................................... 95 9.2.5 Multiplication by a in the DiscreteTime Domain................................. 96 9.2.6 Multiplication by e in the DiscreteTime Domain ........................... 96 9.2.7 Multiplication by n and n2 in the DiscreteTime Domain ..................... 96 9.2.8 Summation in the DiscreteTime Domain ............................................... 97 9.2.9 Convolution in the DiscreteTime Domain ............................................. 98 9.2.10 Convolution in the DiscreteFrequency Domain ..................................... 99 9.2.11 Initial Value Theorem ............................................................................... 99 9.2.12 Final Value Theorem............................................................................... 910 The Z Transform of Common DiscreteTime Functions.................................. 911 9.3.1 The Transform of the Geometric Sequence .............................................911 9.3.2 The Transform of the DiscreteTime Unit Step Function ......................914 9.3.3 The Transform of the DiscreteTime Exponential Sequence .................916 9.3.4 The Transform of the DiscreteTime Cosine and Sine Functions ..........916 9.3.5 The Transform of the DiscreteTime Unit Ramp Function....................918 Computation of the Z Transform with Contour Integration .............................920 Transformation Between s and zDomains .......................................................922 The Inverse Z Transform ...................................................................................925
naT
9.3
vi
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
9.6.1 Partial Fraction Expansion ..................................................................... 925 9.6.2 The Inversion Integral............................................................................ 932 9.6.3 Long Division of Polynomials ................................................................ 936 The Transfer Function of DiscreteTime Systems ............................................ 938 State Equations for DiscreteTime Systems ...................................................... 945 Summary............................................................................................................. 948 Exercises ............................................................................................................. 953 Solutions to EndofChapter Exercises............................................................. 955
MATLAB Computing Pages 935, 937, 938, 941, 942, 959, 961 Simulink Modeling Page 944 Excel Plots Pages 935, 944
10
101
10.1 The Discrete Fourier Transform (DFT) ............................................................101 10.2 Even and Odd Properties of the DFT ................................................................109 10.3 Common Properties and Theorems of the DFT ..............................................1010 10.3.1 Linearity ...............................................................................................1010 10.3.2 Time Shift ............................................................................................1011 10.3.3 Frequency Shift....................................................................................1012 10.3.4 Time Convolution ...............................................................................1012 10.3.5 Frequency Convolution .......................................................................1013 10.4 The Sampling Theorem ...................................................................................1013 10.5 Number of Operations Required to Compute the DFT ..................................1016 10.6 The Fast Fourier Transform (FFT) ..................................................................1017 10.7 Summary...........................................................................................................1028 10.8 Exercises ...........................................................................................................1031 10.9 Solutions to EndofChapter Exercises...........................................................1033 MATLAB Computing Pages 105, 107, 1034 Excel Analysis ToolPak Pages 106, 108
11
Analog and Digital Filters 11.1 Filter Types and Classifications......................................................................... 111 11.2 Basic Analog Filters........................................................................................... 112
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
vii
11.3
11.2.1 RC LowPass Filter ............................................................................... 112 11.2.2 RC HighPass Filter .............................................................................. 114 11.2.3 RLC BandPass Filter.............................................................................117 11.2.4 RLC BandElimination Filter ................................................................118 LowPass Analog Filter Prototypes ..................................................................1110 11.3.1 Butterworth Analog LowPass Filter Design .......................................1114 11.3.2 Chebyshev Type I Analog LowPass Filter Design..............................1125 11.3.3 Chebyshev Type II Analog LowPass Filter Design ............................1138 11.3.4 Elliptic Analog LowPass Filter Design ...............................................1139 HighPass, BandPass, and BandElimination Filter Design..........................1141 Digital Filters ....................................................................................................1151 Digital Filter Design with Simulink..................................................................1170 11.6.1 The Direct Form I Realization of a Digital Filter.................................1170 11.6.2 The Direct Form II Realization of a Digital Filter................................1171 11.6.3 The Series Form Realization of a Digital Filter ....................................1173 11.6.4 The Parallel Form Realization of a Digital Filter .................................1175 11.6.5 The Digital Filter Design Block............................................................1178 Summary ...........................................................................................................1187 Exercises ...........................................................................................................1191 Solutions to EndofChapter Exercises ...........................................................1197
MATLAB Computing Pages 113, 114, 116, 117, 119, 1115, 1119, 1123, 1124, 1131, 1135, 1136, 1137, 1138, 1140, 1141, 1142, 1143, 1145, 1146, 1148, 1150, 1155, 1156, 1157, 1160, 1162, 1164, 1167, 1168, and 1197 through 11106 Simulink Modeling Pages 1171, 1174, 1177, 1178, 1180, 1182, 1183, 1184
Introduction to MATLAB A.1 A.2 A.3 A.4 A.5 A.6 A.7 A.8 A.9 A.10 A.11
A1
MATLAB and Simulink ........................................................................... A1 Command Window ......................................................................................... A1 Roots of Polynomials ....................................................................................... A3 Polynomial Construction from Known Roots ................................................. A4 Evaluation of a Polynomial at Specified Values .............................................. A6 Rational Polynomials ....................................................................................... A8 Using MATLAB to Make Plots..................................................................... A10 Subplots ......................................................................................................... A18 Multiplication, Division, and Exponentiation .............................................. A18 Script and Function Files .............................................................................. A26 Display Formats ............................................................................................. A31
viii
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
MATLAB Computing Pages A3 through A8, A10, A13, A14, A16, A17, A21, A22, A24, A27
Introduction to Simulink
B1
B.1 Simulink and its Relation to MATLAB............................................................. B1 B.2 Simulink Demos ............................................................................................... B20 MATLAB Computing Page B4 Simulink Modeling Pages B7, B12, B14, B18
C1
Definition of a Complex Number....................................................................... C1 Addition and Subtraction of Complex Numbers ............................................... C2 Multiplication of Complex Numbers.................................................................. C3 Division of Complex Numbers ........................................................................... C4 Exponential and Polar Forms of Complex Numbers.......................................... C4
Matrices and Determinants D.1 D.2 D.3 D.4 D.5 D.6 D.7 D.8 D.9 D.10 D.11 D.12
D1
Matrix Definition.............................................................................................D1 Matrix Operations ...........................................................................................D2 Special Forms of Matrices................................................................................D6 Determinants .................................................................................................D10 Minors and Cofactors ....................................................................................D12 Cramers Rule ................................................................................................D17 Gaussian Elimination Method.......................................................................D19 The Adjoint of a Matrix ................................................................................D21 Singular and NonSingular Matrices ............................................................D21 The Inverse of a Matrix .................................................................................D22 Solution of Simultaneous Equations with Matrices ......................................D24 Exercises.........................................................................................................D31
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
ix
MATLAB Computing Pages D3, D4, D5, D7, D8, D9, D10, D12, D19, D23, D27, D29 Simulink Modeling Page D3 Excel Spreadsheet Page D28
Window Functions
E1
E.1 Window Function Defined .................................................................................. E1 E.2 Common Window Functions ............................................................................... E1 E.2.1 Rectangular Window Function ................................................................. E2 E.2.2 Triangular Window Function.................................................................... E5 E.2.3 Hanning Window Function....................................................................... E7 E.2.4 Hamming Window Function..................................................................... E9 E.2.5 Blackman Window Function................................................................... E12 E.2.6 Kaiser Family of Window Functions ....................................................... E14 E.3 Other Window Functions .................................................................................. E15 E.4 Fourier Series Method for Approximating an FIR Amplitude Response .......... E17 References Index R1 IN1
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
Chapter 1
Elementary Signals
his chapter begins with a discussion of elementary signals that may be applied to electric networks. The unit step, unit ramp, and delta functions are then introduced. The sampling and sifting properties of the delta function are defined and derived. Several examples for expressing a variety of waveforms in terms of these elementary signals are provided. Throughout this text, a left justified horizontal bar will denote the beginning of an example, and a right justified horizontal bar will denote the end of the example. These bars will not be shown whenever an example begins at the top of a page or at the bottom of a page. Also, when one example follows immediately after a previous example, the right justified bar will be omitted.
+
vS
We wish to describe v out in a math form for the time interval < t < + . To do this, it is convenient to divide the time interval into two parts, < t < 0 , and 0 < t < . For the time interval < t < 0 , the switch is open and therefore, the output voltage v out is zero. In other words, (1.1) v out = 0 for < t < 0 For the time interval 0 < t < , the switch is closed. Then, the input voltage v S appears at the output, i.e., (1.2) v out = v S for 0 < t < Combining (1.1) and (1.2) into a single relationship, we obtain
0 < t < 0 v out = vS 0 < t <
(1.3)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
11
The waveform of Figure 1.2 is an example of a discontinuous function. A function is said to be discontinuous if it exhibits points of discontinuity, that is, the function jumps from one value to another without taking on any intermediate values.
(1.4)
In the waveform of Figure 1.3, the unit step function u 0 ( t ) changes abruptly from 0 to 1 at
t = 0 . But if it changes at t = t 0 instead, it is denoted as u 0 ( t t 0 ) . In this case, its waveform and
* In some books, the unit step function is denoted as u ( t ) , that is, without the subscript 0. In this text, however, we will reserve the u ( t ) designation for any input when we will discuss state variables in Chapter 5.
12
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(1.5)
If the unit step function changes abruptly from 0 to 1 at t = t 0 , it is denoted as u 0 ( t + t 0 ) . In this case, its waveform and definition are as shown in Figure 1.5 and relation (1.6) respectively.
1 t0 0 u0 ( t + t0 ) t
(1.6)
Example 1.1 Consider the network of Figure 1.6, where the switch is closed at time t = T .
R
+
vS
Express the output voltage v out as a function of the unit step function, and sketch the appropriate waveform. Solution: For this example, the output voltage v out = 0 for t < T , and v out = v S for t > T . Therefore,
v out = v S u 0 ( t T )
(1.7)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
13
Other forms of the unit step function are shown in Figure 1.8. t
(a) A u0 ( t ) Au 0 ( t ) Au 0 ( t + T ) 0 A (b) A u0 ( t T ) A
0 A
0 (c)
A u0 ( t + T )
A 0 0 (h) A (e)
Au 0 ( t T )
(d)
(f)
0 A u0 ( t ) A
(g)
0 A (i)
A u0 ( t + T )
A u0 ( t T )
Unit step functions can be used to represent other timevarying functions such as the rectangular pulse shown in Figure 1.9.
1 0 1 (a) u0 ( t )
0 (b)
1 0 (c)
t
u0 ( t 1 )
Figure 1.9. A rectangular pulse expressed as the sum of two unit step functions
14
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0
A
Solution: Line segment has height A , starts at t = 0 , and terminates at t = T . Then, as in Example 1.1, this segment is expressed as
v1 ( t ) = A [ u0 ( t ) u0 ( t T ) ]
(1.8)
(1.9)
Line segment
as
(1.10)
Line segment
(1.11)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
15
(1.12)
(1.13)
Example 1.3 Express the symmetric rectangular pulse of Figure 1.11 as a sum of unit step functions.
A i(t)
T 2
T2
Solution: This pulse has height A , starts at t = T 2 , and terminates at t = T 2 . Therefore, with reference to Figures 1.5 and 1.8 (b), we obtain
T T T T i ( t ) = Au 0 t + -- Au 0 t -- = A u 0 t + -- u 0 t -- 2 2 2 2
(1.14)
Example 1.4 Express the symmetric triangular waveform of Figure 1.12 as a sum of unit step functions.
1 v(t)
T 2
T2
Solution:
16
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and
v( t)
2 -- t + 1 T
T 2
T2
,
2 T v 1 ( t ) = -- t + 1 u 0 t + -- u 0 ( t ) T 2
(1.15)
,
2 v 2 ( t ) = -- t + 1 u 0 ( t ) u 0 t T - T 2
(1.16)
(1.17)
Example 1.5 Express the waveform of Figure 1.14 as a sum of unit step functions.
3
v( t)
2 1
Solution:
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
17
v(t)
2t + 1
1
t+3
0
(1.18)
Two other functions of interest are the unit ramp function, and the unit impulse or delta function. We will introduce them with the examples that follow. Example 1.6 In the network of Figure 1.16 i S is a constant current source and the switch is closed at time
t = 0 . Express the capacitor voltage v C ( t ) as a function of the unit step.
18
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
t = 0
+
iS C
vC ( t )
Solution: The current through the capacitor is i C ( t ) = i S = cons tan t , and the capacitor voltage v C ( t ) is
1 v C ( t ) = --C
C ( ) d
(1.19)
where is a dummy variable. Since the switch closes at t = 0 , we can express the current i C ( t ) as iC ( t ) = iS u0 ( t ) and assuming that v C ( t ) = 0 for t < 0 , we can write (1.19) as
1 v C ( t ) = --C
(1.20)
or
iS v C ( t ) = ---- tu 0 ( t ) C
i S u 0 ( ) d =
iS --C
u0 ( ) d
0
iS + --C
0 u 0 ( ) d
(1.21)
(1.22)
Therefore, we see that when a capacitor is charged with a constant current, the voltage across it is a linear function and forms a ramp with slope i S C as shown in Figure 1.17.
vC ( t ) slope = i S C 0 t Figure 1.17. Voltage across a capacitor when charged with a constant current source
* Since the initial condition for the capacitor voltage was not specified, we express this integral with at the lower limit of integration so that any non-zero value prior to t < 0 would be included in the integration.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
19
u 0 ( ) d
(1.23)
where is a dummy variable. We can evaluate the integral of (1.23) by considering the area under the unit step function u 0 ( t ) from to t as shown in Figure 1.18.
Area = 1 = = t
1 t
Therefore, we define u 1 ( t ) as
0 u1 ( t ) = t t<0 t0
(1.24)
(1.25)
Higher order functions of t can be generated by repeated integration of the unit step function. For example, integrating u 0 ( t ) twice and multiplying by 2 , we define u 2 ( t ) as
0 u2 ( t ) = 2 t t<0 t0 t<0 t0 t<0 t0 or u2 ( t ) = 2
u1 ( ) d u2 ( ) d
t t
(1.26)
Similarly,
0 u3 ( t ) = 3 t 0 un ( t ) = n t
or
u3 ( t ) = 3
(1.27)
and in general,
or
un ( t ) = 3
u n 1 ( ) d
(1.28)
Also,
110
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(1.29)
Example 1.7 In the network of Figure 1.19, the switch is closed at time t = 0 and i L ( t ) = 0 for t < 0 . Express the inductor current i L ( t ) in terms of the unit step function.
R
t = 0 iL ( t ) vL ( t ) L
iS
(1.30) (1.31)
(1.32)
But, as we know, u 0 ( t ) is constant ( 0 or 1 ) for all time except at t = 0 where it is discontinuous. Since the derivative of any constant is zero, the derivative of the unit step u 0 ( t ) has a nonzero value only at t = 0 . The derivative of the unit step function is defined in the next section.
and
( ) d
= u0 ( t )
(1.33) (1.34)
( t ) = 0 for all t 0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
111
1 2
Figure (b) t
The function of Figure 1.20 (a) becomes the unit step as 0 . Figure 1.20 (b) is the derivative of Figure 1.20 (a), where we see that as 0 , 1 2 becomes unbounded, but the area of the rectangle remains 1 . Therefore, in the limit, we can think of ( t ) as approaching a very large spike or impulse at the origin, with unbounded amplitude, zero width, and area equal to 1 . Two useful properties of the delta function are the sampling property and the sifting property.
(1.35) (1.36)
or, when a = 0 ,
f ( t ) ( t ) = f ( 0 ) ( t )
that is, multiplication of any function f ( t ) by the delta function ( t ) results in sampling the function at the time instants where the delta function is not zero. The study of discretetime systems is based on this property. Proof: Since ( t ) = 0 for t < 0 and t > 0 then,
f ( t ) ( t ) = 0 for t < 0 and t > 0
(1.37) (1.38)
We rewrite f ( t ) as
f(t) = f(0) + [f(t) f(0)]
112
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
f ( ) ( ) d =
f ( 0 ) ( ) d +
[ f ( ) f ( 0 ) ] ( ) d
t
(1.39)
The first integral on the right side of (1.39) contains the constant term f ( 0 ) ; this can be written outside the integral, that is,
and Therefore, (1.39) reduces to
f ( 0 ) ( ) d = f ( 0 )
( ) d
(1.40)
The second integral of the right side of (1.39) is always zero because
( t ) = 0 for t < 0 and t > 0 [f( ) f(0 ) ]
=0
= f(0 ) f( 0) = 0
f ( ) ( ) d = f ( 0 )
( ) d
(1.41)
(1.42)
f ( t ) ( t ) dt
= f()
(1.43)
that is, if we multiply any function f ( t ) by ( t ) , and integrate from to + , we will obtain the value of f ( t ) evaluated at t = . Proof: Let us consider the integral
a f ( t ) ( t ) dt
(1.44)
We will use integration by parts to evaluate this integral. We recall from the derivative of products that d ( xy ) = xdy + ydx or xdy = d ( xy ) ydx (1.45) and integrating both sides we obtain
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
113
x dy
= xy y dx
(1.46)
Now, we let x = f ( t ) ; then, dx = f ( t ) . We also let dy = ( t ) ; then, y = u 0 ( t ) . By substitution into (1.44), we obtain
f ( t ) ( t ) dt = f ( t )u 0 ( t )
a
a u0 ( t )f ( t ) dt
(1.47)
We have assumed that a < < b ; therefore, u 0 ( t ) = 0 for < a , and thus the first term of the right side of (1.47) reduces to f ( b ) . Also, the integral on the right side is zero for < a , and therefore, we can replace the lower limit of integration a by . We can now rewrite (1.47) as
a
and letting
f ( t ) ( t ) dt = f ( b )
f ( t ) d t
= f( b) f( b) + f( )
, we obtain (1.48)
f ( t ) ( t ) dt = f ( )
Sifting Property of ( t )
(1.49)
The function ' ( t ) is called doublet, '' ( t ) is called triplet, and so on. By a procedure similar to the derivation of the sampling property of the delta function, we can show that
f ( t )' ( t a ) = f ( a )' ( t a ) f ' ( a ) ( t a )
(1.50)
Also, the derivation of the sifting property of the delta function can be extended to show that
n nd f ( t ) ( t ) dt = ( 1 ) ------- [ f ( t ) ] n dt
(1.51)
t=
114
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
b.
Solution:
t ( t 2 ) dt
c. t ' ( t 3 )
2
a. The sampling property states that f ( t ) ( t a ) = f ( a ) ( t a ) For this example, f ( t ) = 3t and a = 1 . Then,
4
3t ( t 1 ) = { 3t
4 t=1
f ( t ) ( t ) dt
t ( t 2 ) dt = f ( 2 ) = t t = 2 = 2
c. The given expression contains the doublet; therefore, we use the relation
f ( t )' ( t a ) = f ( a )' ( t a ) f ' ( a ) ( t a )
d- 2 ' ( t 3 ) ---- t dt
t=3
( t 3 ) = 9' ( t 3 ) 6 ( t 3 )
Example 1.9 a. Express the voltage waveform v ( t ) shown in Figure 1.21 as a sum of unit step functions for the time interval 1 < t < 7 s . b. Using the result of part (a), compute the derivative of v ( t ) and sketch its waveform.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
115
Solution: a. We begin with the derivation of the equations for the linear segments of the given waveform as shown in Figure 1.22.
v(t) (V)
3 2 1
t (s) 1 2 2t Figure 1.22. Equations for the linear segments of Figure 1.21
(1.52)
116
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or
v ( t ) = 2tu 0 ( t + 1 ) + ( 2t + 2 )u 0 ( t 1 ) + ( t + 3 )u 0 ( t 2 ) + ( t 4 )u 0 ( t 4 ) + ( t + 5 )u 0 ( t 5 ) + ( t 6 )u 0 ( t 7 )
b. The derivative of v ( t ) is
dv = 2u ( t + 1 ) + 2t ( t + 1 ) 2u ( t 1 ) + ( 2t + 2 ) ( t 1 ) ----0 0 dt u 0 ( t 2 ) + ( t + 3 ) ( t 2 ) + u 0 ( t 4 ) + ( t 4 ) ( t 4 ) u 0 ( t 5 ) + ( t + 5 ) ( t 5 ) + u 0 ( t 7 ) + ( t 6 ) ( t 7 )
(1.53)
From the given waveform, we observe that discontinuities occur only at t = 1 , t = 2 , and t = 7 . Therefore, ( t 1 ) = 0 , ( t 4 ) = 0 , and ( t 5 ) = 0 , and the terms that contain these delta functions vanish. Also, by application of the sampling property,
2t ( t + 1 ) = { 2t
t = 1
} ( t + 1 ) = 2 ( t + 1 )
t=2
( t + 3 ) ( t 2 ) = { ( t + 3 ) ( t 6 ) ( t 7 ) = { ( t 6 )
} ( t 2 ) = ( t 2 )
t=7
} ( t 7 ) = ( t 7 )
(1.54)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
117
1 1 0
2 ( t + 1 )
We observe that a negative spike of magnitude 2 occurs at t = 1 , and two positive spikes of magnitude 1 occur at t = 2 , and t = 7 . These spikes occur because of the discontinuities at these points.
It would be interesting to observe the given signal and its derivative on the Scope block of the Simulink* model of Figure 1.24. They are shown in Figure 1.25.
The waveform created by the Signal Builder block is shown in Figure 1.25.
* A brief introduction to Simulink is presented in Appendix B. For a detailed procedure for generating piece-wise linear functions with Simulinks Signal Builder block, please refer to Introduction to Simulink with Engineering Applications, ISBN 0974423971
118
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Figure 1.25. Piecewise linear waveform for the Signal Builder block in Figure 1.24
The waveform in Figure 1.25 is created with the following procedure: 1. We open a new model by clicking on the new model icon shown as a blank page on the left corner of the top menu bar. Initially, the name Untitled appears on the top of this new model. We save it with the name Figure_1.25 and Simulink appends the .mdl extension to it. 2. From the Sources library, we drag the Signal Builder block into this new model. We also drag the Derivative block from the Continuous library, the Bus Creator block from the Commonly Used Blocks library, and the Scope block into this model, and we interconnect these blocks as shown in Figure 1.24. 3. We doubleclick on the Signal Builder block in Figure 1.24, and on the plot which appears as a square pulse, we click on the yaxis and we enter Minimum: 2.5, and Maximum: 3.5. Likewise we rightclick anywhere on the plot and we specify the Change Time Range at Min time: 2, and Max time: 8. 4. To select a particular point, we position the mouse cursor over that point and we leftclick. A circle is drawn around that point to indicate that it is selected. 5. To select a line segment, we leftclick on that segment. That line segment is now shown as a thick line indicating that it is selected. To deselect it, we press the Esc key. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
119
The two positive spikes that occur at t = 2 , and t = 7 , are clearly shown in Figure 1.26. MATLAB* has built-in functions for the unit step, and the delta functions. These are denoted by the names of the mathematicians who used them in their work. The unit step function u 0 ( t ) is referred to as Heaviside(t), and the delta function ( t ) is referred to as Dirac(t). Their use is illustrated with the examples below.
syms k a t; u=k*sym('Heaviside(ta)') % Define symbolic variables % Create unit step function at t = a
u = k*Heaviside(t-a)
d=diff(u) % Compute the derivative of the unit step function
d = k*Dirac(t-a)
* An introduction to MATLAB is given in Appendix A.
120
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
ans = Heaviside(t-a)*k
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
121
The unit step function offers a convenient method of describing the sudden application of a
u 0 ( ) d
The unit impulse or delta function, denoted as ( t ) , is the derivative of the unit step u 0 ( t ) . It is
also defined as
and
( ) d
= u0 ( t )
( t ) = 0 for all t 0 The sampling property of the delta function states that f ( t ) ( t a ) = f ( a ) ( t )
or, when a = 0 ,
f ( t ) ( t ) = f ( 0 ) ( t )
f ( t ) ( t ) dt
= f()
The sampling property of the doublet function ' ( t ) states that f ( t )' ( t a ) = f ( a )' ( t a ) f ' ( a ) ( t a )
122
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
e.
t e
2 t
( t 2 ) dt
-f. sin t 1 t 2
2
2. a. Express the voltage waveform v ( t ) shown below as a sum of unit step functions for the time interval 0 < t < 7 s .
v(t) (V) 20 e 10 0 1 10 20 2 3 4 5 6 7 t(s) 2t v(t)
b. Using the result of part (a), compute the derivative of v ( t ) , and sketch its waveform. This waveform cannot be used with Sinulinks Function Builder block because it contains the decaying exponential segment which is a nonlinear function.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
123
124
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
t = 4
t = 8
t -- = tan -- t -- = t -- 8 8 4 8
f ( t ) ( t ) dt
= f ( ) . Thus,
t e
2 t
( t 2 ) dt = t e
2 t t=2
= 4e
= 0.54
We recall that the sampling property for the doublet states that
f ( t )' ( t a ) = f ( a )' ( t a ) f ' ( a ) ( t a )
Thus,
2 1 2 sin t t -- = sin t 2 t = 2
d 2 1 t -- ---- sin t 2 dt
t = 2
t = 2
t -- 2
t = 2
f.
1 = -- ( 1 cos 2t ) 2
1 t -- sin 2t 2
t -- 2
1 1 1 = -- ( 1 + 1 ) t -- sin t -- = t -- 2 2 2 2
2. a.
v( t) = e
2t
[ u 0 ( t ) u 0 ( t 2 ) ] + ( 10t 30 ) [ u 0 ( t 2 ) u 0 ( t 3 ) ]
+ ( 10 t + 50 ) [ u 0 ( t 3 ) u 0 ( t 5 ) ] + ( 10t 70 ) [ u 0 ( t 5 ) u 0 ( t 7 ) ] v(t) = e
2t
u0 ( t ) e
2t
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
125
u0 ( t ) + ( e
2t
+ ( 10t + 70 )u 0 ( t 7 )
b.
2t 2t 2t 2t dv ----- = 2e u 0 ( t ) + e ( t ) + ( 2e + 10 )u 0 ( t 2 ) + ( e + 10t 30 ) ( t 2 ) dt
(1)
Referring to the given waveform we observe that discontinuities occur only at t = 2 , t = 3 , and t = 5 . Therefore, ( t ) = 0 and ( t 7 ) = 0 . Also, by the sampling property of the delta function
( e
2t
+ 10t 30 ) ( t 2 ) = ( e
2t
+ 10t 30 )
t=3
t=2
( t 2 ) 10 ( t 2 )
( t 3 ) = 20 ( t 3 )
t=5
( t 5 ) = 20 ( t 5 )
u 0 ( t ) + 2e
2t
u 0 ( t 2 ) + 10u 0 ( t 2 ) 10 ( t 2 )
[ u 0 ( t ) u 0 ( t 2 ) ] 10 ( t 2 ) + 10 [ u 0 ( t 2 ) u 0 ( t 3 ) ] + 20 ( t 3 )
10 [ u 0 ( t 3 ) u 0 ( t 5 ) ] 20 ( t 5 ) + 10 [ u 0 ( t 5 ) u 0 ( t 7 ) ]
(V s) 20 ( t 3 )
1
2t
2
10 ( t 2 )
5
20 ( t 5 )
t (s)
126
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 2
The Laplace Transformation
his chapter begins with an introduction to the Laplace transformation, definitions, and properties of the Laplace transformation. The initial value and final value theorems are also discussed and proved. It continues with the derivation of the Laplace transform of common functions of time, and concludes with the derivation of the Laplace transforms of common waveforms.
f ( t ) e j
+ j
st
dt
(2.1)
1{ F ( s ) } = f ( t ) = ------2j
F ( s ) e ds
1
st
(2.2)
where L { f ( t ) } denotes the Laplace transform of the time function f ( t ) , L { F ( s ) } denotes the Inverse Laplace transform, and s is a complex variable whose real part is , and imaginary part , that is, s = + j . In most problems, we are concerned with values of time t greater than some reference time, say t = t 0 = 0 , and since the initial conditions are generally known, the twosided Laplace transform pair of (2.1) and (2.2) simplifies to the unilateral or onesided Laplace transform defined as
L {f(t)}= F(s) =
f(t)e
st
dt =
0 f ( t ) e
st
dt
(2.3)
1 + j st { F ( s ) } = f ( t ) = ------F ( s ) e ds 2j j
(2.4)
The Laplace Transform of (2.3) has meaning only if the integral converges (reaches a limit), that is, if
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
21
0 f ( t ) e 0 f ( t )e
jt
st
dt <
(2.5)
To determine the conditions that will ensure us that the integral of (2.3) converges, we rewrite (2.5) as
t jt
dt <
jt
(2.6)
= 1 , and thus the con-
The term e in the integral of (2.6) has magnitude of unity, i.e., e dition for convergence becomes
0 f ( t )e
dt <
(2.7)
Fortunately, in most engineering applications the functions f ( t ) are of exponential order*. Then, we can express (2.7) as,
f ( t )e
dt <
ke
0 t t
dt
(2.8)
and we see that the integral on the right side of the inequality sign in (2.8), converges if > 0 . Therefore, we conclude that if f ( t ) is of exponential order, L { f ( t ) } exists if
Re { s } = > 0
(2.9)
where Re { s } denotes the real part of the complex variable s . Evaluation of the integral of (2.4) involves contour integration in the complex plane, and thus, it will not be attempted in this chapter. We will see in the next chapter that many Laplace transforms can be inverted with the use of a few standard pairs, and thus there is no need to use (2.4) to obtain the Inverse Laplace transform. In our subsequent discussion, we will denote transformation from the time domain to the complex frequency domain, and vice versa, as
f(t) F(s)
(2.10)
for all t 0 .
22
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
respectively, and
c 1 , c 2 , , c n
(2.11)
Proof:
L { c1 f1 ( t ) + c2 f2 ( t ) + + cn fn ( t ) } =
[ c 1 f 1 ( t ) + c 2 f 2 ( t ) + + c n f n ( t ) ] dt
= c1
f1 ( t ) e
st
dt + c 2
f2 ( t ) e
st
dt + + c n
fn ( t ) e
st
dt
= c1 F1 ( s ) + c2 F2 ( s ) + + cn Fn ( s )
Note 1: It is desirable to multiply f ( t ) by the unit step function u 0 ( t ) to eliminate any unwanted non zero values of f ( t ) for t < 0 .
F(s)
(2.12)
st
Proof:
L { f ( t a )u 0 ( t a ) } =
0e
st
dt +
a f( t a )e
dt
(2.13)
Now, we let t a = ; then, t = + a and dt = d . With these substitutions and with a 0 , the second integral on the right side of (2.13) is expressed as
f()e
s ( + a )
d = e
as
0 f ( ) e
d = e
as
F(s)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
23
f(t) F(s + a )
st
(2.14)
( s + a )t
Proof:
L {e
at
f( t) } =
at
f(t)e
dt =
0 f ( t ) e
dt = F ( s + a )
Note 2: A change of scale is represented by multiplication of the time variable t by a positive scaling factor a . Thus, the function f ( t ) after scaling the time axis, becomes f ( at ) .
(2.15)
Proof:
L { f ( at ) } =
0 f ( at ) e
st
dt
f( )e
s ( a )
1 d - = -a a
0 f ( ) e
( s a )
s 1 d ( ) = -- F - a a
Note 3: Generally, the initial value of f ( t ) is taken at t = 0 to include any discontinuity that may be present at t = 0 . If it is known that no such discontinuity exists at t = 0 , we simply interpret
f ( 0 ) as f ( 0 ) .
24
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(2.16)
Proof:
L {f '(t)} =
0 f ' ( t ) e
st
dt
v du
we let du = f ' ( t ) and v = e
st st
= uv u dv
st
. Then, u = f ( t ) , dv = se
+s
L { f ' ( t ) } = f ( t )e
f(t)e
st
dt = lim
st a
+ sF ( s )
= lim [ e
a
sa
f ( a ) f ( 0 ) ] + sF ( s ) = 0 f ( 0 ) + sF ( s )
(2.18)
(2.19)
and in general
d ------- f ( t ) s n F ( s ) s n 1 f ( 0 ) s n 2 f ' ( 0 ) f n dt
n n1
(0 )
(2.20)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
25
(2.21)
Proof:
L { f( t)} = F( s) =
0 f ( t ) e
st
dt
Differentiating with respect to s and applying Leibnitzs rule* for differentiation under the integral, we obtain
d d ---- F ( s ) = ---ds ds
f( t)e
st
dt =
st e f ( t )dt = s
t e
st
f ( t )dt =
0 [ tf ( t ) ] e
st
dt = L [ tf ( t ) ]
In general,
n nd t f ( t ) ( 1 ) ------- F ( s ) n ds n
(2.22)
The proof for n 2 follows by taking the second and higherorder derivatives of F ( s ) with respect to s .
a f ( x, ) dx
function of integration x and the parameter , a and b are constants independent of x and , and the partial derivative
dF f exists and it is continuous, then ------ = d
a ----------------- dx . ( )
( x, )
26
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Proof:
(2.23)
We begin by expressing the integral on the left side of (2.23) as two integrals, that is,
f ( ) d =
f ( ) d +
0 f ( ) d
(2.24)
The first integral on the right side of (2.24), represents a constant value since neither the upper, nor the lower limits of integration are functions of time, and this constant is an initial condition denoted as f ( 0 ) . We will find the Laplace transform of this constant, the transform of the second integral on the right side of (2.24), and will prove (2.23) by the linearity property. Thus,
L {f (0 )} =
0 f ( 0 ) e
st
dt = f ( 0 )
0 e
st
e dt = f ( 0 ) ------s
st 0
(2.25)
This is the value of the first integral in (2.24). Next, we will show that
0 f ( ) d ---------s
We let
g(t) =
F(s)
0 f ( ) d
then, and
g' ( t ) = f ( ) g( 0) =
0 f ( ) d
= 0
Now,
L { g' ( t ) } = G ( s ) = sL { g ( t ) } g ( 0 ) = G ( s ) 0 sL { g ( t ) } = G ( s ) G(s) L { g ( t ) } = ----------s
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
27
F(s) f ( ) d = ---------s 0
t
(2.26)
f( t) -------- t
s F ( s ) ds 0 f ( t ) e
st
(2.27)
Proof:
F(s) = dt
s s s
F ( s ) ds =
s 0 f ( t ) e 0 s
st
dt ds
F ( s ) ds =
st
ds f ( t ) dt
and performing the inner integration on the right side integral with respect to s , we obtain
F ( s ) ds =
1 st -- e t
f ( t ) dt =
0 -------- e t
f(t)
st
f ( t ) dt = L -------- t
0 f ( t ) e
st
dt divided by ( 1 e
sT
f ( t ) be a periodic function with period T , that is, f ( t ) = f ( t + nT ) , for n = 1, 2, 3, we obtain the transform pair
28
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0 f ( t ) e
st
(2.28)
f( t)e
st
dt =
f(t )e
st
dt +
2T
f(t)e
st
dt +
2T f ( t ) e
3T
st
dt +
In the first integral of the right side, we let t = , in the second t = + T , in the third t = + 2T , and so on. The areas under each period of f ( t ) are equal, and thus the upper and lower limits of integration are the same for each integral. Then,
L {f(t)} =
f( )e
d +
f( + T)e
s ( + T )
d +
0 f ( + 2T ) e
T
s ( + 2T )
d +
(2.29)
+e
2sT
+ )
0 f ( ) e
(2.30)
(2.31)
lim f ( t ) = lim sF ( s ) = f ( 0 )
s
(2.32)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
29
or
d L ---- f ( t ) = sF ( s ) f ( 0 ) = dt
d ---- f ( t ) e st dt dt
----- f ( t ) e T dt
lim
0 T
st
dt
lim [ sF ( s ) f ( 0 ) ] = lim
---- f ( t ) T dt
0 st
lim e
st
dt
lim e
= 0
lim [ sF ( s ) f ( 0 ) ] = 0 lim sF ( s ) = f ( 0 )
lim f ( t ) = lim sF ( s ) = f ( )
s0
(2.33)
or
210
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
d ---- f ( t ) e st dt dt
s0
s0
---- f ( t ) e T dt lim
0
st
dt
lim [ sF ( s ) f ( 0 ) ] = lim
----- f ( t ) dt T
0 st
s0
lim e
st
dt
s0
lim e
= 1
lim [ sF ( s ) f ( 0 ) ] = lim
T
0
d ---- f ( t ) dt = lim dt T
0
f ( t )
= lim [ f ( T ) f ( ) ] = f ( ) f ( 0 )
T 0
Therefore,
s0
lim sF ( s ) = f ( )
* Convolution is the process of overlapping two time functions f 1 ( t ) and f 2 ( t ) . The convolution integral indicates
the amount of overlap of one function as it is shifted over another function The convolution of two time functions
f1 ( t )
f1 ( )f2 ( t ) d
where is a dummy
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
211
f 1 ( )f 2 ( t ) d =
st
0 0 f1 ( )f2 ( t ) d
st
dt
(2.35)
0 f 1 ( ) 0 f 2 ( t ) e 0
dt d
f2 ( ) e
s ( + )
d d =
f 1 ( )e
0 f 2 ( ) e
= F 1 ( s )F 2 ( s )
(2.36)
Proof:
L { f 1 ( t )f 2 ( t ) } =
0 f1 ( t )f2 ( t ) e j
+ j
st
dt
(2.37)
1------2j
+ j
F 1 ( )e d f 2 ( t ) e
st
1dt = ------2j
+ j
F1 ( )
0 f 2 ( t ) e
( s )t
dt d
j F1 ( )F2 ( s )d
+ j
1 = ------- F 1 ( s )*F 2 ( s ) 2j
For easy reference, the Laplace transform pairs and theorems are summarized in Table 2.1.
212
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
f ( at )
d---- f ( t ) dt tf ( t ) t
f ( ) d
f(t) -------t f ( t + nT )
Frequency Integration
s F ( s ) ds 0 f ( t ) e
T
Time Periodicity
dt ----------------------------- sT 1e lim sF ( s ) = f ( 0 ) s
st
10 11 12 13
Initial Value Theorem Final Value Theorem Time Convolution Frequency Convolution
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
213
Chapter 2 The Laplace Transformation 2.3 The Laplace Transform of Common Functions of Time
In this section, we will derive the Laplace transform of common functions of time. They are presented in Subsections 2.3.1 through 2.3.11 below.
0 f ( t ) e
st 0
st
dt
or
L { u0 ( t ) } =
0 1 e
st
e dt = -------s
1 1 = 0 -- = - s s
(2.38)
for Re { s } = > 0 .*
0 f ( t ) e
st
dt
or
L { u1 ( t ) } = L { t } =
0 t e
st
dt
u dv
We let then,
= uv v du
st
(2.39)
u = t and dv = e
e du = 1 and v = ---------s
* This condition was established in relation (2.9), Page 22.
st
214
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
e - dt = ------------ e t e - ---------------2 s s s
st
st
st
(2.40)
0
Since the upper limit of integration in (2.40) produces an indeterminate form, we apply L Hpitals rule*, that is,
lim te
st
(2.41)
for > 0 .
Before deriving the Laplace transform of this function, we digress to review the gamma or generalized factorial function ( n ) which is an improper integral but converges (approaches a limit) for all n > 0 . It is defined as
f( x) Often, the ratio of two functions, such as ---------- , for some value of x, say a, results in an indeterminate form. To work g(x) f( x ) around this problem, we consider the limit lim ---------- , and we wish to find this limit, if it exists. To find this limit, we use xa
g(x)
ddLHpitals rule which states that if f ( a ) = g ( a ) = 0 , and if the limit ----- f ( x ) ----- g ( x ) as x approaches a exists, then, dx dx
xa
a f ( x ) dx a f ( x ) dx
b
where the limits of integration a or b or both are infinite where f(x) becomes infinite at a value x between the lower and upper limits of integration inclusive.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
215
0 x
n 1 x
e dx
(2.42)
We will now derive the basic properties of the gamma function, and its relation to the well known factorial function
n! = n ( n 1 ) ( n 2 ) 3 2 1
The integral of (2.42) can be evaluated by performing integration by parts. Thus, in (2.42) we let
u = e
x
and dv = x
n1
Then,
x ---du = e dx and v = x n n
1 + -n x=0
0 x e
n x
dx
(2.43)
With the condition that n > 0 , the first term on the right side of (2.43) vanishes at the lower limit x = 0 . It also vanishes at the upper limit as x . This can be proved with L Hpitals rule by differentiating both numerator and denominator m times, where m n . Then,
d
n x n m m
x dx dx x e lim ------------ = lim ------- = lim ------------------- = lim ------------------------------------ = m m1 x x x n x ne x d x d x ne ne m m1 dx dx = lim n ( n 1 ) ( n 2 ) ( n m + 1 )x - = lim ( n 1 ) ( n 2 ) ( n m + 1 - = 0 ------------------------------------------------------------------------------------------------------------------------------------------------------) x mn x x x ne e x
nm
m1
m1
nx
n1
0 x e
n x
dx
n 1 x
1 e dx = -n
0 x e
n x
dx
(2.44)
216
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(2.45)
or
n ( n ) = ( n + 1 )
(2.46)
It is convenient to use (2.45) for n < 0 , and (2.46) for n > 0 . From (2.45), we see that ( n ) becomes infinite as n 0 . For n = 1 , (2.42) yields
(1) =
e dx = e
x 0
= 1
(2.47)
(2.48)
(2.49)
( 4 ) = 3 ( 3 ) = 3 2 = 3! ( n + 1 ) = n!
(2.50)
The formula of (2.50) is a noteworthy relation; it establishes the relationship between the ( n ) function and the factorial n! We now return to the problem of finding the Laplace transform pair for t u 0 t , that is,
n
L { t u0 t } =
0 t
n st
dt
(2.51)
To make this integral resemble the integral of the gamma function, we let st = y , or t = y s , and thus dt = dy s . Now, we rewrite (2.51) as
L { t u0 t } =
n
n 1 y e y d y = -----------n+1 s s s
0 y e
n y
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
217
(2.52)
0 ( t ) e
st
st
dt
0 ( t ) e
(t) 1
dt = e
s ( 0 )
= 1
for all .
0 ( t a ) e
st
st
dt
and again, using the sifting property of the delta function, we obtain
L {(t a)} =
0 ( t a ) e
as
dt = e
as
(2.54)
for > 0 .
* The sifting property of the ( t ) is described in Subsection 1.4.2, Chapter 1, Page 113.
218
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
The Laplace Transform of Common Functions of Time 2.3.6 The Laplace Transform of e u 0 ( t )
We apply the definition
L {e
at at
u0 ( t ) } =
0 e
at st
dt =
0 e
( s + a )t
( s + a )t 1 dt = ---------- e s+a
1 = ---------s+a
1 u 0 ( t ) ---------s+a
(2.55)
for > a .
n at
(2.56)
f(t) F(s + a )
(2.57)
n! u 0 ( t ) -----------------------n+1 (s + a)
(2.58)
where n is a positive integer, and > a . Thus, for n = 1 , we obtain the transform pair
te
at
1 u 0 ( t ) ----------------2 (s + a)
(2.59)
2! u 0 ( t ) ----------------3 (s + a)
(2.60)
and in general,
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
219
n! u 0 ( t ) -----------------------n+1 (s + a)
(2.61)
for > a .
( sin t ) e
st
dt = lim
a 0
( sin t ) e
st
dt
Then,
ax
st
(2.62)
for > 0 .
( cos t ) e
st
dt = lim
a 0
( cos t ) e
st
dt
1- jt jt 1 at This can also be derived from sin t = ---- ( e e ) , and the use of (2.55) where e u 0 ( t ) ---------- . By the linearity
property, the sum of these terms corresponds to the sum of their Laplace transforms. Therefore,
1L [ sin tu 0 ( t ) ] = ---j2 1 1 ------------- -------------- = ---------------- s j s + j s2 + 2
j2
s+a
220
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Then,
ax
st
(2.63)
for > 0 .
at
f(t) F(s + a )
(2.64)
sin t u 0 ( t ) -----------------------------2 2 (s + a) +
(2.65)
1 jt jt We can use the relation cos t = -- ( e + e ) and the linearity property, as in the derivation of the transform of 2
dsin t on the footnote of the previous page. We can also use the transform pair ---- f ( t ) sF ( s ) f ( 0 ) ; this is the time dt
differentiation
property
of
(2.16).
Applying
this
transform
pair
for
this
derivation,
we
obtain
1 d1 d1 s L [ cos tu 0 ( t ) ] = L --- ---- sin tu 0 ( t ) = --- L ---- sin tu 0 ( t ) = --- s ----------------- = ----------------2 dt dt s2 + 2 s + 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
221
and using the frequency shifting property of (2.14), we replace s with s + a , and we obtain
e
at
(2.66)
for > 0 and a > 0 . For easy reference, we have summarized the above derivations in Table 2.2.
TABLE 2.2 Laplace Transform Pairs for Common Functions f (t) F( s) 1s 1s
2
1 2 3 4 5 6 7 8 9 10 11
u0 ( t ) t u0 ( t ) t u0 ( t ) (t) (t a) e
at n
---------n+1 s 1 e
as
n!
u0 ( t ) u0 ( t )
t e
n at
sin t u 0 ( t ) cos t u 0 ( t ) e e
at
sin t u 0 ( t ) cos t u 0 ( t )
at
222
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
The Laplace Transform of Common Waveforms 2.4 The Laplace Transform of Common Waveforms
In this section, we will present procedures for deriving the Laplace transform of common waveforms using the transform pairs of Tables 1 and 2. The derivations are described in Subsections 2.4.1 through 2.4.5 below.
a 0 Figure 2.1. Waveform for a pulse We first express the given waveform as a sum of unit step functions as weve learned in Chapter 1. Then, (2.67) fP ( t ) = A [ u0 ( t ) u0 ( t a ) ] From Table 2.1, Page 213,
f ( t a )u 0 ( t a ) e
as
F(s)
Thus,
Au 0 ( t ) A s
and
Au 0 ( t a ) e
as A
--s
Then, in accordance with the linearity property, the Laplace transform of the pulse of Figure 2.1 is
A as A A as A [ u 0 ( t ) u 0 ( t a ) ] --- e --- = --- ( 1 e ) s s s
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
223
We must first derive the equation of the linear segment. This is shown in Figure 2.3.
fL ( t )
1 0 1 2 t1
Figure 2.3. Waveform for a linear segment with the equation that describes it
Next, we express the given waveform in terms of the unit step function as follows:
f L ( t ) = ( t 1 )u 0 ( t 1 )
F(s)
(2.68)
224
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Figure 2.5. Triangular waveform with the equations of the linear segments
Next, we express the given waveform in terms of the unit step function.
fT ( t ) = t [ u0 ( t ) u0 ( t 1 ) ] + ( t + 2 ) [ u0 ( t 1 ) u0 ( t 2 ) ] = tu 0 ( t ) tu 0 ( t 1 ) tu 0 ( t 1 ) + 2u 0 ( t 1 ) + tu 0 ( t 2 ) 2u 0 ( t 2 )
F(s)
Then,
s 1 2s 1 1tu 0 ( t ) 2 ( t 1 )u 0 ( t 1 ) + ( t 2 )u 0 ( t 2 ) --- 2e --- + e --2 2 2 s s s
or
1s 2s tu 0 ( t ) 2 ( t 1 )u 0 ( t 1 ) + ( t 2 )u 0 ( t 2 ) --- ( 1 2e + e ) 2 s
(2.69)
0 f ( ) e
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
225
t
0 a 2a 3a
2a
fR ( t ) e
a
st
1 dt = ------------------ 2as 1e
2a
Ae
st
dt +
2a
( A ) e
st
dt
(2.70)
0 f ( ) e
226
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
f( t)e
st
1 dt = ------------------- 2s 1e
0 sin t e
st
dt
s
st
1 ( 1 + e )= ------------------ ------------------------2 2s (s + 1) (1 e )
s
(2.71)
2.5 Using MATLAB for Finding the Laplace Transforms of Time Functions
We can use the MATLAB function laplace to find the Laplace transform of a time function. For examples, please type
help laplace
in MATLABs Command prompt. We will be using this function extensively in the subsequent chapters of this book.
* This waveform was produced with the following MATLAB script: t=0:pi/64:5*pi; x=sin(t); y=sin(t2*pi); z=sin(t4*pi); plot(t,x,t,y,t,z); axis([0 5*pi 0 1])
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
227
f ( t ) e j
+ j
st
dt
1{ F ( s ) } = f ( t ) = ------2j
F ( s ) e ds
1
st
where L { f ( t ) } denotes the Laplace transform of the time function f ( t ) , L { F ( s ) } denotes the Inverse Laplace transform, and s is a complex variable whose real part is , and imaginary part , that is, s = + j .
The unilateral or onesided Laplace transform defined as L {f(t)}= F(s) =
f(t)e
st
dt =
0 f ( t ) e
st
dt
We denote transformation from the time domain to the complex frequency domain, and vice
versa, as
The time shifting property states that f ( t a )u 0 ( t a ) e The frequency shifting property states that e The scaling property states that 1 s f ( at ) -- F - a a The differentiation in time domain property states that d f ' ( t ) = ---- f ( t ) sF ( s ) f ( 0 ) dt
at as
F(s)
f(t) F(s + a )
Also,
228
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
d 2------- f ( t ) s 2 F ( s ) sf ( 0 ) f ' ( 0 ) 2 dt d3 ------- f ( t ) s 3 F ( s ) s 2 f ( 0 ) sf ' ( 0 ) f '' ( 0 ) 3 dt
and in general
d ------- f ( t ) s n F ( s ) s n 1 f ( 0 ) s n 2 f ' ( 0 ) f n dt
n n1
(0 )
where the terms f ( 0 ), f ' ( 0 ), f '' ( 0 ) , and so on, represent the initial conditions.
The differentiation in complex frequency domain property states that d tf ( t ) ---- F ( s ) ds
and in general,
n nd t f ( t ) ( 1 ) ------- F ( s ) n ds n
The integration in complex frequency domain property states that f(t) -------- t -------provided that the limit lim f ( t ) exists.
t0
s F ( s ) ds
The time periodicity property states that dt f ( t + nT ) ---------------------------- sT 1e The initial value theorem states that
t0
0 f ( t ) e
st
lim f ( t ) = lim sF ( s ) = f ( 0 )
s
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
229
lim f ( t ) = lim sF ( s ) = f ( )
s0
1 f 1 ( t )f 2 ( t ) ------- F 1 ( s )*F 2 ( s ) 2j
The Laplace transforms of some common functions of time are shown in Table 2.1, Page 213
The Laplace transforms of some common waveforms are shown in Table 2.2, Page222 We can use the MATLAB function laplace to find the Laplace transform of a time function
230
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
u0 ( t )
d. 8t e
7 5t
u0 ( t )
e. 15 ( t 4 )
b. 3 ( 2t 3 ) ( t 3 )
c. ( 3 sin 5t )u 0 ( t )
d. ( 5 cos 3t )u 0 ( t )
e. ( 2 tan 4t )u 0 ( t ) Be careful with this! Comment and you may skip derivation. 4. Derive the Laplace transform of the following time domain functions: a. 3t ( sin 5t )u 0 ( t ) d. 8e
3t
b. 2t ( cos 3t )u 0 ( t )
2
c. 2e
5t
sin 5t
cos 4t e. ( cos t ) ( t 4 )
5. Derive the Laplace transform of the following time domain functions: a. 5tu 0 ( t 3 ) d. ( 2t 4 )e b. ( 2t 5t + 4 )u 0 ( t 3 )
2
c. ( t 3 )e
2t
u0 ( t 2 )
2(t 2)
u0 ( t 3 )
e. 4te
3t
( cos 2t )u 0 ( t )
6. Derive the Laplace transform of the following time domain functions: a. d ( sin 3t )
dt
4t b. d ( 3e )
dt
2 c. d ( t cos 2t )
dt
2t d. d ( e sin 2t )
dt
2 2t e. d ( t e )
dt
b.
sin --------- d 0
t
sin at c. ----------t
d.
cos ---------- d
e e. ------ d
t
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
231
2a
3a
Write a simple MATLAB script that will produce the waveform above.
232
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
24 ----s
d. 5 s
e. 4 ---6 s
5!
2. From the definition of the Laplace transform or from Table 2.2, Page 222, we obtain:
7! 5 4s a. j8 s b. 5 s c. ----------- d. 8 ------------------ e. 15e 8 s+5 (s + 5)
3.
3 2! 4 a. From Table 2.2, Page 222, and the linearity property, we obtain 3! + ------------- + ---- + 3 ----4 3 2 s s s s
b. 3 ( 2t 3 ) ( t 3 ) = 3 ( 2t 3 )
t=3
( t 3 ) = 9 ( t 3 ) and 9 ( t 3 ) 9e
2 2
3s
This answer for part (e) looks suspicious because 8 s 8u 0 ( t ) and the Laplace transform is unilateral, that is, there is onetoone correspondence between the time domain and the complex frequency domain. The fallacy with this procedure is that we assumed that if
F1 ( s ) f1 ( t ) f 1 ( t ) F 1 ( s ) and f 2 ( t ) F 2 ( s ) , we cannot conclude that ---------- ------------ . For this exercise f2 ( t ) F2 ( s ) 1 f 1 ( t ) f 2 ( t ) = sin 4t ------------- , and as weve learned, multiplication in the time domain correcos 4t
sponds to convolution in the complex frequency domain. Accordingly, we must use the Laplace transform definition
0 ( 2 tan 4t )e
st
this analytical derivation. The interested reader may try to find the answer with the MATLAB script
syms s t; 2*laplace(sin(4*t)/cos(4*t))
n nd t f ( t ) ( 1 ) ------- F ( s ) n ds
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
233
( s + 9 ) ( 2s ) 2 ( s + 9 ) ( 2s ) ( s + 9 ) = 2 ------------------------------------------------------------------------------------------------4 2 (s + 9) ( s + 9 ) ( 2s ) 4s ( s + 9 ) 2s 18s + 4s 36s = 2 ------------------------------------------------------------------- = 2 ------------------------------------------------------3 3 2 2 (s + 9) (s + 9) 2s 54s 2s ( s 27 ) 4s ( s 2 27 ) = 2 ---------------------- = 2 -------------------------- = -------------------------3 3 3 2 2 2 (s + 9) (s + 9) (s + 9) 25 10 ------------------------------ = -----------------------------2 2 2 (s + 5) + 5 ( s + 5 ) + 25 8(s + 3) 8(s + 3) ----------------------------- = -----------------------------2 2 2 ( s + 3 ) + 16 (s + 3) + 4 cos t
4 3 2 2 2 3 3
c.
d.
e.
( t 4 ) = ( 2 2 ) ( t 4 ) and ( 2 2 ) ( t 4 ) ( 2 2 )e
( 4 )s
5.
a.
5tu 0 ( t 3 ) = [ 5 ( t 3 ) + 15 ]u 0 ( t 3 ) e
3s
b.
2 2 2 2 2
5 3s 5- -------- + 15 = -- e 1 + 3 s 2 s s s
( 2t 5t + 4 )u 0 ( t 3 ) = [ 2 ( t 3 ) + 12t 18 5t + 4 ]u 0 ( t 3 ) = [ 2 ( t 3 ) + 7t 14 ]u 0 ( t 3 ) = [ 2 ( t 3 ) + 7 ( t 3 ) + 21 14 ]u 0 ( t 3 ) = [ 2 ( t 3 ) + 7 ( t 3 ) + 7 ]u 0 ( t 3 ) e
3s 2
2! 7 7 ------------- + --- + -- - 3 2 s s s
c.
( t 3 )e
2t
u 0 ( t 2 ) = [ ( t 2 ) 1 ]e e
4
2 ( t 2 )
e u0 ( t 2 )
2s
4 2s ( s + 1 ) 1 1 ----------------------------------- --------------- = e e 2 2 (s + 2) (s + 2) (s + 2)
234
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
u 0 ( t 3 ) = [ 2 ( t 3 ) + 6 4 ]e e
2
2 ( t 3 )
e u0 ( t 3 )
3s
e.
4te
3t
s+3 ds+3 1 d ( cos 2t )u 0 ( t ) 4 ( 1 ) ---- ----------------------------- = 4 ---- ---------------------------------ds ( s + 3 ) 2 + 2 2 ds s 2 + 6s + 9 + 4 s+3 d s + 6s + 13 ( s + 3 ) ( 2s + 6 ) 4 ---- ---------------------------- = 4 ----------------------------------------------------------------------2 2 ds s 2 + 6s + 13 ( s + 6s + 13 )
2 s + 6s + 13 2s 6s 6s 18 4 ( s + 6s + 5 ) 4 ----------------------------------------------------------------------------- = ----------------------------------2 2 2 2 ( s + 6s + 13 ) ( s + 6s + 13 ) 2 2 2
6.
a.
3 sin 3t --------------2 2 s +3 d ---- f ( t ) sF ( s ) f ( 0 ) dt f ( 0 ) = sin 3t
t=0
= 0
b.
3e
4t
3 ---------s+4
d ---- f ( t ) sF ( s ) f ( 0 ) dt
f ( 0 ) = 3e
4t t=0
= 3
c.
s cos 2t --------------2 2 s +2
2 2
Thus,
2s ( s 12 ) 2 t cos 2t -------------------------3 2 (s + 4)
2
and
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
235
d.
2 sin 2 t --------------2 2 s +2 e
2t
2 sin 2t --------------------------2 (s + 2) + 4
d---- f ( t ) sF ( s ) f ( 0 ) dt
e.
2! -----------------3 (s + 2)
d ---- f ( t ) sF ( s ) f ( 0 ) dt
7.
2! 2s d 2 2t ( t e ) s ------------------ 0 = -----------------3 3 dt (s + 2) (s + 2)
a.
sin t 1 sin t sin t ------------- but to find L -------- we must first show that the limit lim -------- exists. Since 2 t0 t s +1 t sin t sin x lim ---------- = 1 , this condition is satisfied and thus -------- t x0 x --------------- x 2 + a 2 dx 1
b.
1 sin t From (a) above, -------- tan ( 1 s ) and since
0 ---------- d -- tan s
sin
(1 s)
c.
sin t 1 1 s - From (a) above -------- tan ( 1 s ) and since f ( at ) -- F - , it follows that t a a
236
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
d.
s cos t cos t ------------- , --------- 2 t s +1 ------------s s2 + 1 ds , and from tables of integrals,
---------------- dx 2 2 x +a
1 2 2 = -- ln ( x + a ) + C . Then, 2
-------------- ds 2 s +1
obtain
t
e.
1 - et e ---------- , ----- s+1 t
t
----------- ds s+1
theorem. Thus,
t
s0
and using
t
8.
f ST ( t )
A
e 1 ------ d -- ln ( s + 1 ) s
A --- t a
2a
3a
This is a periodic waveform with period T = a , and its Laplace transform is Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
237
0 te
st
dt (1)
0 te
st
e te dt = --------- ------2 s s
st
st
e te = --------- + ------2 s s
st
st
1 1 as as = --- [ ( 1 + as ) ( 1 + as )e as ] = --- [ ( 1 + as ) ( 1 e ) as ] 2 2 s s
f ( t )e
st
1 dt = --------------------- s (1 e )
0 sin te
st
dt
Then,
ax
238
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 3
The Inverse Laplace Transformation
T
ples.
his chapter is a continuation to the Laplace transformation topic of the previous chapter and presents several methods of finding the Inverse Laplace Transformation. The partial fraction expansion method is explained thoroughly and it is illustrated with several exam-
1{ F ( s ) } = f ( t ) = ------2j
+ j
F ( s ) e ds
st
(3.1)
This integral is difficult to evaluate because it requires contour integration using complex variables theory. Fortunately, for most engineering problems we can refer to Tables of Properties, and Common Laplace transform pairs to lookup the Inverse Laplace transform.
(3.2)
(3.3)
The coefficients a k and b k are real numbers for k = 1, 2, , n , and if the highest power m of
N ( s ) is less than the highest power n of D ( s ) , i.e., m < n , F ( s ) is said to be expressed as a proper rational function. If m n , F ( s ) is an improper rational function.
In a proper rational function, the roots of N ( s ) in (3.3) are found by setting N ( s ) = 0 ; these are called the zeros of F ( s ) . The roots of D ( s ) , found by setting D ( s ) = 0 , are called the poles of F ( s ) . We assume that F ( s ) in (3.3) is a proper rational function. Then, it is customary and very conveSignals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
31
(3.4)
The zeros and poles of (3.4) can be real and distinct, repeated, complex conjugates, or combinations of real and complex conjugates. However, we are mostly interested in the nature of the poles, so we will consider each case separately, as indicated in Subsections 3.2.1 through 3.2.3 below.
(3.5)
where p k is distinct from all other poles. Next, using the partial fraction expansion method,*we can express (3.5) as
rn r2 r3 r1 F ( s ) = ----------------- + ----------------- + ----------------- + + ----------------( s p1 ) ( s p2 ) ( s p 3 ) ( s pn )
(3.6)
where r 1, r 2, r 3, , r n are the residues, and p 1, p 2, p 3, , p n are the poles of F ( s ) . To evaluate the residue r k , we multiply both sides of (3.6) by ( s p k ) ; then, we let s p k , that is,
r k = lim ( s p k )F ( s ) = ( s p k )F ( s )
s pk s = pk
(3.7)
Example 3.1 Use the partial fraction expansion method to simplify F 1 ( s ) of (3.8) below, and find the time domain function f 1 ( t ) corresponding to F 1 ( s ) .
* The partial fraction expansion method applies only to proper rational functions. It is used extensively in integration, and in finding the inverses of the Laplace transform, the Fourier transform, and the z-transform. This method allows us to decompose a rational polynomial into smaller rational polynomials with simpler denominators from which we can easily recognize their integrals and inverse transformations. This method is also being taught in intermediate algebra and introductory calculus courses.
32
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(3.8)
(3.9)
(3.10)
and
3s + 2 r 2 = lim ( s + 2 )F ( s ) = --------------(s + 1) s 2 = 4
s = 2
(3.11)
(3.12)
1 u 0 ( t ) ---------s+a
(3.13) (3.14)
Therefore,
t 2t 1 4 F 1 ( s ) = --------------- + --------------- ( e + 4e ) u 0 ( t ) = f 1 ( t ) (s + 1) (s + 2)
The residues and poles of a rational function of polynomials such as (3.8), can be found easily using the MATLAB residue(a,b) function. For this example, we use the script
Ns = [3, 2]; Ds = [1, 3, 2]; [r, p, k] = residue(Ns, Ds)
and MATLAB returns the values r = 4 -1 p = -2 -1 k = [] Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
33
When this script is executed, MATLAB displays the expression 4 exp(-2 t)- exp(-t) Example 3.2 Use the partial fraction expansion method to simplify F 2 ( s ) of (3.15) below, and find the time domain function f 2 ( t ) corresponding to F 2 ( s ) .
3s + 2s + 5 F 2 ( s ) = -----------------------------------------------2 3 s + 12s + 44s + 48
2
(3.15)
Solution: First, we use the MATLAB factor(s) symbolic function to express the denominator polynomial of F 2 ( s ) in factored form. For this example,
syms s; factor(s^3 + 12*s^2 + 44*s + 48)
(3.16)
34
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
s = 2
9 = -8
(3.17)
s = 4
37 = ----4 89 = ----8
(3.18)
3s + 2s + 5 r 3 = -------------------------------(s + 2)(s + 4)
(3.19)
s = 6
(3.20)
1 u 0 ( t ) ---------s+a
(3.21)
Therefore,
9 2t 4t 89 6t 9 8 - 37 4 89 8F 2 ( s ) = --------------- + --------------- + --------------- -- e 37 e + ----- e u 0 ( t ) = f 2 ( t ) ----8 8 4 (s + 2) (s + 4) (s + 6)
(3.22)
ft = -37/4*exp(-4*t)+9/8*exp(-2*t)+89/8*exp(-6*t)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
35
(3.23)
Solution: Let us first express the denominator in factored form to identify the poles of F 3 ( s ) using the MATLAB factor(s) symbolic function. Then,
syms s; factor(s^3 + 5*s^2 + 12*s + 8)
ans = (s+1)*(s^2+4*s+8) The factor(s) function did not factor the quadratic term. We will use the roots(p) function.
p=[1 4 8]; roots_p=roots(p)
or
r 2 r1 r2 s+3 F 3 ( s ) = ------------------------------------------ = --------------- + --------------------------- + -----------------------2 3 ( s + 1 ) ( s + 2 + j2 ) ( s + 2 j 2 ) s + 5s + 12s + 8
(3.24)
= 2 -5
(3.25)
s = 2 j2
1 j2 1 j2 = ------------------------------------ = ----------------- 8 + j4 ( 1 j2 ) ( j4 )
(3.26)
(3.27)
36
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(3.28)
The last two terms on the right side of (3.28), do not resemble any Laplace transform pair that we derived in Chapter 2. Therefore, we will express them in a different form. We combine them into a single term*, and now (3.28) is written as
25 1 ( 2s + 1 ) - F 3 ( s ) = --------------- -- -----------------------------( s + 1 ) 5 ( s 2 + 4s + 8 ) F 32 ( s ) . Then, 2 t 25F 31 ( s ) = --------------- -- e = f 31 ( t ) 5 (s + 1)
(3.29)
For convenience, we denote the first term on the right side of (3.29) as F 31 ( s ) , and the second as (3.30)
Next, for F 32 ( s )
( 2s + 1 ) F 32 ( s ) = 1 ------------------------------2 5 ( s + 4s + 8 )
(3.31)
at
(3.32)
Accordingly, we express F 32 ( s ) as
1 3 3 - - s + -- + -- -- 2 2 2 s+2 2 -------------------------------- 3 2 - = 2 -------------------------------- + -------------------------------- -F 32 ( s ) = -2 2 2 2 5 (s + 2 ) + 2 ) 5 ( s + 2 ) + 2 ) ( s + 2 )2 + 22 ) 2 6 10 s+2 2 = -- -------------------------------- + ------------ -------------------------------- 2 ( s + 2 )2 + 22 ) 5 ( s + 2 )2 + 22 ) 32 s+2 2 = -- -------------------------------- + ----- -------------------------------- 2 2 10 ( s + 2 ) 2 + 2 2 ) 5 (s + 2 ) + 2 )
(3.33)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
37
ft = 2/5*exp(-t)-2/5*exp(-2*t)*cos(2*t) +3/10*exp(-2*t)*sin(2*t)
(3.34)
Denoting the m residues corresponding to multiple pole p 1 as r 11, r 12, r 13, , r 1m , the partial fraction expansion of (3.34) is expressed as
r 11 r 12 r 13 r 1m F ( s ) = --------------------- + --------------------------- + --------------------------- + + ----------------m m1 m2 ( s p1 ) ( s p1 ) ( s p1 ) ( s p1 ) rn r2 r3 + ----------------- + ----------------- + + ----------------( s p2 ) ( s p3 ) ( s pn )
(3.35)
For the simple poles p 1, p 2, , p n , we proceed as before, that is, we find the residues from
r k = lim ( s p k )F ( s ) = ( s p k )F ( s )
s pk s = pk
(3.36)
The residues r 11, r 12, r 13, , r 1m corresponding to the repeated poles, are found by multiplication of both sides of (3.35) by ( s p ) . Then,
m
( s p 1 ) F ( s ) = r 11 + ( s p 1 )r 12 + ( s p 1 ) r 13 + + ( s p 1 )
m1
r 1m
(3.37)
38
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
lim ( s p 1 ) F ( s ) = r 11 + lim [ ( s p 1 )r 12 + ( s p 1 ) r 13 + + ( s p 1 )
s p1
m1
r 1m ]
+ lim
s p1
or
r 11 = lim ( s p 1 ) F ( s )
s p1
(3.38)
and thus (3.38) yields the residue of the first repeated pole. The residue r 12 for the second repeated pole p 1 , is found by differentiating (3.37) with respect to
s and again, we let s p 1 , that is,
m d r 12 = lim ---- [ ( s p 1 ) F ( s ) ] s p 1 ds
(3.39)
(3.40)
(3.41)
or
d m 1 r 1k = lim ------------------ ------------- [ ( s p 1 ) F ( s ) ] k1 s p 1 ( k 1 )! ds
k1
(3.42)
Example 3.4 Use the partial fraction expansion method to simplify F 4 ( s ) of (3.43) below, and find the time domain function f 4 ( t ) corresponding to F 4 ( s ) .
s+3 F 4 ( s ) = ----------------------------------2 (s + 2)(s + 1)
(3.43)
Solution:
We observe that there is a pole of multiplicity 2 at s = 1 , and thus in partial fraction expansion form, F 4 ( s ) is written as Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
39
(3.44)
= 2
s = 1
s = 1
) = (s + 2) (s + 3-------------------------------------2 (s + 2)
= 1
s = 1
The value of the residue r 22 can also be found without differentiation as follows: Substitution of the already known values of r 1 and r 21 into (3.44), and letting s = 0 *, we obtain
s+3 ----------------------------------2 (s + 1) (s + 2) 1 = --------------(s + 2) 2 + -----------------2 s = 0 (s + 1) r 22 + --------------(s + 1)
s=0
s=0
s=0
3 = 1+2+r --22 2 2
(3.45)
ft = exp(-2*t)+2*t*exp(-t)-exp(-t) We can use the following script to check the partial fraction expansion.
syms s Ns = [1 3]; expand((s + 1)^2); d1 = [1 2 1]; d2 = [0 1 2]; Ds=conv(d1,d2); [r,p,k]=residue(Ns,Ds)
* This is permissible since (3.44) is an identity.
% Coefficients of the numerator N(s) of F(s) % Expands (s + 1)^2 to s^2 + 2*s + 1; % Coefficients of (s + 1)^2 = s^2 + 2*s + 1 term in D(s) % Coefficients of (s + 2) term in D(s) % Multiplies polynomials d1 and d2 to express the % denominator D(s) of F(s) as a polynomial
310
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(3.46)
Solution:
We observe that there is a pole of multiplicity 3 at s = 1 , and a pole of multiplicity 2 at s = 2 . Then, in partial fraction expansion form, F 5 ( s ) is written as
r 21 r 11 r 12 r 13 r 22 F 5 ( s ) = ------------------ + ------------------ + --------------- + ------------------ + --------------3 2 ( s + 1 ) ( s + 2 )2 ( s + 2 ) (s + 1) (s + 1)
(3.47)
= 1
s = 1
s = 1 2
( s + 2 ) ( 2s + 3 ) 2 ( s + 2 ) ( s + 3 s + 1 ) = --------------------------------------------------------------------------------------------4 (s + 2)
s = 1
s+4 = -----------------3 (s + 2)
=3
s = 1
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
311
s = 1
s = 1
s = 1
s = 1
1 s + 2 3s 12 = -- ---------------------------------- 4 2 (s + 2)
s = 1
= 1
s = 2 2 2
and
2 d- s + 3 s + 1 r 22 = ---- ------------------------- ds ( s + 1 ) 3
s = 2 2
) = ( s + 1 ) ( 2s + 3 ) 3 ( s + 1 ) ( s + 3 s + 1 -------------------------------------------------------------------------------------------------6 (s + 1) s 4s = -------------------4 (s + 1)
2
s = 2
( s + 1 ) ( 2s + 3 ) 3 ( s + 3 s + 1 ) = ---------------------------------------------------------------------------4 (s + 1)
=4
s = 2
s = 2
(3.48)
We will check the values of these residues with the MATLAB script below.
syms s; % The function collect(s) below multiplies (s+1)^3 by (s+2)^2 % and we use it to express the denominator D(s) as a polynomial so that we can % use the coefficients of the resulting polynomial with the residue function Ds=collect(((s+1)^3)*((s+2)^2))
Ds = s^5+7*s^4+19*s^3+25*s^2+16*s+4
Ns=[1 3 1]; Ds=[1 7 19 25 16 4]; [r,p,k]=residue(Ns,Ds)
312
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1 ---------s+a
te
at
1 ----------------2 (s + a)
n 1 at
( n 1 )! -----------------n (s + a)
(3.49)
ft = -1/2*t^2*exp(-t)+3*t*exp(-t)-4*exp(-t) +t*exp(-2*t)+4*exp(-2*t)
N(s) + ----------D(s)
(3.50)
where N ( s ) D ( s ) is a proper rational function. Example 3.6 Derive the Inverse Laplace transform f 6 ( t ) of
s + 2s + 2 F 6 ( s ) = ------------------------s+1
2
(3.51)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
313
where ' ( t ) is the doublet of the delta function. Also, by the time differentiation property
2 2 2 1 u 0'' ( t ) = ' ( t ) s F ( s ) sf ( 0 ) f ' (0 ) = s F ( s ) = s -- = s s
s ' ( t )
t 1 s + 2s + 2 F 6 ( s ) = ------------------------- = ---------- + 1 + s e + ( t ) + ' ( t ) = f 6 ( t ) s+1 s+1
(3.52) (3.53)
In general,
d ------- ( t ) s n n dt
n
(3.54)
r = 1 p = -1
314
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(3.55)
Let s + s + be a quadratic factor of D ( s ) , and suppose that ( s + s + ) is the highest power of this factor that divides D ( s ) . Now, we perform the following steps: 1. To this factor, we assign the sum of n partial fractions, that is,
r1 s + k1 rn s + kn r2 s + k2 -------------------------- + --------------------------------- + + --------------------------------2 2 n 2 s + s + ( s 2 + s + ) ( s + s + )
2. We repeat step 1 for each of the distinct linear and quadratic factors of D ( s ) 3. We set the given F ( s ) equal to the sum of these partial fractions 4. We clear the resulting expression of fractions and arrange the terms in decreasing powers of s 5. We equate the coefficients of corresponding powers of s 6. We solve the resulting equations for the residues Example 3.7 Express F 7 ( s ) of (3.56) below as a sum of partial fractions using the method of clearing the fractions.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
315
(3.56)
Solution:
(3.57)
(3.58)
2s + 4 = ( r 1 + r 22 )s + ( 2r 1 + A r 22 + r 21 )s + ( r 1 2A + r 22 ) s + ( A r 22 + r 21 )
(3.59)
Relation (3.59) will be an identity is s if each power of s is the same on both sides of this relation. Therefore, we equate like powers of s and we obtain
0 = r 1 + r 22 0 = 2r 1 + A r 22 + r 21 2 = r 1 2A + r 22 4 = A r 22 + r 21
(3.60)
or
r1 = 2
(3.61)
or
r 22 = 2
(3.62)
Next, substitution of (3.61) and (3.62) into the third equation of (3.60) yields
2 = 2 2A 2
or
A = 1
(3.63)
Finally by substitution of (3.61), (3.62), and (3.63) into the fourth equation of (3.60), we obtain
316
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or
r 21 = 1
(3.64)
(3.65)
Example 3.8 Use partial fraction expansion to simplify F 8 ( s ) of (3.66) below, and find the time domain function f 8 ( t ) corresponding to F 8 ( s ) .
s+3 F 8 ( s ) = -----------------------------------------2 3 s + 5s + 12s + 8
(3.66)
Solution: This is the same transform as in Example 3.3, Page 36, where we found that the denominator D ( s ) can be expressed in factored form of a linear term and a quadratic. Thus, we write F 8 ( s ) as
s+3 F 8 ( s ) = ----------------------------------------------2 ( s + 1 ) ( s + 4s + 8 )
(3.67)
(3.68)
As in Example 3.3,
(3.69)
s = 1
Next, to compute r 2 and r 3 , we follow the procedure of this section and we obtain
( s + 3 ) = r 1 ( s + 4s + 8 ) + ( r 2 s + r 3 ) ( s + 1 )
2
(3.70)
Since r 1 is already known, we only need two equations in r 2 and r 3 . Equating the coefficient of s 2 on the left side, which is zero, with the coefficients of s 2 on the right side of (3.70), we obtain
0 = r1 + r2
(3.71)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
317
(3.72)
as before.
The remaining steps are the same as in Example 3.3, and thus f 8 ( t ) is the same as f 3 ( t ) , that is,
2 t 2 2t 3 2t f 8 ( t ) = f 3 ( t ) = -- e -- e cos 2t + ----- e sin 2t u 0 ( t ) 5 5 10
318
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1{ F ( s ) } = f ( t ) = ------2j
F ( s ) e ds
st
is difficult to evaluate because it requires contour integration using complex variables theory.
For most engineering problems we can refer to Tables of Properties, and Common Laplace
The partial fraction expansion method offers a convenient means of expressing Laplace transforms in a recognizable form from which we can obtain the equivalent timedomain functions. If the highest power m of the numerator N ( s ) is less than the highest power n of the denominator D ( s ) , i.e., m < n , F ( s ) is said to be expressed as a proper rational function. If m n , F ( s )
The Laplace transform F ( s ) must be expressed as a proper rational function before applying the partial fraction expansion. If F ( s ) is an improper rational function, that is, if m n , we must first divide the numerator N ( s ) by the denominator D ( s ) to obtain an expression of the form F ( s ) = k0 + k1 s + k2 s + + km n s
2 mn
+ N(s) ----------D(s)
In a proper rational function, the roots of numerator N ( s ) are called the zeros of F ( s ) and the roots of the denominator D ( s ) are called the poles of F ( s ) . The partial fraction expansion method can be applied whether the poles of F ( s ) are distinct,
When F ( s ) is expressed as rn r1 r2 r3 F ( s ) = ----------------- + ----------------- + ----------------- + + ----------------( s p1 ) ( s p2 ) ( s p3 ) ( s pn ) r 1, r 2, r 3, , r n are called the residues and p 1, p 2, p 3, , p n are the poles of F ( s ) . The residues and poles of a rational function of polynomials can be found easily using the MATLAB residue(a,b) function. The direct term is always empty (has no value) whenever F ( s ) is a proper rational function. We can use the MATLAB factor(s) symbolic function to convert the denominator polynomial form of F 2 ( s ) into a factored form.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
319
and in general,
s ' ( t ) d ------- ( t ) s n n dt
n
The method of clearing the fractions is an alternate method of partial fraction expansion.
320
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
s + 4s + 85
4s + 5 b. --------------------------------2
s + 5s + 18.5
s + 3s + 2 c. ----------------------------------------------3 2 s + 5s + 10.5s + 9
s 16 d. ---------------------------------------------3 2 s + 8s + 24s + 32
s+1 e. ------------------------------------------3 2
s + 6s + 11s + 6
3s + 2a. ---------------2 s + 25
5s + 3b. -------------------2 (s + 4)
2
2s + 3 c. --------------------------------2
s + 4.25s + 1
s + 8s + 24s + 32 d. ---------------------------------------------2 s + 6s + 8
e. e
3 --------------------3 ( 2s + 3 )
4. Use the Initial Value Theorem to find f ( 0 ) given that the Laplace transform of f ( t ) is
2s + 3 -------------------------------2 s + 4.25s + 1
Compare your answer with that of Exercise 3(c). 5. It is known that the Laplace transform F ( s ) has two distinct poles, one at s = 0 , the other at s = 1 . It also has a single zero at s = 1 , and we know that lim f ( t ) = 10 . Find F ( s ) and
t
f(t) .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
321
2 3 3t = -- t e 3
d.
e.
1 2 3t 6 4 3t 1 2 3t 1 4 3t ---- t e ---- t e = -- t e -- t e 2 2! 4! 2
2. a.
29 (s + 2) 2 3 (s + 2) 1 3s + 4 - ---------------------------- = 3 ( s + 4 3 + 2 3 2 3 ) = 3 ------------------------------- = 3 ----------------------------- -- -------------------------------------------------------------------------------------2 2 2 2 9 2 2 2 2 (s + 2) + 9 (s + 2) + 9 (s + 2) + 9 ( s + 2 ) + 81 s + 4s + 85 9 2 2t (s + 2) - 2 2t = 3 ----------------------------- -- ------------------------------ 3e cos 9t -- e sin 9t 2 2 9 2 2 9 (s + 2) + 9 (s + 2) + 9
b.
s+54 4s + 5 4s + 5 4s + 5 -------------------------------- = ---------------------------------------------------- = --------------------------------------- = 4 --------------------------------------2 2 2 2 2 2 ( s + 2.5 ) + 3.5 s + 5s + 18.5 s + 5s + 6.25 + 12.25 ( s + 2.5 ) + 3.5 s + 2.5 5 3.5 s + 10 4 10 4 + 5 4 - 1= 4 -------------------------------------------------------- = 4 -------------------------------------- ------ --------------------------------------2 2 2 2 3.5 2 2 ( s + 2.5 ) + 3.5 ( s + 2.5 ) + 3.5 ( s + 2.5 ) + 3.5 3.5 ( s + 2.5 ) 10 2.5t 10 2.5t = 4 --------------------------------------- ----- --------------------------------------- 4e cos 3.5t ----- e sin 3.5t 2 2 2 2 7 7 ( s + 2.5 ) + 3.5 ( s + 2.5 ) + 3.5
322
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
d.
s 16 ( s + 4 )( s 4) (s 4) s+224 --------------------------------------------- = ----------------------------------------------- = ----------------------------- = ----------------------------3 2 2 2 2 2 2 s + 8s + 24s + 32 ( s + 4 ) ( s + 4s + 8 ) (s + 2) + 2 (s + 2) + 2 1 62 s+2 = ------------------------------ -- -----------------------------2 2 2 2 2 (s + 2) + 2 (s + 2) + 2 2 2t 2t s+2 = ------------------------------ 3 ----------------------------- e cos 2t 3e sin 2t 2 2 2 2 (s + 2) + 2 (s + 2) + 2
2
e.
1 s+1 (s + 1) ------------------------------------------ = ------------------------------------------------- = -------------------------------3 2 (s + 2)(s + 3) ( s + 1 )( s + 2 )( s + 3) s + 6s + 11s + 6 r2 r1 1 = -------------------------------- = ---------- + ---------s+3 (s + 2)(s + 3) s + 2 1 r 1 = ---------s+3 =1
s = 2
1 r 2 = ---------s+2
= 1
s = 3
3.
s - 2 5 2 3s + 23s - 1 2 5a. ---------------- = --------------- + -- --------------- = 3 --------------- + -- --------------- 3 cos 5t + -- sin 5t 2 2 2 2 2 2 2 2 2 s + 25 s +5 5 s +5 s +5 5 s +5 5
2 2 1 1 5s 3 5s + 3 -------------------- = ----------------------- + ----------------------- 5 ----------- ( sin 2t + 2t cos 2t ) + 3 ----------- ( sin 2t 2t cos 2t ) 2 2 2 28 22 2 2 2 2 2 (s + 4) (s + 2 ) (s + 2 ) b. 23 17 5 + ----- sin 2t + 5 ----- 2t cos 2t = ----- sin 2t + ----- t cos 2t -- 3-- 3 4 16 4 16 8 16
c.
4 5 = --------------- = -3 15 4
2s + 3 r 2 = -------------s+4
s = 1 4
2 52 = ------------ = -- 15 4 3
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
323
d.
e.
e
2s
3 --------------------3 ( 2s + 3 )
2s
F ( s ) f ( t 2 )u 0 ( t 2 )
The value f ( 0 ) = 2 is the same as in the time domain expression that we found in Exercise 3(c).
A(s 1) 5. We are given that F ( s ) = -------------------- and lim f ( t ) = lim sF ( s ) = 10 . Then, s(s + 1)
t s0
s0
r2 t 20 10 ( s 1 - r 1 ) - ----F ( s ) = ------------------------ = --- + ---------- = 10 ---------- ( 10 20e )u 0 ( t ) s s+1 s s+1 s(s + 1) f ( t ) = ( 10 20e )u 0 ( t )
t t
lim f ( t ) = 10
324
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 4
Circuit Analysis with Laplace Transforms
his chapter presents applications of the Laplace transform. Several examples are presented to illustrate how the Laplace transformation is applied to circuit analysis. Complex impedance, complex admittance, and transfer functions are also defined.
+
vR ( t ) R iR ( t )
v R ( t ) = Ri R ( t ) vR ( t ) i R ( t ) = -----------R
+
VR ( s )
R
V R ( s ) = RI R ( s ) IR ( s ) VR ( s ) I R ( s ) = -------------R
Figure 4.1. Resistive network in time domain and complex frequency domain
+
vL ( t )
L
+
di L i L ( t ) v L ( t ) = L ------dt 1 i L ( t ) = -v dt L L VL ( s ) sL
IL ( s )
+ L iL ( 0 )
Figure 4.2. Inductive network in time domain and complex frequency domain
41
+
vC ( t ) C
iC ( t )
+
dv C i C ( t ) = C -------dt 1 v C ( t ) = --C VC ( s )
1 ----sC
IC ( s )
iC dt
+ vC ( 0 )
--------------s
Figure 4.3. Capacitive circuit in time domain and complex frequency domain
Note: In the complex frequency domain, the terms sL and 1 sC are referred to as complex inductive impedance, and complex capacitive impedance respectively. Likewise, the terms and sC and 1 sL are called complex capacitive admittance and complex inductive admittance respectively.
Example 4.1 Use the Laplace transform method and apply Kirchoffs Current Law (KCL) to find the voltage
v C ( t ) across the capacitor for the circuit of Figure 4.4, given that v C ( 0 ) = 6 V .
R
vS
12u 0 ( t ) V
v (t) C C 1F
vS
C 1F 12u 0 ( t ) V
iC vC ( t )
Then,
iR + iC = 0
or
4 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(4.1)
= 6
s = 1
Therefore,
t t 6 12 V C ( s ) = ----- ---------- 12 6e = ( 12 6e )u 0 ( t ) = v C ( t ) s s+1
Example 4.2 Use the Laplace transform method and apply Kirchoffs Voltage Law (KVL) to find the voltage
v C ( t ) across the capacitor for the circuit of Figure 4.6, given that v C ( 0 ) = 6 V .
R
vS
1
C 1F
12u 0 ( t ) V
v (t) C
Solution: This is the same circuit as in Example 4.1. We apply KVL for the loop shown in Figure 4.7.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
43
vS 12u 0 ( t ) V
1 iC ( t )
C 1F
vC ( t )
Figure 4.7. Application of KVL for the circuit of Example 4.2 1 Ri C ( t ) + --C
i C ( t ) d t
= 12u 0 ( t )
i C ( t ) d t
= 12u 0 ( t )
(4.2)
or
t 6 I C ( s ) = ---------- i C ( t ) = 6e u 0 ( t ) s+1
Then,
dv C dv C t t i C ( t ) = C -------- = -------- = d ( 12 6e )u 0 ( t ) = 6e u 0 ( t ) + 6 ( t ) dt dt dt
(4.3)
The presence of the delta function in (4.3) is a result of the unit step that is applied at t = 0 . Example 4.3 In the circuit of Figure 4.8, switch S 1 closes at t = 0 , while at the same time, switch S 2 opens. Use the Laplace transform method to find v out ( t ) for t > 0 .
4 4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
iS ( t )
2A
2 R1
S2 L1
0.5 H i L1 ( t ) R2 1 L2 0.5 H
+
v out ( t )
S1 vC ( 0 ) = 3 V
1F
Solution: Since the circuit contains a capacitor and an inductor, we must consider two initial conditions One is given as v C ( 0 ) = 3 V . The other initial condition is obtained by observing that there is an initial current of 2 A in inductor L 1 ; this is provided by the 2 A current source just before switch S 2 opens. Therefore, our second initial condition is i L1 ( 0 ) = 2 A . For t > 0 , we transform the circuit of Figure 4.8 into its sdomain* equivalent shown in Figure 4.9. +
1 2 1/s 0.5s
1V 1 0.5s
+
V out ( s )
+
3/s Figure 4.9. Transformed circuit of Example 4.3
In Figure 4.9 the current in inductor L 1 has been replaced by a voltage source of 1 V . This is found from the relation
1 L 1 i L1 ( 0 ) = -- 2 = 1 V 2
(4.4)
The polarity of this voltage source is as shown in Figure 4.9 so that it is consistent with the direction of the current i L1 ( t ) in the circuit of Figure 4.8 just before switch S 2 opens. The initial capacitor voltage is replaced by a voltage source equal to 3 s .
* Henceforth, for convenience, we will refer the time domain as tdomain and the complex frequency domain as sdomain.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
45
(4.5)
(4.6)
We will use MATLAB to factor the denominator D ( s ) of (4.6) into a linear and a quadratic factor.
p=[1 8 10 4]; r=roots(p) % Find the roots of D(s)
y = s^2+3573/2500*s+3043737/5000000
3573/2500 % Simplify coefficient of s
ans = 1.4292
3043737/5000000 % Simplify constant term
(4.7)
(4.8) (4.9)
4 6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(4.10)
(4.11)
or
s + 0.715 0.91 1.36 V out ( s ) = ------------------ + ( 0.64 ) ------------------------------------------------------2 2 s + 6.57 ( s + 0.715 ) + ( 0.316 ) 0.64 ( s + 0.715 ) 1.36 0.58 = ------------------ + ------------------------------------------------------- ------------------------------------------------------s + 6.57 ( s + 0.715 ) 2 + ( 0.316 ) 2 ( s + 0.715 ) 2 + ( 0.316 ) 2 0.64 ( s + 0.715 ) 1.84 0.316 1.36 = ------------------ + ------------------------------------------------------- ------------------------------------------------------2 2 s + 6.57 ( s + 0.715 ) + ( 0.316 ) ( s + 0.715 ) 2 + ( 0.316 ) 2
(4.12)
+ 0.64e
0.715t
0.715t
sin 0.316t )u 0 ( t )
(4.13)
From (4.13), we observe that as t , v out ( t ) 0 . This is to be expected because v out ( t ) is the voltage across the inductor as we can see from the circuit of Figure 4.9. The MATLAB script below will plot the relation (4.13) above.
0.64s 0.12 * We perform these steps to express the term ---------------------------------------- in a form that resembles the transform pairs 2 e
at
s + 1.43s + 0.61 at s+a cos tu 0 ( t ) ------------------------------- and e sin tu 0 ( t ) ------------------------------- . The remaining steps are carried out in (4.12). 2 2 2 2 (s + a) + (s + a) +
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
47
1.5
0.5
-0.5
10
+
1 ----sC V out ( s )
VS ( s )
I(s )
Figure 4.11. Series RLC circuit in sdomain 1 For this circuit, the sum R + sL + ------ represents the total opposition to current flow. Then, sC VS ( s ) I ( s ) = -----------------------------------R + sL + 1 sC
(4.14)
(4.15)
4 8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(4.16)
where
1 Z ( s ) = R + sL + ----sC
(4.17)
We recall that s = + j . Therefore, Z ( s ) is a complex quantity, and it is referred to as the complex input impedance of an s domain RLC series circuit. In other words, Z ( s ) is the ratio of the voltage excitation V s ( s ) to the current response I ( s ) under zero state (zero initial conditions). Example 4.4 For the network of Figure 4.12, all values are in (ohms). Find Z ( s ) using: a. nodal analysis b. successive combinations of series and parallel impedances
1 1s s s
+
VS( s )
Solution: a.
We will first find I ( s ) , and we will compute Z ( s ) using (4.15). We assign the voltage V A ( s ) at node A as shown in Figure 4.13. +
VS ( s )
1 VA ( s )
I(s)
A
1s s
By nodal analysis,
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
49
and thus,
3 2 VS ( s ) s + 2s + s + 1 Z ( s ) = ------------- = -----------------------------------2 I(s) 2s + 1
(4.18)
b. The impedance Z ( s ) can also be found by successive combinations of series and parallel impedances, as it is done with series and parallel resistances. For convenience, we denote the network devices as Z 1, Z 2, Z 3 and Z 4 shown in Figure 4.14.
a Z(s) b
1
Z1
1s s
Z3 Z2 s Z4
Figure 4.14. Computation of the impedance of Example 4.4 by series parallel combinations
To find the equivalent impedance Z ( s ) , looking to the right of terminals a and b , we start on the right side of the network and we proceed to the left combining impedances as we would combine resistances where the symbol || denotes parallel combination. Then,
Z ( s ) = [ ( Z 3 + Z 4 ) || Z 2 ] + Z 1 s +1 s(s + 1 s ) s +s s + 2s + s + 1 Z ( s ) = ------------------------- + 1 = --------------------------- + 1 = ---------------- + 1 = -----------------------------------2 2 2 s+s+1s 2s + 1 2s + 1 ( 2s + 1 ) s
2 3 3 2
(4.19)
410
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
IS ( s )
1----sL
sC
(4.20)
(4.21)
where
1Y ( s ) = G + ----- + sC sL
(4.22)
We recall that s = + j . Therefore, Y ( s ) is a complex quantity, and it is referred to as the complex input admittance of an s domain GLC parallel circuit. In other words, Y ( s ) is the ratio of the current excitation I S ( s ) to the voltage response V ( s ) under zero state (zero initial conditions). Example 4.5 Compute Z ( s ) and Y ( s ) for the circuit of Figure 4.16. All values are in (ohms). Verify your answers with MATLAB.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
411
where
13s + 8 8 Z 1 = 13s + -- = ------------------s s Z 2 = 10 + 5s 16 4 ( 5s + 4 ) Z 3 = 20 + ----- = ---------------------s s
2
Then,
4 ( 5s + 4 ) 4 ( 5s + 4 ) ( 10 + 5s ) ---------------------- ( 10 + 5s ) ---------------------- 2 2 Z2 Z3 s s 13s + 8 + --------------------------------------------------- = 13s + 8 + ---------------------------------------------------Z ( s ) = Z1 + ----------------- = ------------------------------------2 4 ( 5s + 4 ) s s Z2 + Z3 5s + 10s + 4 ( 5s + 4 ) 10 + 5s + ------------------------------------------------------------------------s s ------------------- 20 ( 5s + 14s + 8 - 65s + 490s + 528s + 400s + 128 = 13s + 8 + ------------------------------------------) = -----------------------------------------------------------------------------------2 2 s 5s + 30s + 16 s ( 5s + 30s + 16 )
2 2 4 3 2
z = 13*s+8/s+(5*s+10)*(20+16/s)/(5*s+30+16/s)
412
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Transfer Functions
z10 = simplify(z)
z10 = (65*s^4+490*s^3+528*s^2+400*s+128)/s/(5*s^2+30*s+16)
pretty(z10)
4 3 2 65 s + 490 s + 528 s + 400 s + 128 ------------------------------------2 s (5 s + 30 s + 16) The complex input admittance Y ( s ) is found by taking the reciprocal of Z ( s ) , that is,
1s ( 5s + 30s + 16 ) Y ( s ) = ---------- = -----------------------------------------------------------------------------------4 3 2 Z(s ) 65s + 490s + 528s + 400s + 128
2
(4.23)
(4.24)
Similarly, the ratio of the output current I out ( s ) to the input current I in ( s ) under zero state conditions, is called the current transfer function denoted as G i ( s ) , that is,
I out ( s ) G i ( s ) --------------I in ( s )
(4.25)
The current transfer function of (4.25) is rarely used; therefore, from now on, the transfer function will have the meaning of the voltage transfer function, i.e.,
* To appreciate the usefulness of the transfer function, let us express relation (4.24) as V out ( s ) = G v ( s ) V in ( s ) . This relation indicates that if we know the transfer function of a network, we can compute its output by multiplication of the transfer function by its input. We should also remember that the transfer function concept exists only in the complex frequency domain. In the time domain this concept is known as the impulse response, and it is discussed in Chapter 6 of this text.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
413
(4.26)
Example 4.6 Derive an expression for the transfer function G ( s ) for the circuit of Figure 4.18, where R g represents the internal resistance of the applied (source) voltage V S , and R L represents the resistance of the load that consists of R L , L , and C . +
RL Rg L
v out
+
vg
C
Solution: No initial conditions are given, and even if they were, we would disregard them since the transfer function was defined as the ratio of the output voltage V out ( s ) to the input voltage V in ( s ) under zero initial conditions. The s domain circuit is shown in Figure 4.19. +
RL Rg V out ( s )
sL
+
V in ( s )
1 ----sC
The transfer function G ( s ) is readily found by application of the voltage division expression of the s domain circuit of Figure 4.19. Thus,
414
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Transfer Functions
R L + sL + 1 sC V out ( s ) = --------------------------------------------------- V in ( s ) R g + R L + sL + 1 sC
Therefore,
R L + Ls + 1 sC V out ( s ) G ( s ) = ----------------- = --------------------------------------------------V in ( s ) R g + R L + Ls + 1 sC
(4.27)
Example 4.7 Compute the transfer function G ( s ) for the circuit of Figure 4.20 in terms of the circuit constants R 1, R 2, R 3, C 1, and C 2 Then, replace the complex variable s with j , and the circuit constants with their numerical values and plot the magnitude G ( s ) = V out ( s ) V in ( s ) versus radian frequency .
R2 R1 200 K C1
40 K C2 R3 50K 25 nF
10 nF
vin
vout
Solution:
R2 R1 Vin (s)
1/sC2
R3
V1 ( s ) 1/sC1
V2 ( s ) Vout (s)
Next, we write nodal equations at nodes 1 and 2. At node 1, V 1 ( s ) V in ( s ) V 1 ( s ) V out ( s ) V 1 ( s ) V 2 ( s ) V1 ----------------------------------- + -------------- + -------------------------------------- + -------------------------------- = 0 R1 1 sC 1 R2 R3 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications (4.28)
415
(4.29)
(4.30)
To simplify the denominator of (4.31), we use the MATLAB script below with the given values of the resistors and the capacitors.
syms s; % Define symbolic variable s R1=2*10^5; R2=4*10^4; R3=5*10^4; C1=25*10^(-9); C2=10*10^(-9);... DEN=R1*((1/R1+1/R2+1/R3+s*C1)*(s*R3*C2)+1/R2); simplify(DEN)
ans = 1/200*s+188894659314785825/75557863725914323419136*s^2+5
188894659314785825/75557863725914323419136 % Simplify coefficient of s^2
ans = 2.5000e-006
1/200 % Simplify coefficient of s^2
416
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
The plot is shown in Figure 4.22. We observe that the given op amp circuit is a second order lowpass filter whose cutoff frequency ( 3 dB ) occurs at about 700 r s .
Magnitude Vout/Vin vs. Radian Frequency 0.2
0.15 |Vout/Vin|
0.1
0.05
0 0 10
10
10 Radian Frequency w
10
10
The Simulink Transfer Fcn block implements a transfer function where the input V IN ( s ) and the output V OUT ( s ) can be expressed in transfer function form as
V OUT ( s ) G ( s ) = -------------------V IN ( s )
(4.33)
Example 4.8 Let us reconsider the active lowpass filter op amp circuit of Figure 4.21, Page 4-15 where we found that the transfer function is
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
417
and for simplicity, let R 1 = R 2 = R 3 = 1 , and C 1 = C 2 = 1 F . By substitution into (4.34) we obtain V out ( s ) 1 G ( s ) = ------------------ = -----------------------(4.35) 2 V in ( s ) s + 3s + 1 Next, we let the input be the unit step function u 0 ( t ) , and as we know from Chapter 2,
u 0 ( t ) 1 s . Therefore, 1 1 1 V out ( s ) = G ( s ) V in ( s ) = -- ------------------------- = -------------------------3 2 s s 2 + 3s + 1 s + 3s + s
(4.36)
To find v out ( t ) , we perform partial fraction expansion, and for convenience, we use the MATLAB residue function as follows:
num=1; den=[1 3 1 0];[r p k]=residue(num,den)
The plot for v out ( t ) is obtained with the following MATLAB script, and it is shown in Figure 4.23.
t=0:0.01:10; ft=1+1.171.*exp(0.382.*t)0.171.*exp(2.618.*t); plot(t,ft); grid
The same plot can be obtained using the Simulink model of Figure 4.24, where in the Function Block Parameters dialog box for the Transfer Fcn block we enter 1 for the numerator, and [ 1 3 1 ] for the denominator. After the simulation command is executed, the Scope block displays the waveform of Figure 4.25.
418
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
-0.2
-0.4
-0.6
-0.8
-1
10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
419
s domain .
In the s domain the terms sL and 1 sC are called complex inductive impedance, and complex capacitive impedance respectively. Likewise, the terms and sC and 1 sL are called com-
The expression
is a complex quantity, and it is referred to as the complex input impedance of an s domain RLC series circuit.
In the s domain the current I ( s ) can be found from VS( s ) I ( s ) = ------------Z(s) 1 Y ( s ) = G + ----- + sC sL
The expression
is a complex quantity, and it is referred to as the complex input admittance of an s domain GLC parallel circuit.
In the s domain the voltage V ( s ) can be found from IS ( s ) V ( s ) = ----------Y(s) In an s domain circuit, the ratio of the output voltage V out ( s ) to the input voltage V in ( s )
under zero state conditions is referred to as the voltage transfer function and it is denoted as G ( s ) , that is,
V out ( s ) G ( s ) ----------------V in ( s )
420
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
R2 20
iL ( t )
L
1 mH
32 V
2. In the circuit below, switch S has been closed for a long time, and opens at t = 0 . Use the Laplace transform method to compute v c ( t ) for t > 0 .
R1 t = 0 S R3 30 K R4
C
6 K
72 V
R2
60 K 40 ----- F 9
+v ( t ) C
20 K R5 10 K
3. Use mesh analysis and the Laplace transform method, to compute i 1 ( t ) and i 2 ( t ) for the circuit below, given that i L (0 ) = 0 and v C (0 ) = 0 .
L1 2H R1 1 R2 3 L2 1H
v1 ( t ) = u0 ( t )
i1 ( t )
1F
i (t) 2
v 2 ( t ) = 2u 0 ( t )
4. For the s domain circuit below, a. compute the admittance Y ( s ) = I 1 ( s ) V 1 ( s ) b. compute the t domain value of i 1 ( t ) when v 1 ( t ) = u 0 ( t ) , and all initial conditions are zero.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
421
VC ( s )
1s R2 1 R4
R3 3 2
V1 ( s )
5. Derive the transfer functions for the networks (a) and (b) below.
V in ( s )
(a)
V out ( s )
V in ( s )
V 2 ( s ) = 2V C ( s )
V out ( s )
(b)
6. Derive the transfer functions for the networks (a) and (b) below.
V in ( s )
+
R
V out ( s )
V in ( s )
+
L V out ( s )
(a)
(b)
7. Derive the transfer functions for the networks (a) and (b) below. + +
C
+
V in ( s )
+
L
C
V in ( s )
V out ( s )
V out ( s )
(a)
(b)
8. Derive the transfer function for the networks (a) and (b) below.
C
R1 V in ( s ) (a) R2 V out ( s ) V in ( s ) (b) R2
R1 V out ( s )
422
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Exercises
9. Derive the transfer function for the network below. Using MATLAB, plot G ( s ) versus frequency in Hertz, on a semilog scale.
R1 = 11.3 k R2 = 22.6 k
R3 R1 V in ( s ) R2 C1 C2 R4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
423
Chapter 4 Circuit Analysis with Laplace Transforms 4.8 Solutions to EndofChapter Exercises
1. At t = 0 , the switch is closed, and the t domain circuit is as shown below where the 20 resistor is shorted out by the inductor.
S 20 1 mH 10
iL ( t )
32 V
Then,
iL ( t )
t=0
-
32 = ----- = 3.2 A 10
and thus the initial condition has been established as i L ( 0 ) = 3.2 A For all t > 0 the t domain and s domain circuits are as shown below.
20
1 mH
i L ( 0 ) = 3.2 A
10 s
20
IL ( s )
+
3 Li L ( 0 ) = 3.2 10 V
iT ( t )
72 V
v C ( t ) 10 K
i2 ( t )
Then,
424
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and
1 i 2 ( 0 ) = -- i T ( 0 ) = 1 mA 2
VR = VC ( s ) 9 10 -----------------40s 30 s
6
60 K
+
VR
10 K
VC ( s )
30 s
22.5 K
( 60 K + 30 K ) || ( 20 K + 10 K ) = 22.5 K
3 22.5 10 30 30 22.5 10 - V C ( s ) = V R = ------------------------------------------------------------ ----- = -----------------------------------------------------------6 3 6 3 s 9 10 40s + 22.5 10 9 10 40 + 22.5 10 s 3
Then,
10t 30 V C ( s ) = ------------- 30e u 0 ( t ) V = v C ( t ) s + 10
3 s
z3
1s
I1 ( s )
1s
+ z2
I2 ( s )
2s
Then, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
425
We use the MATLAB script below we obtain the values of the currents.
Z=[z1+z2 z2; z2 z2+z3]; Vs=[1/s 2/s]'; Is=Z\Vs; fprintf(' \n');... disp('Is1 = '); pretty(Is(1)); disp('Is2 = '); pretty(Is(2))
We use MATLAB to express the denominators of (1) and (2) as a product of a linear and a quadratic term.
p=[2 9 6 3]; r=roots(p); fprintf(' \n'); disp('root1 ='); disp(r(1));... disp('root2 ='); disp(r(2)); disp('root3 ='); disp(r(3)); disp('root2 + root3 ='); disp(r(2)+r(3));... disp('root2 * root3 ='); disp(r(2)*r(3))
426
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
r1 = 0.48
r2 = 0.52
r3 = -0.31
By inspection, the Inverse Laplace of first term on the right side of (4) is
0.48 ----------------------- 0.48e 3.82t (5) ( s + 3.82 )
The second term on the right side of (4) requires some manipulation. Therefore, we will use the MATLAB ilaplace(s) function to find the Inverse Laplace as shown below.
syms s t IL=ilaplace((0.52*s-0.31)/(s^2+0.68*s+0.39)); pretty(IL)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
427
0.34t
cos 0.53t
r1 = -4.49
r2 = 0.49
r3 = 0.20
By inspection, the Inverse Laplace of first term on the right side of (7) is
428
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
The second term on the right side of (7) requires some manipulation. Therefore, we will use the MATLAB ilaplace(s) function to find the Inverse Laplace as shown below.
syms s t IL=ilaplace((0.49*s+0.20)/(s^2+0.68*s+0.39)); pretty(IL)
1/2 sin(7/50 14
t)
+ 0.06e
0.34t
0.34t
cos 0.53t
4. +
1 1s
V1 ( s )
I1 ( s )
a. Mesh 1:
( 2 + 1 s ) I1 ( s ) I2 ( s ) = V1 ( s )
or
6 ( 2 + 1 s ) I 1 ( s ) 6I 2 ( s ) = 6V 1 ( s ) (1)
Mesh 2:
I 1 ( s ) + 6I 2 ( s ) = V 2 ( s ) = ( 2 s )I 1 ( s ) (2)
or
( 11 + 8 s ) I 1 ( s ) = 6V 1 ( s )
and thus
I1 ( s ) 6 6s Y ( s ) = ------------- = -------------------- = ----------------V 1 ( s ) 11 + 8 s 11s + 8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
I2 ( s )
+
V 2 ( s ) = 2V C ( s )
VC ( s )
429
5.
V in ( s )
+
1 Cs
V out ( s )
V in ( s )
Ls
V out ( s )
(a)
(b)
Network (a):
1 Cs V out ( s ) = ----------------------- V in ( s ) R + 1 Cs
and thus
V out ( s ) 1 Cs 1 Cs 1 1 RC G ( s ) = ----------------- = ----------------------- = ---------------------------------------- = ------------------- = ----------------------V in ( s ) R + 1 Cs ( RCs + 1 ) ( Cs ) RCs + 1 s + 1 RC
Network (b):
R V out ( s ) = --------------- V in ( s ) Ls + R
and thus
V out ( s ) RL R G ( s ) = ----------------- = --------------- = ------------------s+RL Ls + R V in ( s )
1 Cs (a)
+
R
V out ( s )
V in ( s )
Ls
V out ( s )
(b)
Network (a):
R V out ( s ) = ----------------------- V in ( s ) 1 Cs + R
and
V out ( s ) s RCs R G ( s ) = ----------------- = ----------------------- = ------------------------ = ----------------------s + 1 RC ( RCs + 1 ) 1 Cs + R V in ( s )
430
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and
V out ( s ) s Ls G ( s ) = ----------------- = --------------- = ------------------s+RL R + Ls V in ( s )
L s 1 Cs R (a)
+
V out ( s )
+
V in ( s )
+
Ls V out ( s )
V in ( s )
1 Cs (b)
Network (a):
R V out ( s ) = ------------------------------------ V in ( s ) Ls + 1 Cs + R
and thus
V out ( s ) R RCs ( R L )s G ( s ) = ----------------- = ------------------------------------ = --------------------------------------- = -------------------------------------------------2 2 V in ( s ) Ls + 1 Cs + R LCs + 1 + RCs s + ( R L )s + 1 LC
and
2 2 V out ( s ) LCs + 1 Ls + 1 Cs s + 1 LC G ( s ) = ----------------- = ------------------------------------ = --------------------------------------- = -------------------------------------------------2 2 R + Ls + 1 Cs V in ( s ) LCs + RCs + 1 s + ( R L )s + 1 LC
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
431
V out ( s )
Network (a):
2 out 2 Let z 1 = R 1 and z 2 = R 2 || 1 Cs = ------------------------- . For inverting op amps ----------------- = ---- , and -
R 1 Cs R 2 + 1 Cs
V (s) V in ( s )
z z1
thus
V out ( s ) [ ( R 2 1 Cs ) ( R 2 + 1 Cs ) ] ( R 2 1 Cs ) R1 C G ( s ) = ----------------- = ------------------------------------------------------------------------- = ----------------------------------------- = ------------------------V in ( s ) R1 R 1 ( R 2 + 1 Cs ) s + 1 R2 C
V (s) V in ( s )
z z1
432
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
R2
1 C1 s 1 C2 s
At Node V 1 :
V 1 ( s ) V 1 ( s ) V out ( s ) ------------- + ------------------------------------- = 0 R3 R4 11- 1 ----- + ----- V ( s ) = ----- V ( s ) (1) R R 4 out R4 1 3
At Node V 3 :
V3 ( s ) V2 ( s ) V3 ( s ) --------------------------------- + --------------- = 0 R2 1 C1 s
At Node V 2 :
V 2 ( s ) V in ( s ) V 2 ( s ) V 1 ( s ) V 2 ( s ) V out ( s ) ----------------------------------- + --------------------------------- + ------------------------------------- = 0 R1 R2 1 C2 s ) 1- 1 ----- + ----- + C s V ( s ) = V in ( s ) + V 1 ( s - + C sV ( s ) (3) --------------- ------------2 2 2 out R R2 R1 R2 1
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
433
From (2)
1 V 2 ( s ) = R 2 ----- + C 1 s V 1 ( s ) = ( 1 + R 2 C 1 s )V 1 ( s ) R 2
and thus
V out ( s ) 1 G ( s ) = ----------------- = ---------------------------------------------------------------------------------------------------------------------------------------------V in ( s ) R3 ( 1 + R2 C1 s ) 1 R3 1 1 R 1 ----- + ----- + C 2 s ------------------------------------ ----- ----------------------- C 2 s R ( R3 + R4 ) R2 ( R3 + R4 ) R2 1
434
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1.2
|Vout/Vin|
0.8
0.6
0.4 0 10
10
10 Radian Frequency w
10
10
The plot above indicates that this circuit is a secondorder lowpass filter.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
435
Chapter 5
State Variables and State Equations
his chapter is an introduction to state variables and state equations as they apply in circuit analysis. The state transition matrix is defined, and the statespace to transfer function equivalence is presented. Several examples are presented to illustrate their application.
(5.1)
A second order circuit can be described by a secondorder differential equation of the same form as (5.1) where the highest order is a second derivative. An nthorder differential equation can be resolved to n firstorder simultaneous differential equations with a set of auxiliary variables called state variables. The resulting firstorder differential equations are called statespace equations, or simply state equations. These equations can be obtained either from the nthorder differential equation, or directly from the network, provided that the state variables are chosen appropriately. The state variable method offers the advantage that it can also be used with nonlinear and timevarying devices. However, our discussion will be limited to linear, timeinvariant circuits. State equations can also be solved with numerical methods such as Taylor series and Runge Kutta methods, but these will not be discussed in this text*. The state variable method is best illustrated with several examples presented in this chapter. Example 5.1 A series RLC circuit with excitation
vS ( t ) = e
jt
(5.2)
* These are discussed in Numerical Analysis Using MATLAB and Excel, Third Edition, ISBN 978-1-934404-03-4.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
51
i dt
= e
jt
(5.3)
(5.4)
or
2 1 R di 1 d t - ------ = --- ---- ------- i + -- je 2 L L dt LC dt jt
(5.5)
and
dx 1 di x 2 = ---- = ------- = x 1 dt dt
Then,
2 2 x 2 = d i dt
where x k denotes the derivative of the state variable x k . From (5.5) through (5.8), we obtain the state equations x1 = x2 1 1 jt R x 2 = -- x 2 ------ x 1 + -- je
L LC L
(5.9)
It is convenient and customary to express the state equations in matrix* form. Thus, we write the state equations of (5.9) as
0 x1 = 1 -----x2 LC 1 x 0 1 + 1 u R x2 --- j e jt L L
(5.10)
(5.11)
where
* For a review of matrix theory, please refer to Appendix D.
5 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
x =
x1 x2
(5.12)
(5.13)
where C is another matrix, and d is a column vector. In general, the state representation of a network can be described by the pair of the of the state space equations
x = Ax + bu y = Cx + du
(5.14)
The state space equations of (5.14) can be realized with the block diagram of Figure 5.1.
u b + + x
dt
A d
+ +
Figure 5.1. Block diagram for the realization of the state equations of (5.14)
We will learn how to solve the matrix equations of (5.14) in the subsequent sections. Example 5.2 A fourthrder network is described by the differential equation
4 d y + a d y + a d y + a dy + a y ( t ) = u ( t ) --------3 -------2 ------1 ----0 3 2 4 dt dt dt dt 3 2
(5.15)
where y ( t ) is the output representing the voltage or current of the network, and u ( t ) is any input. Express (5.15) as a set of state equations. Solution: The differential equation of (5.15) is of fourthorder; therefore, we must define four state variables which will be used with the resulting four firstorder state equations. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
53
x4 = d y -------3 dt
(5.16)
We observe that
x1 = x2 x2 = x3 x3 = x4 d y --------- = x 4 = a 0 x 1 a 1 x 2 a 2 x 3 a 3 x 4 + u ( t ) 4 dt
4
(5.17)
(5.18)
(5.19)
x1 0 b= 0, 0 1
where
x1 x2 x3 x4 0 0 A= 0 a0 1 0 0 a1 0 1 0 a2 0 0 , 1 a3 x2 x3 x4
x=
x=
and u = u ( t )
We can also obtain the state equations directly from given circuits. We choose the state variables to represent inductor currents and capacitor voltages. In other words, we assign state variables to energy storing devices. The examples below illustrate the procedure. Example 5.3 Write state equation(s) for the circuit of Figure 5.2, given that v C ( 0 ) = 0 , and u 0 ( t ) is the unit step function.
5 4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
+
vS u0 ( t )
v C ( t ) = v out ( t ) C
Solution:
This circuit contains only one energystoring device, the capacitor. Therefore, we need only one state variable. We choose the state variable to denote the voltage across the capacitor as shown in Figure 5.3. The output is defined as the voltage across the capacitor.
R
+ v (t) R + C i
vS u0 ( t )
v C ( t ) = v out ( t ) = x
Figure 5.3. Circuit for Example 5.3 with state variable x assigned to it
dv C i R = i = i C = C -------- = Cx dt v R ( t ) = Ri = RCx vR ( t ) + vC ( t ) = vS u0 ( t )
or
RCx + x = v S u 0 ( t )
(5.20)
y = x
Example 5.4 Write state equation(s) for the circuit of Figure 5.4 assuming i L ( 0 ) = 0 , and the output y is defined as y = i ( t ) .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
55
i( t)
vS u0 ( t )
Solution:
This circuit contains only one energystoring device, the inductor; therefore, we need only one state variable. We choose the state variable to denote the current through the inductor as shown in Figure 5.5.
R
i(t) = x vS u0 ( t )
Figure 5.5. Circuit for Example 5.4 with assigned state variable x
By KVL,
vR + vL = vS u0 ( t )
or
di Ri + L ---- = v S u 0 ( t ) dt
or
Rx + Lx = v S u 0 ( t )
(5.21)
y = x
(5.22)
where , , k 1 , and k 2 are scalar constants, and the initial condition, if nonzero, is denoted as
x0 = x ( t0 )
(5.23)
5 6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
x0 + e
t e
0
u ( ) d
(5.24)
Proof: First, we must show that (5.24) satisfies the initial condition of (5.23). This is done by substitution of t = t0 in (5.24). Then,
x ( t0 ) = e
( t0 t0 )
x0 + e
t0
e
0
u ( ) d
(5.25)
x0 = e x0 = x0
(5.26)
The second term of (5.25) is zero since the upper and lower limits of integration are the same. Therefore, (5.25) reduces to x ( t 0 ) = x 0 and thus the initial condition is satisfied. Next, we must prove that (5.24) satisfies also the first equation in (5.22). To prove this, we differentiate (5.24) with respect to t and we obtain
d- t d- ( t t0 ) x 0 ) + ---- e x ( t ) = ---- ( e dt dt
t e
0
u ( ) d
or
( t t0 ) t x0 + e x(t) = e ( t t0 ) t
t t
e
0
u ( ) d + e [ e
u()] = t u(t)
= e
x0 + e
e
0
u ( ) d + e e
t t
or
( t t0 ) x(t)= e x0 +
t e
0
(t )
u ( ) d + u ( t )
(5.27)
We observe that the bracketed terms of (5.27) are the same as the right side of the assumed solution of (5.24). Therefore,
x = x + u
and this is the same as the first equation of (5.22). In summary, if and are scalar constants, the solution of
x = x + u
(5.28)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
57
(5.29)
t
x0 + e
t e
0
u ( ) d
(5.30)
Example 5.5 Use (5.28) through (5.30) to find the capacitor voltage v C ( t ) of the circuit of Figure 5.6 for t > 0 , given that the initial condition is v C ( 0 ) = 1 V
R
2u 0 ( t )
0.5 F
vC ( t )
Solution:
1 RC
1 2 0.5
= 2
x0 + e
t
e
0
u ( ) d = e
t t 0
1 ( t 0 )
1+e
t
0 e 2u ( ) d
t
= e + 2e
e d = e + 2e [ e ]
t
= e + 2e ( e 1 )
or
v C ( t ) = x ( t ) = ( 2 e )u 0 ( t )
(5.31)
Assuming that the output y is the capacitor voltage, the output state equation is
5 8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(5.32)
(5.33)
where for two or more simultaneous differential equations, A and C are 2 2 or higher order matrices, and b and d are column vectors with two or more rows. In this section we will introduce the state transition matrix e , and we will prove that the solution of the matrix differential equation
At
x = Ax + bu
(5.34) (5.35)
x0 + e
At
t e
0
bu ( ) d
(5.36)
Proof: Let A be any n n matrix whose elements are constants. Then, another n n matrix denoted as ( t ) , is said to be the state transition matrix of (5.34), if it is related to the matrix A as the matrix power series
(t) e
At
(5.37)
= I + A0 + = I
(5.38)
(5.39)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
59
(5.40)
To prove that (5.36) is the solution of (5.34), we must prove that it satisfies both the initial condition and the matrix differential equation. The initial condition is satisfied from the relation
x ( t0 ) = e
A ( t0 t0 )
x0 + e
At 0
t0
e
0
bu ( ) d = e
A0
x 0 + 0 = Ix 0 = x 0
(5.41)
where we have used (5.38) for the initial condition. The integral is zero since the upper and lower limits of integration are the same. To prove that (5.34) is also satisfied, we differentiate the assumed solution
x( t) = e
A ( t t0 )
x0 + e
At
t e
0
bu ( ) d
Then, or
A ( t t0 ) At x ( t ) = Ae x 0 + Ae
t e
0
bu ( ) d + e e
At A t
bu ( t )
A ( t t0 ) At x0 + e x(t) = A e
t e
0
bu ( ) d + e e
At A t
bu ( t )
(5.42)
We recognize the bracketed terms in (5.42) as x ( t ) , and the last term as bu ( t ) . Thus, the expression (5.42) reduces to
x ( t ) = Ax + bu
In summary, if A is an n n matrix whose elements are constants, n 2 , and b is a column vector with n elements, the solution of x ( t ) = Ax + bu (5.43) with initial condition x0 = x ( t0 ) (5.44) is
x(t) = e
A ( t t0 )
x0 + e
At
t e
0
bu ( ) d
(5.45)
Therefore, the solution of second or higher order circuits using the state variable method, entails the computation of the state transition matrix e , and integration of (5.45).
At
510
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Computation of the State Transition Matrix 5.4 Computation of the State Transition Matrix e
i = 1, 2, , n of A are the roots of the nth order polynomial det [ A I ] = 0
At
(5.46)
We recall that expansion of a determinant produces a polynomial. The roots of the polynomial of (5.46) can be real (unequal or equal), or complex numbers. Evaluation of the state transition matrix e is based on the CayleyHamilton theorem. This theorem states that a matrix can be expressed as an ( n 1 )th degree polynomial in terms of the matrix A as
At
At
= a0 I + a1 A + a2 A + + an 1 A
n1
(5.47)
where the coefficients a i are functions of the eigenvalues . We accept (5.47) without proving it. The proof can be found in Linear Algebra and Matrix Theory textbooks. Since the coefficients a i are functions of the eigenvalues , we must consider the two cases discussed in Subsections 5.4.1 and 5.4.2 below.
= e = e
1 t 2 t
(5.48)
= e
n t
given that
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
511
Solution: We must first find the eigenvalues of the given matrix A . These are found from the expansion of For this example,
det [ A I ] = 0
or Therefore,
= ( 2 )( 1 ) = 0 ( + 1 )( + 2) = 0 1 = 1 and 2 = 2
(5.49)
Next, we must find the coefficients a i of (5.47). Since A is a 2 2 matrix, we only need to consider the first two terms of that relation, that is,
e
At
= a0 I + a1 A
(5.50)
The coefficients a 0 and a 1 are found from (5.48). For this example,
a0 + a1 1 = e a0 + a1 2 = e
1 t 2 t
or
a0 + a1 ( 1 ) = e a0 + a1 ( 2 ) = e
2t
(5.51)
2t
(5.52)
= ( 2e e
2t
1 0 0 1
+ (e e
2t
) 2 1 0 1
512
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
= e
2t
e e e
t
2t
(5.53)
At
1. We find the eigenvalues from det [ A I ] = 0 . We can write [ A I ] at once by subtracting from each of the main diagonal elements of A . If the dimension of A is a 2 2 matrix, it will yield two eigenvalues; if it is a 3 3 matrix, it will yield three eigenvalues, and so on. If the eigenvalues are distinct, we perform steps 2 through 4; otherwise we refer to Subsection 5.4.2 below. 2. If the dimension of A is a 2 2 matrix, we use only the first 2 terms of the right side of the state transition matrix
e
At
= a0 I + a1 A + a2 A + + an 1 A
n1
(5.54)
If A matrix is a 3 3 matrix, we use the first 3 terms of (5.54), and so on. 3. We obtain the a i coefficients from
a0 + a1 1 + a2 1 + + an 1 1 a0 + a1 2 + a2 2 + + an 1 2 a0 + a1 n + a2 n + + an 1 n
2 n1 2 2 n1 n1
= e = e
1 t 2 t
= e
n t
We use as many equations as the number of the eigenvalues, and we solve for the coefficients ai . 4. We substitute the a i coefficients into the state transition matrix of (5.54), and we simplify. Example 5.7 Compute the state transition matrix e
At
given that
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
513
(5.55)
Solution: 1. We first compute the eigenvalues from det [ A I ] = 0 . We obtain [ A I ] at once, by subtracting from each of the main diagonal elements of A . Then,
det [ A I ] = det 5 0 2 7 5 = 0 4 1 8 3
(5.56)
(5.57)
lambda1 = 3.00
lambda2 = 2.00
lambda3 = 1.00
(5.58)
= a0 I + a1 A + a2 A
(5.59)
or
a0 + a1 + a2 = e a 0 + 2a 1 + 4a 2 = e a 0 + 3a 1 + 9a 2 = e
t 2t 3t
(5.60)
514
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
5 t 2t 3 3t a 1 = -- e + 4e -- e 2 2 1 t 2t 1 3t a 2 = -- e e + -- e 2 2
(5.61)
4. We also use MATLAB to perform the substitution into the state transition matrix, and to perform the matrix multiplications. The script is shown below.
syms t; a0 = 3*exp(t)+exp(3*t)3*exp(2*t); a1 = 5/2*exp(t)3/2*exp(3*t)+4*exp(2*t);... a2 = 1/2*exp(t)+1/2*exp(3*t)exp(2*t);... A = [5 7 5; 0 4 1; 2 8 -3]; eAt=a0*eye(3)+a1*A+a2*A^2 eAt = [-2*exp(t)+2*exp(2*t)+exp(3*t), -6*exp(t)+5*exp(2*t)+exp(3*t), 4*exp(t)-3*exp(2*t)-exp(3*t)] [-exp(t)+2*exp(2*t)-exp(3*t), -3*exp(t)+5*exp(2*t)-exp(3*t), 2*exp(t)-3*exp(2*t)+exp(3*t)] [-3*exp(t)+4*exp(2*t)-exp(3*t), -9*exp(t)+10*exp(2*t)-exp(3*t), 6*exp(t)-6*exp(2*t)+exp(3*t)]
Thus,
2e + 2e + e e
At t 2t 3t
6 e + 5e + e 3e + 5e e
t 2t t 2t 3t
2t
3t
4e 3e e 2e 3e + e
t t 2t 2t
2t
3t 3t 3t
e + 2e e
t 2t
2t
3t 3t
3e + 4e e
9e + 10e e
3t
6e 6e + e
(5.62)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
515
(5.63)
= a0 I + a1 A + a2 A + + an 1 A
2
n1
(5.64)
are found from the simultaneous solution of the system of equations of (5.65) below.
a0 + a1 1 + a2 1 + + an 1 1
2 n1
= e
1 t
(5.65)
a0 + a1 m + 1 + a2 m + 1 + + an 1 m + 1 = e
2
n1
m + 1t
a 0 + a 1 n + a 2 n + + a n 1 n
2 n1
= e
n t
given that
A = 1 0 2 1
Solution: 1. We first find the eigenvalues of the matrix A and these are found from the polynomial of det [ A I ] = 0 . For this example,
0 = 0 det [ A I ] = det 1 2 1 ( 1 )( 1 ) = 0 ( + 1) = 0
2
and thus,
516
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
2. Since A is a 2 2 matrix, we only need the first two terms of the state transition matrix, that is,
e
At
= a0 I + a1 A
(5.66)
d t d -------- ( a 0 + a 1 1 ) = -------- e 1 d 1 d 1
or
a0 + a1 1 = e
1 t 1 t
a 1 = te
a 1 = te
(5.67)
0 + te t 1 0 2 1 1
or
e
At
t t
0 e
t
(5.68)
2te
We can use the MATLAB eig(x) function to find the eigenvalues of an n n matrix. To find out how it is used, we invoke the help eig command.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
517
5.5 Eigenvectors
Consider the relation
AX = X
(5.69)
where A is an n n matrix, X is a column vector, and is a scalar number. We can express this relation in matrix form as
a 11 a 12 a 1n x 1 a 21 a 22 a 2n x 2 a n1 a n2 a nn x n = x1 x2 xn
(5.70)
We write (5.70) as
( A I )X = 0
(5.71)
518
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Eigenvectors
( a 11 )x 1 a 21 x 1 an 1 x1 a 12 x 2 an 2 x2 a1n xn a2n xn = 0
( a 22 )x 2
( a nn )x n
(5.72)
The equations of (5.72) will have nontrivial solutions if and only if its determinant is zero*, that is, if
( a 11 ) det a 21 an 1 a 12 an 2 a1n a2n = 0 ( a 22 )
( a nn )
(5.73)
Expansion of the determinant of (5.73) results in a polynomial equation of degree n in , and it is called the characteristic equation. We can express (5.73) in a compact form as
det ( A I ) = 0
(5.74)
As we know, the roots of the characteristic equation are the eigenvalues of the matrix A , and corresponding to each eigenvalue , there is a non-trivial solution of the column vector X , i.e., X 0 . This vector X is called eigenvector. Obviously, there is a different eigenvector for each eigenvalue. Eigenvectors are generally expressed as unit eigenvectors, that is, they are normalized to unit length. This is done by dividing each component of the eigenvector by the square root of the sum of the squares of their components, so that the sum of the squares of their components is equal to unity. In many engineering applications the unit eigenvectors are chosen such that X X = I where
T
Two vectors X and Y are said to be orthogonal if their inner (dot) product is zero. A set of eigenvectors constitutes an orthonormal basis if the set is normalized (expressed as unit eigenvectors) and these vector are mutually orthogonal. An orthonormal basis can be formed with the GramSchmidt Orthogonalization Procedure; it is beyond the scope of this chapter to discuss this procedure, and therefore it will not be discussed in this text. It can be found in Linear Algebra and Matrix Theory textbooks.
This is because we want the vector X in (5.71) to be a non-zero vector and the product ( A I )X to be zero.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
519
a. Find the eigenvalues of A b. Find eigenvectors corresponding to each eigenvalue of A c. Form a set of unit eigenvectors using the eigenvectors of part (b). Solution: a. This is the same matrix as in Example 5.7, relation (5.55), Page 514, where we found the eigenvalues to be
1 = 1 2 = 2 AX = X x1 X = x2 x3 3 = 3
Then,
5 0 2 x1 7 5 x1 4 1 x2 = x2 8 3 x3 x3 7x 2 5x 3 4x 2 x3 8x 2 3x 3 x 1 = x 2 x 3
(5.75)
or
5x 1 0 2x 1
(5.76)
520
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Eigenvectors
( 5 )x 1 0 2x 1 7x 2 ( 4 )x 2 8x 2 5x 3 x3 ( 3 )x 3 0 = 0 0
(5.77)
(5.78)
(5.79)
Since the unknowns x 1, x 2, and x 3 are scalars, we can assume that one of these, say x 2 , is known, and solve x 1 and x 3 in terms of x 2 . Then, we obtain x 1 = 2x 2 , and x 3 = 3x 2 . Therefore, an eigenvector for = 1 is
x1 X = 1 = x2 = x3 2x 2 x2 3x 2 2 2 = x2 1 = 1 3 3
(5.80)
since any eigenvector is a scalar multiple of the last vector in (5.80). Similarly, for = 2 , we obtain x 1 = x 2 , and x 3 = 2x 2 . Then, an eigenvector for = 2 is
x1 X = 2 = x2 = x3 x2 x2 2x 2 1 1 = x2 1 = 1 2 2
(5.81)
(5.82)
c. We find the unit eigenvectors by dividing the components of each vector by the square root of the sum of the squares of the components. These are:
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
521
14 6 3
(5.83)
We observe that for the first unit eigenvector the sum of the squares is unity, that is,
2134- 1- 9 --------- 2 + --------- 2 + --------- 2 = ----- + ----- + ----- = 1 14 14 14 14 14 14
(5.84)
and the same is true for the other two unit eigenvectors in (5.83).
+
vS ( t ) = u0 ( t )
i(t)
43 F
v (t) C
522
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and
di L Ri L + L ------ + v C = u 0 ( t ) dt
or
di L ------ = 4i L 4v C + 4 dt
(5.85)
(5.86)
and
dv C x 2 = -------dt
Also,
dv C i L = C -------dt
and thus,
dv C 4 x 1 = i L = C -------- = Cx 2 = -- x 2 3 dt
or
3 x 2 = -- x 1 4
(5.87)
Therefore, from (5.85), (5.86), and (5.87), we obtain the state equations
x 1 = 4x 1 4x 2 + 4 3 x 2 = -- x 1 4
(5.88)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
523
x0 + e
At
t e
0
bu ( ) d
(5.89)
where
A = 4 4 34 0 x0 = iL ( 0 ) vC ( 0 )
At
0 12
b = 4 0
(5.90)
First, we compute the state transition matrix e . We find the eigenvalues from Then,
det [ A I ] = 0
det [ A I ] = det 4 4 = 0 3 4
( ) ( 4 ) + 3 = 0
+ 4 + 3 = 0
Therefore,
1 = 1 and 2 = 3
The next step is to find the coefficients a i . Since A is a 2 2 matrix, we only need the first two terms of the state transition matrix, that is,
e
At
= a0 I + a1 A
(5.91)
a 0 3a 1 = e
(5.92)
(5.93)
524
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
= ( 1.5e 0.5e
3t
) 1 0
0 + ( 0.5e t 0.5e 2t ) 4 4 1 34 0 0 2 e + 2e + 3 t 3 3t -- e -- e 8 8
t t 3t
= 1.5e 0.5e 0
3t t
2 e + 2e 0
3t
1.5e 0.5e
3t
or
e
At
0.5 e + 1.5e = 3 t 3 3t -- e -- e 8 8
3t
2 e + 2e 1.5e 0.5e
t
3t
3t
The initial conditions vector is the second vector in (5.90); then, the first term of (5.89) becomes
0.5 e + 1.5e e x0 = 3 t 3 3t -- e -- e 8 8
At t 3t
2 e + 2e 1.5e 0.5e
t
3t
3t
0 12
or
e x0 =
At
e +e
t
3t 3t
(5.94)
0.75e 0.25e
We also need to evaluate the integral on the right side of (5.89). From (5.90)
b = 4 = 0 1 4 0
Int =
t
0
0.5 e + 1.5e 3 ( t ) 3 3 ( t ) -- e -- e 8 8
( t )
3 ( t )
2 e 1.5e
( t )
+ 2e
3 ( t )
( t )
0.5e
3 ( t )
1 4 d 0
or
Int =
t
0
0.5 e + 1.5e 3 ( t ) 3 3 ( t ) -- e -- e 8 8
( t )
3 ( t )
4 d
(5.95)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
525
Int = 4
0.5 e 0.375e
( t )
+ 0.5e
3 ( t ) 3 ( t ) =0
( t )
0.125e
or
Int = 4
t 3t
0.5 + 0.5 4 0.5 e + 0.5e 0.5e 0.5 e = 4 t 3t t 3t 0.375 0.125 0.375e 0.125e 0.25 0.375 e + 0.125e
3t
x0 + e
At
t e
0
bu ( ) d
is
x1 x2 = e +e
t t 3t 3t
+4
0.5e 0.5 e
t
3t 3t
e e
t
3t 3t
0.75e 0.25e
1 0.75 e + 0.25e
Then, (5.96)
3t
and
x 2 = v C = 1 0.75e + 0.25e
t
(5.97)
Other variables of the circuit can now be computed from (5.96) and (5.97). For example, the voltage across the inductor is
di L 1 d- t 3t 1 t 3 3t v L = L ------- = -- ---- ( e e ) = -- e + -- e dt 4 dt 4 4
526
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0.9
0.8
0.7
0.6
0.5
10
We can obtain the plot of Figure 5.8 with the Simulink StateSpace block with the unit step function as the input using the Step block, and the capacitor voltage as the output displayed on the Scope block as shown in the model of Figure 5.9 where for the StateSpace block Function Block Parameters dialog box we have entered: A: [4 4; 3/4 0] B: [4 0] C: [0 1] D: [ 0 ] Initial conditions: [0 1/2]
The waveform for the capacitor voltage for the simulation time interval 0 t 10 seconds is shown in Figure 5.10 where we observe that the initial condition v C ( 0 ) = 0.5 V is also displayed.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
527
Figure 5.10. Input and output waveforms for the model of Figure 5.9
where
A = 1 0 1 1 x0 = 1 0 b = 1 1
Then,
1 = 1 and 2 = 1
Since A is a 2 2 matrix, we only need the first two terms of the state transition matrix to find the coefficients a i , that is,
e
At
= a0 I + a1 A
(5.100)
528
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(5.101)
(5.102)
(5.103)
x0 + e
At
e
0
bu ( ) d = e x 0 + e
At
At
0 e
b ( ) d
(5.104)
Using the sifting property of the delta function we find that (5.104) reduces to
At At At At At x ( t ) = e x0 + e b = e ( x0 + b ) = e 1 + 1 = e 0 1 1 0 = cosh t + sinh t 0 sinh t cosh t sinh t 0 = x1 x2 1
Therefore,
x = x1 x2 = 0 0 = t cosh t sinh t e
(5.105)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
529
Chapter 5 State Variables and State Equations 5.7 Relationship between State Equations and Laplace Transform
In this section, we will show that the state transition matrix can be computed from the Inverse Laplace transform. We will also show that the transfer function can be found from the coefficient matrices of the state equations. Consider the state equation
x = Ax + bu
(5.106)
(5.107)
(5.108)
0 e
bu ( ) d
(5.109)
we observe that the right side of (5.108) is the Laplace transform of (5.109). Therefore, we can compute the state transition matrix e the relation
e
At At
= L
{ ( sI A ) }
(5.110)
(5.111)
Taking the Laplace of both sides of (5.111), we obtain and using (5.108), we obtain
Y ( s ) = CX ( s ) + dU ( s )
1 1
(5.112) (5.113)
Y ( s ) = C ( sI A ) x ( 0 ) + [ C ( sI A ) b + d ]U ( s )
(5.114)
530
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(5.115)
Example 5.12 In the circuit of Figure 5.11, all initial conditions are zero. Compute the state transition matrix
e
At
+
vS ( t ) = u0 ( t )
i(t)
12 F
vC ( t )
and
di L Ri L + L ------ + v C = u 0 ( t ) dt
(5.116)
and
x2 = vC
Then,
di L x 1 = ------ = 3 i L v C + 1 dt
(5.117)
and
dv C x 2 = -------dt
Also, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
531
(5.118)
and thus,
dv C x 1 = i L = 0.5 -------- = 0.5x 2 dt
or
x 2 = 2x 1
(5.119)
(5.120)
(5.121)
By inspection,
A = 3 1 2 0
(5.122)
where
( sI A ) =
= L s 0
{ ( sI A ) } 1 s
(5.123)
0 3 1 = s + 3 s 2 0 2
Then,
1 adj ( sI A ) = --------------------------- = ------------------------- s 2 det ( sI A ) s + 3s + 2 2 s -------------------------------1 = ( s + 1 ) ( s + 2 ) 2 s+3 -------------------------------( s + 1 )( s + 2) 1 -------------------------------( s + 1 )( s + 2) s+3 -------------------------------(s + 1)(s + 2)
( sI A )
We find the Inverse Laplace of each term by partial fraction expansion. Thus,
e
At
= L
1 { ( sI A ) } = e + 2e t 2t 2e 2e
2t
e +e 2e e
t
2t 2t
Now, we can find the state variables representing the inductor current and the capacitor voltage from
532
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0 e
bu ( ) d
using the procedure of Example 5.11. MATLAB provides two very useful functions to convert statespace (state equations), to transfer function (sdomain), and vice versa. The function ss2tf (statespace to transfer function) converts the state space equations
x = Ax + Bu * y = Cx + Du
(5.124)
(5.125)
This is used with the statement [num,den]=ss2tf(A,B,C,D,iu) where A, B, C, D are the matrices of (5.124) and iu is 1 if there is only one input. The MATLAB help command provides the following information:
help ss2tf SS2TF State-space to transfer function conversion. [NUM,DEN] = SS2TF(A,B,C,D,iu) calculates the transfer function: NUM(s) -1 G(s) = -------- = C(sI-A) B + D DEN(s) of the system: x = Ax + Bu y = Cx + Du from the iu'th input. Vector DEN contains the coefficients of the denominator in descending powers of s. The numerator coefficients are returned in matrix NUM with as many rows as there are outputs y. See also TF2SS
The other function, tf2ss, converts the transfer function of (5.125) to the statespace equations of (5.124). It is used with the statement [A,B,C,D]=tf2ss(num,den) where A, B, C, and D are the matrices of (5.124), and num, den are N ( s ) and D ( s ) of (5.125) respectively. The MATLAB help command provides the following information:
We have used capital letters for vectors b and c to be consistent with MATLABs designations.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
533
Example 5.13 For the circuit of Figure 5.12, all initial conditions are zero.
R L 1H C 1F
+
vS ( t ) = u0 ( t )
i( t)
v C ( t ) = v out ( t )
534
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or
di ---- = i v C + u 0 ( t ) dt
We let
x1 = iL = i
and
x 2 = v C = v out
Then,
di x 1 = ---dt
and
dv c x 2 = ------- = x 1 dt
(5.126)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
535
+
V in ( s )
1s
V C ( s ) = V out ( s )
or Therefore, c.
(5.127)
1 1.0000 1.0000
% The coefficients of G(s) in (5.127) % Verify the matrices of (5.126)
A = -1 1 B = 1 0 C = 0 D = 0
-1 0
The equivalence between the statespace equations of (5.126) and the transfer function of (5.127) is also evident from the Simulink models shown in Figure 5.14 where for the State Space block Function Block Parameters dialog box we have entered:
536
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Initial conditions: [0 0] For the Transfer Fcn block Function Block Parameters dialog box we have entered: Numerator coefficient: [ 1 ] Denominator coefficient: [1 1 1]
Figure 5.14. Models to show the equivalence between relations (5.126) and (5.127)
After the simulation command is executed, both Scope 1 and Scope 2 blocks display the input and output waveforms shown in Figure 5.15.
Figure 5.15. Waveforms displayed by Scope 1 and Scope 2 blocks for the models in Figure 5.14
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
537
directly from the network, provided that the state variables are chosen appropriately. to represent inductor currents and capacitor voltages.
When we obtain the state equations directly from given circuits, we choose the state variables The state variable method offers the advantage that it can also be used with nonlinear and timevarying devices. If a circuit contains only one energystoring device, the state equations are written as x = x + u y = k1 x + k2 u
where , , k 1 , and k 2 are scalar constants, and the initial condition, if nonzero, is denoted as
x0 = x ( t0 ) If and are scalar constants, the solution of x = x + u with initial condition x 0 = x ( t 0 )
x0 + e
t e
0
u ( ) d
where A and C are 2 2 or higher order matrices, and b and d are column vectors with two or more rows, entails the computation of the state transition matrix e , and integration of
At
x(t) = e
A ( t t0 )
x0 + e
At
t e
0
bu ( ) d
The eigenvalues i , where i = 1, 2, , n , of an n n matrix A are the roots of the nth order
polynomial
det [ A I ] = 0
538
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
The CayleyHamilton theorem states that a matrix can be expressed as an ( n 1 )th degree polynomial in terms of the matrix A as e
At
= a0 I + a1 A + a2 A + + an 1 A
n1
the coefficients a i are found from the simultaneous solution of the system of equations
a0 + a1 1 + a2 1 + + an 1 1 a0 + a1 2 + a2 2 + + an 1 2 a0 + a1 n + a2 n + + an 1 n
2 n1 2 2 n1 n1
= e = e
1 t 2 t
= e
n t
the coefficients a i of the state transition matrix are found from the simultaneous solution of the system of equations
a0 + a1 1 + a2 1 + + an 1 1
2 n1
= e
1 t
a0 + a1 m + 1 + a2 m + 1 + + an 1 m + 1 = e
2
n1
m + 1t
a 0 + a 1 n + a 2 n + + a n 1 n
2 n1
= e
n t
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
539
length. This is done by dividing each component of the eigenvector by the square root of the sum of the squares of their components, so that the sum of the squares of their components is equal to unity.
Two vectors X and Y are said to be orthogonal if their inner (dot) product is zero. A set of eigenvectors constitutes an orthonormal basis if the set is normalized (expressed as
The state transition matrix can be computed from the Inverse Laplace transform using the rela-
tion
At
= L
{ ( sI A ) }
If U ( s ) is the Laplace transform of the input u ( t ) and Y ( s ) is the Laplace transform of the output y ( t ) , the transfer function can be computed using the relation
1 Y(s) G ( s ) = ----------- = C ( sI A ) b + d U(s)
MATLAB provides two very useful functions to convert statespace (state equations), to transfer function (s-domain), and vice versa. The function ss2tf (statespace to transfer func-
tion) converts the state space equations to the transfer function equivalent, and the function tf2ss, converts the transfer function to statespace equations.
540
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0 v d t
= sin 3t + cos 3t
2. Express the matrix of the state equations below as a single differential equation, and let x(y) = y(t) .
x1 x2 x3 x4 x1 0 0 1 0 0 x2 = 0 0 1 0 + 0 u(t) 0 0 0 0 1 x3 1 1 2 3 4 x4
3. For the circuit below, all initial conditions are zero, and u ( t ) is any input. Write state equations in matrix form.
R + C
u(t)
4. In the circuit below, all initial conditions are zero. Write state equations in matrix form.
R 1 C1 2F L 1H C 2 2F
V p cos tu 0 ( t )
5. In the below, i L ( 0 ) = 2 A . Use the state variable method to find i L ( t ) for t > 0 .
R
10u 0 ( t )
2 L 2H
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
541
given that
A = 0 1 0 0 0 1 6 11 6
9. In the circuit below, i L ( 0 ) = 0 , and v C ( 0 ) = 1 V . a. Write state equations in matrix form. b. Compute e
At
R 34
4H
542
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or
3 dv dv dv ------- = k 3 ------- k 2 ----- k 1 v + 3 ( cos 3t sin 3t ) (1) 2 3 dt dt dt 2
We let
v = x1 dv ----- = x 2 = x 1 dt
3 dv - = x ------3 3 dt 2 dv ------- = x 3 = x 2 2 dt
Then,
Letting x = y we obtain
4 dy dy dy dy ------- + 4 ------- + 3 ------- + 2 ----- + y = u ( t ) 3 2 4 dt dt dt dt 3 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
543
+
u( t)
iT
L
iL i + C vC C
or Also, Then,
4.
R 1
v C1
C1 2F
L 1H C 2
iL v C2 2F
v C1
V p cos tu 0 ( t )
or or By KVL,
544
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or or Also, or or
We will create a Simulink model with V p = 1 and output y = x 3 . The model is shown below where for the StateSpace block Function Block Parameters dialog box we have entered:
A: [0 1 1; 1/2 1/2 0; 1/2 0 0] B: [0 1/2 0] C: [0 0 1] D: [ 0 ] Initial conditions: [0 0 0]
and for the Sine Wave block Function Block Parameters dialog box we have entered: Amplitude: 1 Phase: pi/2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
545
5.
R 2
10u 0 ( t )
2H
x0 + e 2+e
t
t e
0
u ( ) d
t t
1 ( t 0 )
e 5u 0 ( ) d = 2e + 5e
t t
0 e d
t
= 2e + 5e ( e 1 ) = 2e + 5 5 e = ( 5 3e )u 0 ( t )
6.
a.
A = 1 2 3 1 2 = 0 det ( A I ) = det 1 2 1 0 = det 1 3 1 3 1 0 1 ( 1 )( 1 ) 6 = 0
546
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and thus
1 = 7
= 7 2 = 7
b.
B = a 0 a b det ( B I ) = det a 0 1 0 = det a 0 = 0 a b 0 1 a b ( a )( b ) = 0 1 = a 2 = b
and thus c.
0 1 0 C = 0 0 1 6 11 6
( 6 ) 6 ( 11 ) ( ) = + 6 + 11 + 6 = 0
and thus
1 = 1 2 = 2 1 = 3
= a0 I + a1 A + a2 A
(1)
Then, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
547
a0 a1 + a2 = e
t 2t 3t
a 0 2a 1 + 4a 2 = e a 0 3a 1 + 9a 2 = e
syms t; A=[1 1 1; 1 2 4; 1 3 9];... a=sym('[exp(t); exp(2*t); exp(3*t)]'); x=A\a; fprintf(' \n');... disp('a0 = '); disp(x(1)); disp('a1 = '); disp(x(2)); disp('a2 = '); disp(x(3))
+ 3e
3t 3t
a 1 = 2.5e 4e a 2 = 0.5e e
2t
+ 1.5e
2t
+ 0.5e
3t
Now, we compute e
At
eAt = [3*exp(-t)-3*exp(-2*t)+exp(-3*t), 5/2*exp(-t)-4*exp(-2*t)+3/ 2*exp(-3*t), 1/2*exp(-t)-exp(-2*t)+1/2*exp(-3*t)] [-3*exp(-t)+6*exp(-2*t)-3*exp(-3*t), -5/2*exp(-t)+8*exp(-2*t)9/2*exp(-3*t), -1/2*exp(-t)+2*exp(-2*t)-3/2*exp(-3*t)] [3*exp(-t)-12*exp(-2*t)+9*exp(-3*t), 5/2*exp(-t)-16*exp(2*t)+27/2*exp(-3*t), 1/2*exp(-t)-4*exp(-2*t)+9/2*exp(-3*t)] Thus,
3e 3e e
At t 2t
+e
3t
2.5e 4e
t
2t
+ 1.5e
3t 3t 3t
0.5e e
t t
2t
+ 0.5e
3t 3t
= 3 e t + 6e 2t 3e 3t 3e 12e
t 2t
2t
4.5e
0.5 e + 2e 0.5e 4e
2t
1.5e
+ 9e
3t
2t
+ 13.5e
2t
+ 4.5e
3t
548
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
b= 1 , 2
x0 = 1 , 0
At
u = ( t ),
t
t0 = 0
A
x( t) = e
A(t 0)
bu ( ) d = e x 0 + e
At
At
0 e
b ( ) d
At = e x0 + e b = e ( x0 + b ) = e 1 + 1 = e 0 0 2 2
At At
(1)
lambda2 = 1.00
a0 + a1 1 = e a0 + a1 2 = e
1 t 2 t
a0 + a1 = e
t 2t
a 0 + 2a 1 = e
2t
Then,
a 0 = 2e e
t 2t
a1 = e e
and
e
At t 2t 2t t = a 0 I + a 1 A = ( 2e e ) 1 0 + ( e e ) 1 0 0 1 2 2
= 2e e 0
2t t
0 2e e
2t
e e
2t
2t
t t
0 2e 2e
2t t
=
t
t 2t
0 e
2t
2e + 2e
2e 2e
0 = e t 2t 2 2e 2e x1 = 0
0 e
2t
0 0 = 2t 2 2e
2t
and thus
x 2 = 2e
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
549
iR
34
iL
i + C iL ( 0 ) = 0
4 H 43 F
v C v ( 0 ) = 1 V C
We let
x1 = iL x2 = vC
Then, a.
iR + iL + iC = 0 vC vC ----- + i L + C ----- = 0 dt R x2 4 -------- + x 1 + -- x 2 = 0 3 34
or
3 x 2 = -- x 1 x 2 (1) 4
Also,
di L v L = v C = L ------- = 4x 1 = x 2 dt
or
1 x 1 = -- x (2) 4 2
and thus
A = 0 3 4
1
14 1
b.
e
At
= L
{ [ sI A ] }
550
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
= det [ sI A ] = det
adj [ sI A ] = adj
[ sI A ]
1 1 = -- adj [ sI A ] = ---------------------------------------------- s + 1 ( s + 1 4 ) ( s + 3 4 ) 3 4 s+1 ---------------------------------------------(s + 1 4)(s + 3 4) = 3 4 ---------------------------------------------(s + 1 4)(s + 3 4) 14 ---------------------------------------------(s + 1 4)(s + 3 4) s ---------------------------------------------(s + 1 4)(s + 3 4)
1
At
= L
Fs1=(s+1)/(s^2+s+3/16); Fs2=(1/4)/(s^2+s+3/16); Fs3=(3/4)/(s^2+s+3/16); Fs4=s/ (s^2+s+3/16);... fprintf(' \n'); disp('a11 = '); disp(simple(ilaplace(Fs1))); disp('a12 = '); disp(simple(ilaplace(Fs2)));... disp('a21 = '); disp(simple(ilaplace(Fs3))); disp('a22 = '); disp(simple(ilaplace(Fs4)))
1.5e
0.25t 0.25t
0.5e
0.75t 0.75t
0.5e 0.5 e
0.25t
0.5e + 1.5e
0.75t 0.75t
1.5 e
+ 1.5e
0.25t
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
551
x0 + e
At
0 e
At At bu ( ) d = e x 0 + 0 = e 0 + 0 1 0 0.5e 0.5 e
0.25t
1.5e
0.25t 0.25t
0.5e
0.75t 0.75t
0.5e + 1.5e
0.75t 0.75t
1.5 e
+ 1.5e
0.25t
0.25t
0.75t
0.5e
0.75t
x 2 = v C = 0.5 e
0.25t
+ 1.5e
0.75t
552
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 6
The Impulse Response and Convolution
his chapter begins with the definition of the impulse response, that is, the response of a circuit that is subjected to the excitation of the impulse function. Then, it defines convolution and how it is applied to circuit analysis. Evaluation of the convolution integral using graphical methods is also presented and illustrated with several examples.
(6.1)
A
x0 + e
At
0 e
bu ( ) d
(6.2)
Therefore, with initial condition x 0 = 0 , and with the input u ( t ) = ( t ) , the solution of (6.2) reduces to
x(t) = e
At
0 e
b ( ) d
(6.3)
f ( t ) ( ) d
At
= f(0)
(6.4)
(6.5)
where the unit step function u 0 ( t ) is included to indicate that this relation holds for t > 0 .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
61
(t)
h ( t ) = v C ( t ) = v out ( t )
Solution:
We assign currents i C and i R with the directions shown in Figure 6.2, and we apply KCL.
R
iR
C
+
(t)
iC h ( t ) = v C ( t ) = v out ( t )
Then, or
Figure 6.2. Application of KCL for the circuit for Example 6.1 iR + iC = 0 dv C v C ( t ) C -------- + -------------------- = 0 dt R vC = x dv C -------- = x dt (t) x Cx + --- = --------R R 1 1 x = ------- x + ------- ( t ) RC RC x = ax + bu h ( t ) = e bu 0 ( t ) a = 1 RC
At
(6.6)
We assign the state variable Then, and (6.6) is written as or Equation (6.7) has the form and as we found in (6.5), For this example,
(6.7)
6 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
b = 1 RC 1------RC
or
1 t RC h ( t ) = ------- e u0 ( t ) RC
(6.8)
Thus,
dd- 1 - t RC i C = C ---- h ( t ) = C ---- ------- e u 0 ( t ) dt dt RC 1 t RC 1 t RC = ---------- e + --- e (t) 2 R R C
(6.9)
Example 6.2 For the circuit of Figure 6.3, compute the impulse response h ( t ) = v C ( t ) given that the initial conditions are zero, that is, i L ( 0 ) = 0 , and v C ( 0 ) = 0 .
R 1 L 14 H C
(t)
43 F
h ( t ) = vC ( t )
Solution: This is the same circuit as that of Example 5.10, Chapter 5, Page 522, where we found that
b = 4 0
and Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
63
At
2 e + 2e 1.5e 0.5e
t
3t
3t
The impulse response is obtained from (6.5), Page 61, that is,
h ( t ) = x ( t ) = e bu 0 ( t )
At
then,
h( t)= x(t) = x1 x2 0.5 e + 1.5e = 3 t 3 3t -- e -- e 8 8
t 3t
2 e + 2e 1.5e 0.5e
t
3t
3t
4 u ( t ) = 2 e + 6e u ( t ) 0 3 t 3 3t 0 0 -- e -- e 2 2
3t
(6.10)
and
x2 = vC
Then,
h ( t ) = x 2 = v C ( t ) = 1.5e 1.5e
t 3t
or
h ( t ) = v C ( t ) = 1.5 ( e e
t 3t
(6.11)
Of course, this answer is not the same as that of Example 5.10, because the inputs and initial conditions were defined differently.
(6.12)
that is, if in an even function we replace t with t , the function f ( t ) does not change. Thus, polynomials with even exponents only, and with or without constants, are even functions. For instance, the cosine function is an even function because it can be written as the power series
t- t- tcos t = 1 ---- + ---- ---- + 2! 4! 6!
2 4 6
6 4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
f(t) t2 + k k t
0
f(t)
(6.13)
that is, if in an odd function we replace t with t , we obtain the negative of the function f ( t ) . Thus, polynomials with odd exponents only, and no constants are odd functions. For instance, the sine function is an odd function because it can be written as the power series
t t t sin t = t ---- + ---- ---- + 3! 5! 7!
3 5 7
f(t) t3 t
0
f(t)
We observe that for odd functions, f ( 0 ) = 0 . However, the reverse is not always true; that is, if f ( 0 ) = 0 , we should not conclude that f ( t ) is an odd function. An example of this is the function
f ( t ) = t in Figure 6.4.
2
The product of two even or two odd functions is an even function, and the product of an even function times an odd function, is an odd function. Henceforth, we will denote an even function with the subscript e , and an odd function with the subscript o . Thus, f e ( t ) and f o ( t ) will be used to represent even and odd functions of time respectively. For an even function f e ( t ) ,
T
and for an odd function f o ( t ) ,
f e ( t ) dt = 2
f e ( t ) dt
(6.14)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
65
f o ( t ) dt = 0
(6.15)
(6.16)
or as
1 f o ( t ) = -- [ f ( t ) f ( t ) ] 2
(6.17)
(6.18)
that is, any function of time can be expressed as the sum of an even and an odd function. Example 6.3 Determine whether the delta function is an even or an odd function of time. Solution: Let f ( t ) be an arbitrary function of time that is continuous at t = t 0 . Then, by the sifting property of the delta function
f ( t ) ( t t ) dt
0
= f ( t0 )
f ( t ) ( t ) dt fe ( t ) ( t ) dt fo ( t ) ( t ) dt
from the last relation above,
= f(0 )
= fe ( 0 ) = fo ( 0 )
fo ( t ) ( t ) dt
6 6
= fo ( 0 ) = 0
(6.19)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Convolution
and this indicates that the product f o ( t ) ( t ) is an odd function of t . Then, since f o ( t ) is odd, it follows that ( t ) must be an even function of t for (6.19) to hold.
6.3 Convolution
Consider a network whose input is ( t ) , and its output is the impulse response h ( t ) . We can represent the inputoutput relationship as the block diagram shown below.
(t) Network h(t)
In general,
(t )
Network
h( t )
Multiplying both sides by the constant d , integrating from to + , and making use of the fact that the delta function is even, i.e., ( t ) = ( t ) , we obtain
u ( ) ( t ) d u ( ) ( t ) d
Network
u ( )h ( t ) d u ( t )h ( ) d
Using the sifting property of the delta function, we find that the second integral on the left side reduces to u ( t ) and thus
u( t)
u ( )h ( t ) d u ( t )h ( ) d
(6.20)
Network
The integral
u ( )h ( t ) d
or
u ( t )h ( ) d
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
67
y( t) =
A(t )
bu ( ) d = e
At
bu ( ) d
(6.21)
t 0
h ( t ) u ( t ) =
u ( t )h ( ) d
(6.22)
where is a dummy variable, that is, u ( ) and h ( ) , are considered to be the same as u ( t ) and h ( t ) . We form u ( t ) by first constructing the image of u ( ) ; this is shown as u ( ) in Figure 6.7.
6 8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Next, we form u ( t ) by shifting u ( ) to the right by some value t as shown in Figure 6.8.
1 u ( t )
u ( t )h ( ) d
entails multiplication of u ( t ) by h ( ) for each value of t , and computation of the area from to + . Figure 6.9 shows the product u ( t )h ( ) as point A moves to the right.
u ( t ), t = 0 1 u ( t )*h ( ) = 0 for t = 0 h() 1 A 0
We observe that u ( t )
t=0
sketch of Figure 6.10 where the integral of the product is denoted by the shaded area, and it increases as point A moves further to the right.
u ( t ), t > 0 1 h()
A
0 t 1
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
69
Using the convolution integral, we find that the area as a function of time t is
u ( t )h ( ) d =
u ( t )h ( ) d =
--( 1 ) ( + 1 ) d = 2 0
2 t
= tt --2
(6.23)
Figure 6.12 shows how u ( )*h ( ) increases during the interval 0 < t < 1 . This is not an exponential increase; it is the function t t 2 2 in (6.23), and each point on the curve of Figure 6.12 represents the area under the convolution integral.
u(t)*h(t)
Figure 6.12. Curve for the convolution of u ( )*h ( ) for 0 < t < 1 in Example 6.4
t=1
1 = -2
(6.24)
The plot for the interval 0 t 1 is shown in Figure 6.13. As we continue shifting u ( t ) to the right, the area starts decreasing, and it becomes zero at t = 2 , as shown in Figure 6.14.
610
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0.4
0.3
tt 2
0.2
0.1
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
u ( t ), t = 2
Using the convolution integral, we find that the area for the interval 1 < t < 2 is
u ( t )h ( ) d = t 1 u ( t )h ( ) d =
2
( 1 ) ( + 1 ) d = --2 t1
2
2 1
t1
(6.25)
t 2t + 1 t 1 = 1 -- ( t 1 ) + ----------------------- = --- 2t + 2 2 2 2
Evaluating (6.25) at t = 2 , we find that u ( )*h ( ) = 0 . For t > 2 , the product u ( t )h ( ) is zero since there is no overlap between these two signals. The convolution of these signals for 0 t 2 , is shown in Figure 6.15.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
611
0.4
t 2 2t + 2
0.3
0.2
tt 2
0.1
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
The plot of Figure 6.15 was obtained with the MATLAB script below.
t1=0:0.01:1; x=t1t1.^2./2; axis([0 1 0 0.5]);... t2=1:0.01:2; y=t2.^2./22.*t2+2; axis([1 2 0 0.5]); plot(t1,x,t2,y); grid
Example 6.5 The signals h ( t ) and u ( t ) are as shown in Figure 6.16. Compute h ( t )*u ( t ) using the graphical evaluation method.
u ( t ) = u0 ( t ) u0 ( t 1 ) 1 h(t) = e
t
t 0
Solution:
Following the same procedure as in the previous example, we form u ( t ) by first constructing the image of u ( ) . This is shown as u ( ) in Figure 6.17.
u ( ) 1
612
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
u ( t )h ( ) d
entails multiplication of u ( t ) by h ( ) for each value ot t , and computation of the area from to + . Figure 6.19 shows the product u ( t )h ( ) as point A moves to the right.
u ( t ), t = 0 1 u ( t )*h ( ) = 0 for t = 0 h() 1 A 0
We observe that u ( t )
t=0
sketch of Figure 6.20 where the integral of the product is denoted by the shaded area, and it increases as point A moves further to the right.
u ( t ), t > 0 1 h() A 0 t
The maximum area is obtained when point A reaches t = 1 as shown in Figure 6.21.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
613
u ( t )h ( ) d =
u ( t )h ( ) d =
( 1 ) ( e ) d = e
t 0
= e
0 t
= 1e
(6.26)
= 1e
= 0.632
(6.27)
1e
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
As we continue shifting u ( t ) to the right, the area starts decreasing. As shown in Figure 6.23, it approaches zero as t becomes large but never reaches the value of zero.
614
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
t 1
u ( t )h ( ) d =
t 1
( 1 ) ( e ) d = e
t
t t1
= e
t 1 t
= e
( t 1 )
= e (e 1)
(6.28)
= 1.732e
Evaluating (6.28) at t = 2 , we find that u ( )*h ( ) = 0.233 . For t > 2 , the product u ( t )h ( ) approaches zero as t . The convolution of these signals for 0 t 2 , is shown in Figure 6.24.
0.7 0.6
1e
0.5 0.4 0.3 0.2 0.1 0
e (e 1)
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
The plot of Figure 6.24 was obtained with the MATLAB script below.
t1=0:0.01:1; x=1exp(t1); axis([0 1 0 0.8]);... t2=1:0.01:2; y=1.718.*exp(t2); axis([1 2 0 0.8]); plot(t1,x,t2,y); grid
Example 6.6 Perform the convolution v 1 ( t )*v 2 ( t ) where v 1 ( t ) and v 2 ( t ) are as shown in Figure 6.25. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
615
v 1 ( t ) v 2 ( t ) =
v ( )v ( t ) d
1 2
(6.29)
The computation steps are as in the two previous examples, and are evident from the sketches of Figures 6.26 through 6.29. Figure 6.26 shows the formation of v 2 ( ) .
v1 ( t ) v2 ( )
2
1 1
Figure 6.27 shows the formation of v 2 ( t ) and convolution with v 1 ( t ) for 0 < t < 1 .
v1 ( t ) 2 v2 ( t ) 1 v 1 ( t )*v 2 ( t ) = 2 1 t = 2t
0 ( 1 ) ( 2 ) d
= 2
t 0
= 2t
(6.30)
616
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1t
v 1 ( t ) v 2 ( t ) =
( 1 ) ( 2 ) d = 2
1 0
= 2
(6.31)
1 1 t2
v2 ( t )
t 2 ( 1 ) ( 2 ) d
= 2
1 t2
= 2t + 6
(6.32)
From (6.30), (6.31), and (6.32), we obtain the waveform of Figure 6.30 that represents the convolution of the signals v 1 ( t ) and v 2 ( t ) .
( v 1 ( t ) ) v 2 ( t )
2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
617
3. We slide u ( ) or h ( ) to the right a distance t to obtain u ( t ) or h ( t ) . 4. We multiply the two functions to obtain the product u ( t ) h ( ) , or u ( ) h ( t ) . 5. We integrate this product by varying t from to + .
u0 ( t )
vC ( t ) 1F
Solution:
Before we apply the convolution integral, we must know the impulse response h ( t ) of this circuit. The circuit of Figure 6.31 was analyzed in Example 6.1, Page 62, where we found that
1 t RC h ( t ) = ------- e u0 ( t ) RC
(6.33)
(6.34)
Next, we use the graphical evaluation of the convolution integral as shown in Figures 6.32 through 6.34. The formation of u 0 ( ) is shown in Figure 6.32.
618
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
u 0 ( t )h ( ) d =
0 ( 1 )e
d = e
t t 0
= e
t 0 t
= ( 1 e )u 0 ( t )
(6.35)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
619
0.8
0.6
t ( 1 e )u 0 ( t )
0.4
0.2
0.5
1.5
2.5
3.5
4.5
620
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
delta function.
The determination of the impulse response assumes zero initial conditions. A function f ( t ) is an even function of time if the following relation holds. f ( t ) = f ( t ) A function f ( t ) is an odd function of time if the following relation holds. f ( t ) = f ( t ) The product of two even or two odd functions is an even function, and the product of an even
or as
1 f o ( t ) = -- [ f ( t ) f ( t ) ] 2
u ( )h ( t ) d
or
u ( t )h ( ) d
is known as the convolution integral.
If we know the impulse response of a network, we can compute the response to any input u ( t )
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
621
denotes convolution.
The convolution integral is more conveniently evaluated by the graphical evaluation method.
622
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(t)
vL ( t )
iL ( t )
L
2. Repeat Example 6.4, Page 68, by forming h ( t ) instead of u ( t ) , that is, use the convolution integral
u ( )h( t ) d
3. Repeat Example 6.5, Page 612, by forming h ( t ) instead of u ( t ) . 4. Compute v 1 ( t )*v 2 ( t ) given that
4t v1 ( t ) = 0 t0 t<0
5. For the series RL circuit shown below, the response is the current i L ( t ) . Use the convolution integral to find the response when the input is the unit step u 0 ( t ) .
R
iL ( t )
L 1H
+
u0 ( t )
6. Compute v out ( t ) for the network shown below using the convolution integral, given that
v in ( t ) = u 0 ( t ) u 0 ( t 1 ) .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
623
+ R
1
v in ( t )
v out ( t )
7. Compute v out ( t ) for the network shown below given that v in ( t ) = u 0 ( t ) u 0 ( t 1 ) . Using MATLAB, plot v out ( t ) for the time interval 0 < t < 5 .
R +
v in ( t )
+ L
1H
v out ( t )
624
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
i (t) L (t)
vL ( t ) L
di Ri + L ---- = ( t ) dt
x0 + e
At
0 e
bu ( ) d
1 L u 0 ( t ) = ( 1 L )e
( R L )t
u0 ( t )
and using the sampling property of the delta function, the above relation reduces to
v L = ( R L )e
( R L )t
u0 ( t ) + ( t )
2.
1
h(t)
h ( )
h ( t )
t 0
t1 1
From the plots above we observe that the area reaches the maximum value of 1 2 at t = 1 , and then decreases to zero at t = 2 . Alternately, using the convolution integral we obtain
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
625
u ( )h ( t ) d
[ ( 1 t ) + ] d = ---- + ( 1 t ) 2 0
t= --- + ( 1 t )t = t t --2 2
and we observe that at t = 1 , Area 1 = 1 2 square units Next, for 1 < t < 2 ,
---[ ( 1 t ) + ] d = - + ( 1 t ) Area 2 = 2 t1
1
t1 2
(t 1) t 1 = -- + 1 t ----------------- ( 1 t ) ( t 1 ) = --- 2t + 2 2 2 2
From the plots above we observe that the area reaches its maximum value at t = 1 , and then decreases exponentially to zero as t . Alternately, using the convolution integral we obtain
u ( t )*h ( t ) =
t
u ( )h ( t ) d
( t )
where h ( t ) = e , h ( ) = e , h ( ) = e , and h ( t ) = e
Area 1 =
(1 e
( t )
) d = e
0 e d
= e (e e ) = 1 e
For t > 1 ,
Area 2 =
(1 e
( t )
) d = e
0 e d
= e e
t 1 0
= e ( e e ) = e ( e 1 ) = 1.732e
626
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
v 1 ( t )*v 2 ( t ) =
v 1 ( )v 2 ( t ) d =
0
ax
4e
d = 4e
2t
0 e
and thus
v 1 ( t )*v 2 ( t ) = ( 4e
0 2t
e ax xe dx = ------ ( ax 1 ) 2 a
2 t
) e ( 2 1 ) -------------------------4
2t
= e
0
2t
[ e ( 2t 1 ) e ( 1 ) ]
2t
= e ( 2t 1 + e
) = 2t + e
2t
Check:
v 1 ( t )*v 2 ( t ) V 1 ( s ) V 2 ( s ) ,
V1 ( s ) = 4 s , V2 ( s ) = 1 ( s + 2 )
2
ans = 2*t-1+exp(-2*t) 5. To use the convolution integral, we must first find the impulse response. It was found in Exercise 1 as
h ( t ) = i ( t ) = ( 1 L )e
( R L )t
u0 ( t )
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
627
u0 ( t ) iL ( t )
1H
u0 ( t )h ( ) d
1 u0 ( t ) h ( t )
0 t
i( t ) v = u (t) = in 0
( 1 ) e d = e
t 0
= e
= ( 1 e )u 0 ( t )
1 u 0 ( t )*h ( t ) t
6.
L +
1H
+ R
1
v in ( t )
v out ( t )
We will first compute the impulse response, that is, the output when the input is the delta function, i.e., v in ( t ) = ( t ) . Then, by KVL
di L L ------- + Ri L = ( t ) dt
and with i L = x
1 x + 1 x = (t)
628
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0< t<1
t t>1
( 1 ) ( e ) d = e
t 0
= e
0 t
= 1e
1 h() 0 t1 t
t 1
( 1 ) ( e ) d = e
t t1
= e
t 1 t
= e (e 1)
7.
R +
1
+ L
1H
v in ( t ) v in ( t ) = u 0 ( t ) u 0 ( t 1 )
v out ( t )
v out ( t ) = v L = v in v R
From Exercise 6,
The plot for the time interval 0 < t < 5 is shown below. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
629
The plot above was obtained with the MATLAB script below.
t1=0:0.01:1; x=exp(t1); axis([0 1 0 1]);... t2=1:0.01:5; y=1.718.*exp(t2); axis([1 5 0 1]); plot(t1,x,t2,y); grid
630
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 7
Fourier Series
his chapter is an introduction to Fourier series. We begin with the definition of sinusoids that are harmonically related and the procedure for determining the coefficients of the trigonometric form of the series. Then, we discuss the different types of symmetry and how they can be used to predict the terms that may be present. Several examples are presented to illustrate the approach. The alternate trigonometric and the exponential forms are also presented.
(7.1)
or
1 f ( t ) = -- a 0 + 2
( a cos nt + b sin nt )
n n
(7.2)
n=1
where the first term a 0 2 is a constant, and represents the DC (average) component of f ( t ) . Thus, if f ( t ) represents some voltage v ( t ) , or current i ( t ) , the term a 0 2 is the average value of
v ( t ) or i ( t ) .
The terms with the coefficients a 1 and b 1 together, represent the fundamental frequency component *. Likewise, the terms with the coefficients a 2 and b 2 together, represent the second harmonic component 2 , and so on. Since any periodic waveform f ( t ) ) can be expressed as a Fourier series, it follows that the sum of
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
71
Fundamental
0 0 0
2
sin mt dt = 0
(7.3)
cos m t dt = 0
(7.4)
( sin mt ) ( cos nt ) dt = 0
(7.5)
The integrals of (7.3) and (7.4) are zero since the net area over the 0 to 2 area is zero. The integral of (7.5) is also is zero since
1 sin x cos y = -- [ sin ( x + y ) + sin ( x y ) ] 2
This is also obvious from the plot of Figure 7.2, where we observe that the net shaded area above and below the time axis is zero.
72
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
cos x
( sin mt ) ( cos nt ) dt = 0
0
since
( sin mt ) ( sin nt ) dt = 0
(7.6)
The integral of (7.6) can also be confirmed graphically as shown in Figure 7.3, where m = 2 and n = 3 . We observe that the net shaded area above and below the time axis is zero.
sin 2x sin 3x sin 2x sin 3x
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
73
0
since
( cos m t ) ( cos nt ) dt = 0
(7.7)
The integral of (7.7) can also be confirmed graphically as shown in Figure 7.4, where m = 2 and n = 3 . We observe that the net shaded area above and below the time axis is zero.
cos 3x cos 2x cos 2x cos 3x
0
2
0
and
( sin mt ) dt =
(7.8)
( cos m t ) dt =
(7.9)
The integrals of (7.8) and (7.9) can also be seen to be true graphically with the plots of Figures 7.5 and 7.6. It was stated earlier that the sine and cosine functions are orthogonal to each other. The simplification obtained by application of the orthogonality properties of the sine and cosine functions, becomes apparent in the discussion that follows. In (7.1), Page 71, for simplicity, we let = 1 . Then,
1 f ( t ) = -- a 0 + a 1 cos t + a 2 cos 2t + a 3 cos 3t + a 4 cos 4t + 2 + b 1 sin t + b 2 sin 2t + b 3 sin 3t + b 4 sin 4t +
(7.10)
74
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
sin x sin x
( sin mt ) dt =
cos x cos x
( cos m t ) dt =
To evaluate any coefficient in (7.10), say b 2 , we multiply both sides of (7.10) by sin 2t . Then,
1 f ( t ) sin 2t = -- a 0 sin 2t + a 1 cos t sin 2t + a 2 cos 2t sin 2t + a 3 cos 3t sin 2t + a 4 cos 4t sin 2t + 2 b 1 sin t sin 2t + b 2 ( sin 2t ) + b 3 sin 3t sin 2t + b 4 sin 4t sin 2t +
2
Next, we multiply both sides of the above expression by dt , and we integrate over the period 0 to 2 . Then,
1 f ( t ) sin 2t dt = -- a 0 2
sin 2t dt + a 1
2
cos t sin 2t dt + a 2
cos 2t sin 2t dt
+ a3 + b1
(7.11)
( sin 2t ) dt + b 3
2
sin 3t sin 2t dt +
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
75
( sin 2t ) dt
2
0
or
f ( t ) sin 2t dt = b 2 1 b 2 = -
( sin 2t ) dt = b 2
2
f ( t ) sin 2t dt
and thus we can evaluate this integral for any given function f ( t ) . The remaining coefficients can be evaluated similarly. The coefficients a 0 , a n , and b n are found from the following relations.
1 1-- a 0 = ----2 2 1 a n = -
2
f ( t ) dt
(7.12)
f ( t ) cos nt dt
(7.13)
1 b n = -
f ( t ) sin nt dt
(7.14)
76
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(7.18)
* Quartet-wave symmetry is another type of symmetry where a digitally formed waveform with a series of zeros and ones contains only sine odd harmonics. We will not discuss this type of symmetry in this text. For a brief discussion, please refer to Introduction to Simulink with Engineering Applications, Page 7-18, ISBN 978-1934404-09-6.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
77
0
T/2 f(a)
An easy method to test for halfwave symmetry is to choose any halfperiod T 2 length on the time axis as shown in Figure 7.7, and observe the values of f ( t ) at the left and right points on the time axis, such as f ( a ) and f ( b ) . If there is halfwave symmetry, these will always be equal but will have opposite signs as we slide the half-period T 2 length to the left or to the right on the time axis at nonzero values of f ( t ) .
78
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
T/2
T/2
0
T/2
T/2
T/2
T/2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
79
Chapter 7 Fourier Series 7.3.5 Symmetry in Fundamental, Second, and Third Harmonics
Figure 7.11 shows a fundamental, second, and third harmonic of a typical sinewave.
/2 a b /2 b c /2
a c Fundamental Second harmonic Third harmonic Figure 7.11. Fundamental, second, and third harmonic test for symmetry
In Figure 7.11, the half period T 2 , is chosen as the half period of the period of the fundamental frequency. This is necessary in order to test the fundamental, second, and third harmonics for halfwave symmetry. The fundamental has halfwave symmetry since the a and a values, when separated by T 2 , are equal and opposite. The second harmonic has no halfwave symmetry because the ordinates b on the left and b on the right, although are equal, there are not opposite in sign. The third harmonic has halfwave symmetry since the c and c values, when separated by T 2 are equal and opposite. These waveforms can be either odd or even depending on the position of the ordinate. Also, all three waveforms have zero average value unless the abscissa axis is shifted up or down. In the expressions of the integrals in (7.12) through (7.14), Page 76, the limits of integration for the coefficients a n and b n are given as 0 to 2 , that is, one period T . Of course, we can choose the limits of integration as to + . Also, if the given waveform is an odd function, or an even function, or has halfwave symmetry, we can compute the nonzero coefficients a n and b n by integrating from 0 to only, and multiply the integral by 2 . Moreover, if the waveform has halfwave symmetry and is also an odd or an even function, we can choose the limits of integration from 0 to 2 and multiply the integral by 4 . The proof is based on the fact that, the product of two even functions is another even function, and also that the product of two odd functions results also in an even function. However, it is important to remember that when using these shortcuts, we must evaluate the coefficients a n and b n for the integer values of n that will result in nonzero coefficients. This point will be illustrated in Subsection 7.4.2, Page 714.
710
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Trigonometric Form of Fourier Series for Common Waveforms 7.4.1 Trigonometric Fourier Series for Square Waveform
For the square waveform of Figure 7.12, the trigonometric series consist of sine terms only because, as we already know from Page 78, this waveform is an odd function. Moreover, only odd harmonics will be present since this waveform has also halfwave symmetry. However, we will compute all coefficients to verify this. Also, for brevity, we will assume that = 1
T A
0 A
1 f ( t ) cos nt dt = -
A cos nt dt +
2 )
(7.19)
and since n is an integer (positive or negative) or zero, the terms inside the parentheses on the second line of (7.19) are zero and therefore, all a i coefficients are zero, as expected since the square waveform has odd symmetry. Also, by inspection, the average ( DC ) value is zero, but if we attempt to verify this using (7.19), we will obtain the indeterminate form 0 0 . To work around this problem, we will evaluate a 0 directly from (7.12), Page 76. Thus,
1 a 0 = -
A dt +
A ( A ) dt = --- ( 0 2 + ) = 0
(7.20)
The b i coefficients are found from (7.14), Page 76, that is,
1 b n = -
1 f ( t ) sin nt dt = -
A sin nt dt +
2 )
(7.21)
For n = even , (7.21) yields Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
711
as expected, since the square waveform has halfwave symmetry. For n = odd , (7.21) reduces to
A4A b n = ----- ( 1 + 2 + 1 ) = -----n n
and thus
4A b 1 = ----- 4A b 3 = -----3 4A b 5 = -----5
and so on. Therefore, the trigonometric Fourier series for the square waveform with odd symmetry is
4A 1 1 4A f ( t ) = ------ sin t + -- sin 3t + -- sin 5t + = ----- 3 5
n = odd
1 -- sin nt n
(7.22)
It was stated above that, if the given waveform has halfwave symmetry, and it is also an odd or an even function, we can integrate from 0 to 2 , and multiply the integral by 4 . This property is verified with the following procedure. Since the waveform is an odd function and has halfwave symmetry, we are only concerned with the odd b n coefficients. Then,
1 b n = 4 -
2 0
4A ) = ------ cos n -- + 1 n 2
(7.23)
(7.24)
as before, and thus the series is as we found earlier. Next let us consider the square waveform of Figure 7.13 where the ordinate has been shifted to the right by 2 radians, and has become an even function. However, it still has halfwave symmetry. Therefore, the trigonometric Fourier series will consist of odd cosine terms only.
712
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
/2
3 / 2 2
Since the waveform has halfwave symmetry and is an even function, it will suffice to integrate from 0 to 2 , and multiply the integral by 4 . The a n coefficients are found from
1 a n = 4 -
4 f ( t ) cos nt dt = -
2 ) 0
4A = ------ sin n -- n 2
(7.25)
We observe that for n = even , all a n coefficients are zero, and thus all even harmonics are zero as expected. Also, by inspection, the average ( DC ) value is zero.
For n = odd , we observe from (7.25) that sin n -- , will alternate between +1 and 1 depending 2
(7.26)
Then, the trigonometric Fourier series for the square waveform with even symmetry is
4A 1 4A 1 f ( t ) = ------ cos t -- cos 3t + -- cos 5t = ----- 5 3
n = odd
( 1 )
(n 1 ) ---------------2 1
-- cos n t n
(7.27)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
713
(7.28)
and substitute t with t + 2 , that is, we let t = + 2 . With this substitution, relation (7.28) becomes
4A 1 1 f ( ) = ------ sin + + -- sin 3 + + -- sin 5 + + --- 3 5 2 2 2 4A 1 1 3 = ------ sin + + -- sin 3 + ----- + -- sin 5 + 5 + ----- 2 3 2 5 2
(7.29)
and using the identities sin ( x + 2 ) = cos x , sin ( x + 3 2 ) = cos x , and so on, we rewrite (7.29) as
1 1 4A f ( ) = ------ cos -- cos 3 + -- cos 5 5 3
(7.30)
and this is the same as (7.27). Therefore, if we compute the trigonometric Fourier series with reference to one ordinate, and afterwards we want to recompute the series with reference to a different ordinate, we can use the above procedure to save computation time.
2
A
0 2
By inspection, the DC component is zero. As before, we will assume that = 1 . If we choose the limits of integration from 0 to 2 , we will need to perform two integrations
714
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
However, we can choose the limits from to + , and thus we will only need one integration since
A f ( t ) = --- t < t <
Better yet, since the waveform is an odd function, we can integrate from 0 to , and multiply the integral by 2 ; this is what we will do. From tables of integrals,
x sin ax dx
Then,
2 b n = -
(7.31)
(7.32)
that is, the even harmonics have negative coefficients. 2. If n = odd , sin n = 0 , cos n = 1 . Then,
2A 2A b n = ---------- ( n ) = -----n2 2 n
that is, the odd harmonics have positive coefficients. Thus, the trigonometric Fourier series for the sawtooth waveform with odd symmetry is
2A 1 1 1 2A f ( t ) = ------ sin t -- sin 2t + -- sin 3t -- sin 4t + = ----- 2 3 4
( 1 )
n1
1 -- sin nt n
(7.33)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
715
Chapter 7 Fourier Series 7.4.3 Trigonometric Fourier Series for Triangular Waveform
The sawtooth waveform of Figure 7.15 is an odd function with halfwave symmetry; then, the trigonometric Fourier series will contain sine terms only with odd harmonics. Accordingly, we only need to evaluate the b n coefficients. We will choose the limits of integration from 0 to
2 , and will multiply the integral by 4 . As before, we will assume that = 1 .
A 2 A /2 T t
x sin ax dx
Then,
4 b n = -
(7.34)
2
(7.35)
Thus, the trigonometric Fourier series for the triangular waveform with odd symmetry is
8A 1 1 8A f ( t ) = ------ sin t 1 sin 3t + ----- sin 5t ----- sin 7t + = ------( 1 ) 2 2 25 49 9 n = odd
(n 1) ---------------2
716
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Trigonometric Form of Fourier Series for Common Waveforms 7.4.4 Trigonometric Fourier Series for HalfWave Rectifier Waveform
The circuit of Figure 7.16 is a halfwave rectifier whose input is the sinusoid v in ( t ) = sin t , and its output v out ( t ) is defined as
sin t v out ( t ) = 0 0 < t < < t < 2
(7.37)
+
R
v in ( t )
v out ( t )
We will express v out ( t ) as a trigonometric Fourier series, and we will assume that = 1 . The input and output waveforms are shown in Figures 7.17 and 7.18 respectively.
1
f HW ( t )
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
717
Figure 7.19. Halfwave rectifier waveform for the circuit of Figure 7.16
By inspection, the average is a nonzero value, and the waveform has neither odd nor even symmetry. Therefore, we expect all terms to be present. The a n coefficients are found from
1 a n = -
f ( t ) cos nt dt
or
A a n = --
A sin t cos nt dt + --
0 cos nt dt
( sin mx ) ( cos nx ) dx
Then,
(7.38)
and
cos ( x + y ) = cos x cos y sin x sin y
we obtain
cos ( n ) = cos cos n + sin sin n = cos n
and
cos ( + n ) = cos cos n sin sin n = cos n
718
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(7.39)
Now, we can evaluate all the a n coefficients, except a 1 , from (7.39). First, we will evaluate a 0 to obtain the DC value. By substitution of n = 0 , we obtain
a 0 = 2A
1 -- a 0 = A --2
(7.40)
We cannot use (7.39) to obtain the value of a 1 because this relation is not valid for n = 1 ; therefore, we will evaluate the integral
A a 1 = --
0 sin t cos t dt
1 2 = ----- ( sin ax ) 2a
( sin ax ) ( cos ax ) dx
and thus,
A2 a 1 = ----- ( sin t ) 2
0
= 0
(7.41)
(7.42)
(7.43)
(7.44)
(7.45)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
719
(7.46)
and so on. Next, we need to evaluate the b n coefficients. For this waveform,
1 b n = A -
A f ( t ) sin nt dt = --
A sin t sin nt dt + --
0 sin nt dt
( sin mx ) ( sin nx ) dx
Therefore,
that is, all the b n coefficients, except b 1 , are zero. We will find b 1 by direct substitution into (7.14), Page 76, for n = 1 . Thus,
A b 1 = --
(7.47)
Combining (7.40), with (7.42) through (7.47), we find that the trigonometric Fourier series for the halfwave rectifier with no symmetry is
A A cos 2t cos 4t cos 6t cos 8t f ( t ) = A + --- sin t --- ------------- + ------------- + ------------- + ------------- + --- 2 3 15 35 63
(7.48)
720
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
v in ( t )
+
v out ( t )
The input and output waveforms are shown in Figures 7.21 and 7.22 respectively. We will express v out ( t ) as a trigonometric Fourier series, and we will assume that = 1 .
A
Figure 7.21. Input sinusoid for the fullrectifier circuit of Figure 7.20 A
1 0 . 9 0 . 8 0 . 7 0 . 6 0 . 5
0 . 4
0 . 3
0 . 2
0 . 1
0
0
1 0
1 2
0 . 8
0 . 7
0 . 6
0 . 5
0 . 4
0 . 3
0 . 2
0 . 1
1 0
1 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
721
f ( t ) cos nt dt
sin t cos nt dt
(7.49)
( sin mx ) ( cos nx ) dx
Since we express (7.49) as
A cos ( n 1 ) cos ( n + 1 ) 1 1 = --- ---------------------------- ----------------------------- ----------- ----------- n1 n+1 n+1 n1 A 1 cos ( n + ) cos ( n ) 1 = --- -------------------------------------- + ------------------------------------ n1 n+1
(7.50)
To simplify the last expression in (7.50), we make use of the trigonometric identities
cos ( n + ) = cos n cos sin nsin = cos n
and
cos ( n ) = cos n cos + sin nsin = cos n
(7.51)
722
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(7.52)
From (7.51) we observe that for all n = odd , other than n = 1 , a n = 0 . To obtain the value of a 1 , we must evaluate the integral
1 a 1 = -
0 sin t cos t dt
12 = ----- ( sin ax ) 2a
( sin ax ) ( cos ax ) dx
and thus,
1 2 a 1 = ----- ( sin t ) 2
= 0
0
(7.53)
and so on. Then, combining the terms of (7.52) with (7.54) through (7.57) we obtain
4A cos 2t cos 4t cos 6t cos 8t f ( t ) = 2A ------ ----------------- + ----------------- + ----------------- + ----------------- + ----- 3 15 35 63
(7.58)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
723
(7.59)
This series of (7.59) shows that there is no component of the input (fundamental) frequency. This is because we chose the period to be from and + . Generally, the period is defined as the shortest period of repetition. In any waveform where the period is chosen appropriately, it is very unlikely that a Fourier series will consist of even harmonic terms only.
n = odd
1 -- sin nt n
Figure 7.24 shows the first 11 harmonics and their sum. As we add more and more harmonics, the sum looks more and more like the square waveform. However, the crests do not become flattened; this is known as Gibbs phenomenon and it occurs because of the discontinuity of the perfect square waveform as it changes from +A to A .
Crest (Gibbs Phenomenon)
(7.60)
724
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
cn n an
cos n = sin n
Figure 7.25. Derivation of the alternate form of the trigonometric Fourier series
cos ( nt n )
n=1
1 c n cos ( nt n ) = -- a 0 + 2
n=1
(7.61)
Similarly,
sin 1 cos t + cos 1 sin t 1 f ( t ) = -- a 0 + c 1 2 sin ( t + 1 ) c2 sin ( 2t + 2 ) sin ( nt + n ) sin 2 cos 2t + cos 2 sin 2t + + cn sin n cos nt + cos n sin nt
and, in general, where 1 , we obtain Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
725
cn sin ( nt + n )
n=1
1 = -- a 0 + 2
n=1
an
(7.62)
When used in circuit analysis, (7.61) and (7.62) can be expressed as phasors. Since it is customary to use the cosine function in the time domain to phasor transformation, we choose to use the transformation of (7.63) below.
1 -- a 0 + 2
n=1
n=1
bn c n atan ---an
(7.63)
Example 7.1 Find the first 5 terms of the alternate form of the trigonometric Fourier series for the waveform of Figure 7.26.
f(t)
3 2 1 = 1 t
/2
3/2
Solution: The given waveform has no symmetry; thus, we expect both cosine and sine functions with odd and even terms present. Also, by inspection the DC value is not zero. We will compute the a n and b n coefficients, the DC value, and we will combine them to obtain an expression in the form of (7.63). Then,
1 a n = -
1 ( 3 ) cos nt dt + -
2 0
1 + ----- sin nt n
2 2
(7.64)
726
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(7.65) (7.66)
and
2 a 3 = ----3
The DC value is
1 1 -- a 0 = ----2 2
1 ( 3 ) dt + ----2
2 ( 1 ) dt
1 = ----- ( 3t 2
2 0
+t
2 ) 2
(7.67)
1 ( 3 ) sin nt dt + -
2 0
1 + ----- cos nt n
2 2
3 3 1 1 12= ----- cos n -- + ----- + ----- cos n2 + ----- cos n -- = ----- ( 3 cos n2 ) = ----2 n n n 2 n n n
(7.68)
Then,
b1 = 2 b2 = 1 b 3 = 2 3 b 4 = 1 2
From (7.63),
1 -- a 0 + 2
n=1
where
n=1
cn atan ----na
(7.73)
bn
bn c n atan ---- = an
a n + b n n = a n jb n
(7.74)
Similarly, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
727
(7.75) (7.76)
and
1 1 1 a 4 jb 4 = 0 j ----- = ----- 90 ----- cos ( 4t 90 ) 2 2 2
(7.77)
Combining the terms of (7.67) with (7.74) through (7.77), we find that the alternate form of the trigonometric Fourier series representing the waveform of this example is
3 1 - f ( t ) = -- + -2
[2
2 cos ( t 45 ) + cos ( 2t 90 )
(7.78)
2 2 1 + --------- cos ( 3t 135 ) + -- cos ( 4t 90 ) + 3 2
v in ( t )
vC ( t )
728
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0
A
Solution: In Subsection 7.4.1, Page 711, we found that the waveform of Figure 7.28 can be represented by the trigonometric Fourier series as
1 1 4A f ( t ) = ------ sin t + -- sin 3t + -- sin 5t + 5 3
(7.79)
Since this series is the sum of sinusoids, we will use phasor analysis to obtain the solution. The equivalent phasor circuit is shown in Figure 7.29.
R 1 V in C
VC 1 ----- j
We let n represent the number of terms in the Fourier series. For this example, we are only interested in the first three odd terms, that is, n = 1, 3, and 5 . By the voltage division expression,
1 ( jn ) 1 V C n = ----------------------------- V in n = ------------- V in n 1 + 1 ( jn ) 1 + jn
(7.80)
With reference to (7.79) the phasors of the first 3 odd terms of (7.80) are
4A 4A ----------- sin t = ------ cos ( t 90 ) V in1 = 4A 90 4A -4A 1 ------ 1 sin 3t = 4A 1 cos ( 3t 90 ) V - ------ -- - = ------ -- 90 in3 3 3 3
(7.81) (7.82)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
729
(7.83)
By substitution of (7.81) through (7.83) into (7.80), we obtain the phasor and time domain voltages indicated in (7.84) through (7.86) below.
4A 1 1 4A V C 1 = ---------- ------ 90 = -------------------- ------ 90 1+j 2 45 4A 2 4A 2 = ------ ------ 135 ------ ------ cos ( t 135 ) 2 2 1 - 4A 1 1 - - 4A 1 - V C3 = ------------- ------ -- 90 = --------------------------- ------ -- 90 1 + j3 3 10 71.6 3 4A 10 4A 10 = ------ --------- 161.6 ------ --------- cos ( 3t 161.6 ) 30 30 1 - 4A 1 1 - - 4A 1 - V C5 = ------------- ------ -- 90 = --------------------------- ------ -- 90 1 + j5 5 26 78.7 5 4A 26 4A 26 = ------ --------- 168.7 ------ --------- cos ( 5t 168.7 ) 130 130
(7.84)
(7.85)
(7.86)
(7.87)
Assuming that in the circuit of Figure 7.27 the capacitor is initially discharged, we expect that capacitor voltage will consist of alternating rising and decaying exponentials. Let us plot relation (7.87) using the MATLAB script below assuming that A = 1 .
t=0:pi/64:4*pi; Vc=(4./pi).*((sqrt(2)./2).*cos(t135.*pi./180)+... (sqrt(10)./30).*cos(3.*t161.6.*pi./180)+(sqrt(26)./130).*cos(5.*t168.7.*pi./180)); plot(t,Vc)
730
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Figure 7.32. Input and output waveforms for the model of Figure 7.31
(7.88) (7.89)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
731
(7.90)
(7.91)
+ C 1 e
jt
+ C0 + C1 e
jt
+ C2 e
j2t
(7.95)
We must remember that the C i coefficients, except C 0 , are complex and occur in complex conjugate pairs, that is, C n = C n (7.96) We can derive a general expression for the complex coefficients C n , by multiplying both sides of (7.95) by e
jnt
and integrating over one period, as we did in the derivation of the a n and b n
2 2
f ( t )e
jnt
dt = + + +
C2 e
2
j2t jnt
dt +
2
C1 e e
jt jnt 2
jt jnt
dt
(7.97)
0 0
C0 e C2 e
jnt
dt +
C1 e e
dt
jnt jnt
j2t jnt
dt + +
Cn e
dt
We observe that all the integrals on the right side of (7.96) are zero except the last. Therefore,
732
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0
or
f ( t )e
jnt
dt =
Cn e
jnt jnt
dt =
C n dt = 2C n
1C n = ----2
0
2
f ( t )e
jnt
dt
(7.98)
0 0
T
f ( t )e
jnt
d( t )
(7.99)
or
1 C n = -T f ( t )e
jnt
d( t )
(7.100)
We can derive the trigonometric Fourier series from the exponential series by addition and subtraction of the exponential form coefficients C n and C n . Thus, from (7.92) and (7.93),
1 C n + C n = -- ( a n jb n + a n + jb n ) 2
or
a n = C n + C n
Similarly, or
1 C n C n = -- ( a n jb n a n j b n ) 2 b n = j ( Cn Cn )
(7.104)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
733
(7.105)
Since even functions have no sine terms, the b n coefficients in (7.104) and (7.105) are zero. Therefore, both C n and C n are real.
7.9.4 No Symmetry
If there is no symmetry, f ( t ) is complex. This is evident from Subparagraphs 7.9.1 and 7.9.2, and relations (7.104) and (7.105).
7.9.5 Relation of C n to C n
C n = C n always.
This is evident from (7.104) and (7.105). Example 7.3 Compute the exponential Fourier series for the square waveform of Figure 7.33 below. Assume that = 1 .
734
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Solution: This is the same waveform as in Subsection 7.4.1, Page 711, and as we know, it is an odd function, has halfwave symmetry, and its DC component is zero. Therefore, the C n coefficients will be imaginary, C n = 0 for n = even , and C 0 = 0 . Using (7.99), Page 733, with = 1 , we obtain
1 C n = ----2
f ( t )e
jnt
1 dt = ----2
2
Ae
jnt
1 dt + ----2
A e
jnt
dt
and for n = 0 ,
1 C 0 = ----2
Ae dt +
A 0 ( A )e dt = ----- ( 2 + ) = 0 2
as expected. For n 0 ,
1 C n = ----2
Ae
jnt
dt +
A e
jnt
A jnt + ------- e jn
(7.106)
For n = even , e
jn
= 1 ; then,
2 A - jn A2 = ----------- ( e 1 ) = ----------- ( 1 1 ) = 0 n = even 2jn 2jn
Cn
(7.107)
= 1 . Therefore,
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
735
Cn
(7.108)
+ C1 e
jt
+ C0 + C1 e
jt
+ C2 e
j2t
we obtain the exponential Fourier series for the square waveform with odd symmetry as
2A 1 j3t jt jt 1 f ( t ) = ------ -- e e +e + -- e 3 j 3
j3t
2A = -----j
n = odd
1 -- e n
jnt
(7.109)
The minus () sign of the first two terms within the parentheses results from the fact that C n = C n . For instance, since C 3 = 2A j3 , it follows that C 3 = C 3 = 2A j3 . We observe that f ( t ) is purely imaginary, as expected, since the waveform is an odd function. To prove that (7.109) above and (7.22), Page 712 are the same, we group the two terms inside the parentheses of (7.109) for which n = 1 ; this will produce the fundamental frequency sin t . Then, we group the two terms for which n = 3 , and this will produce the third harmonic sin 3t , and so on.
nt
Figure 7.35 shows the line spectrum for the halfwave rectifier in Subsection 7.4.4, Page 718.
* An instrument that displays the spectral lines of a waveform.
736
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Line Spectra
A/ 2 A/
DC 2 4 6 8
nt
The line spectra of other waveforms can be easily constructed from the Fourier series. Example 7.4 Compute the exponential Fourier series for the waveform of Figure 7.36, and plot its line spectra. Assume = 1 . Solution: This recurrent rectangular pulse is used extensively in digital communications systems. To determine how faithfully such pulses will be transmitted, it is necessary to know the frequency components.
A T
T /
As shown in Figure 7.36, the pulse duration is T k . Thus, the recurrence interval (period) T , is k times the pulse duration. In other words, k is the ratio of the pulse repetition time to the duration of each pulse. For this example, the components of the exponential Fourier series are found from
1 C n = ----2
Ae
jnt
A dt = ----2
k e
jnt
dt
(7.110)
The value of the average ( DC component) is found by letting n = 0 . Then, from (7.110) we obtain
A C 0 = ----- t 2
k k
A - - = ----- -- + -- 2 k k
or Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
737
(7.111)
A- e e An sin ( n k ) = ----- ------------------------------------ = ----- sin ----- = A ------------------------ k n j2 n n A sin ( n k ) C n = --- ------------------------n k k
jn k
jn k
n =
(7.113)
The relation of (7.113) has the sin x x form, and the line spectra are shown in Figures 7.37 through 7.39, for k = 2 , k = 5 and k = 10 respectively by using the MATLAB scripts below.
fplot('sin(2.*x)./(2.*x)',[4 4 0.4 1.2]) fplot('sin(5.*x)./(5.*x)',[4 4 0.4 1.2]) fplot('sin(10.*x)./(10.*x)',[4 4 0.4 1.2])
1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -4 K=2
-3
-2
-1
738
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Line Spectra
1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -4 K=5
-3
-2
-1
-3
-2
-1
The spectral lines are separated by the distance 1 k and thus, as k becomes larger, the lines get closer together while the lines are further apart as k gets smaller. Example 7.5 Use the result of Example 7.4 to compute the exponential Fourier series of the unit impulse train A ( t 2n ) shown in Figure 7.40. Solution: From relation (7.112), Page 738, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
739
...
... t
8 6
Figure 7.40. Impulse train for Example 7.4 A sin ( n k ) C n = --- ------------------------n k k
(7.114)
(7.115)
Next, let us represent the impulse train of Figure 7.40, as a recurrent pulse with amplitude k1 1 A = ---------- = ------------- = ----2 Tk 2 k as shown in Figure 7.41.
1 A = -----------2 k A T
(7.116)
2/ /
2 2 k
(7.117)
and as k 0 , we observe from Figure 7.41, that each recurrent pulse becomes a unit impulse, and the total number of the pulses reduce to a unit impulse train. Moreover, recalling that
x0
sin x 1 lim ---------- = 1 , we see that (7.117) reduces to C n = ----- , that is, all coefficients of the exponential x 2
740
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
n =
jnt
(7.118)
The series of (7.118) reveals that the line spectrum of the impulse train of Figure 7.40, consists of a train of equal amplitude, and are equally spaced harmonics as shown in Figure 7.42.
1 2 ... ...
Since these spectral lines extend from to + , the bandwidth approaches infinity. Let us reconsider the train of recurrent pulses shown in Figure 7.43.
A T
T/ /
Now, let us suppose that the pulses to the left and right of the pulse centered around zero, become less and less frequent; or in other words, the period T approaches infinity. In this case, there is only one pulse left (the one centered around zero). As T , the fundamental frequency approaches zero, that is, 0 as T approaches infinity. Accordingly, the frequency difference between consecutive harmonics becomes smaller. In this case, the lines in the line spectrum come closer together, and the line spectrum becomes a continuous spectrum. This forms the basis of the Fourier transform that we will study in the next chapter.
741
(7.119)
where I 0 represents a constant current, and I 1, I 2, , I N represent the amplitudes of the sinusoids, the RMS value of i is found from
I RMS = I 0 + I 1 RMS + I 2 RMS + + I N RMS
2 2 2 2
(7.120)
or
I RMS = 1 2 1 2 1 2 2 I 0 + -- I + -- I + + -- I 2 1m 2 2m 2 Nm
(7.121)
The proof of (7.120) is based on Parsevals theorem; we will state this theorem in the next chapter. A brief description of the proof of (7.120) follows. We recall that the RMS (effective) value of a function, such as current i ( t ) , is defined as
I RMS = 1 -T
i dt
(7.122)
2 2 Substitution of (7.119) into (7.122), will produce the terms I 0 , I 1m [ cos ( 1 t 1 ) ] 2 , and other similar terms representing higher order harmonics. The result will also contain products of cosine functions multiplied by a constant, or other cosine terms of different harmonic frequencies. But as we know, from the orthogonality principle, the integration of (7.122), will produce all zero terms except the cosine squared terms which, for each harmonic, will be 2T I m -1 2 2 --------- = -- I m 2 T
(7.123)
742
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Then,
1 2 I RMS = -T
1 2 i dt = ----2
1 2 i d( t ) = ----2
1 d( t ) +
2
( 1 ) d( t )
2
1 = ----- [ t 0 + t 2
2 ]
1 = ----- [ 2 ] = 1 2 I RMS = 1
or b. In Subsection 7.4.1, Page 711, we found that the given waveform may be written as
4 1 1 i ( t ) = -- sin t + -- sin 3t + -- sin 5t + 3 5
(7.124)
and as we know, the RMS value of a sinusoid is a real number independent of the frequency and the phase angle, and it is equal to 0.707 times its maximum value, that is, I RMS = 0.707I max . Then, from (7.121) and (7.124),
4 1 1 1 2 1 1 2 2 - - I RMS = -- 0 + -- ( 1 ) + -- -- + -- -- + = 0.97 2 23 25
(7.125)
This is a good approximation to unity, considering that higher harmonics have been neglected.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
743
Chapter 7 Fourier Series 7.12 Computation of Average Power from Fourier Series
We can compute the average power of a Fourier series from the relation
P ave = P dc + P 1ave + P 2ave + = V dc I dc + V 1RMS I 1RMS cos 1 + V 2RMS I 2RMS cos 2 +
(7.126)
1 p dt = -T
0 vi dt
(7.127)
and the expression for the alternate trigonometric Fourier series, that is,
1 f ( t ) = -- a 0 + 2
cn cos ( nt n )
n=1
(7.128)
where f ( t ) can represent voltages and currents. Then, by substitution of these series for v and i into (7.127), we will find that the products of v and i that have different frequencies, will be zero, and only the products of the same frequency terms will have non-zero values. The nonzero values will represent the average power for each harmonic in (7.126). Example 7.7 For the circuit of Figure 7.46, compute:
a. The current i c ( t ) given that v in ( t ) = 6 cos t -- cos 3t V where = 1000 r s . 3 1
iC ( t )
v in ( t )
3 10 ----------- F 3
Solution: a. We will use the subscripts 1 and 3 to represent the quantities due to the fundamental and third harmonic frequencies respectively. Since the excitation consists of two sinusoids of different frequencies, we can use phasor quantities, and we will denote them with capital letters.
744
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(7.129)
Next,
v in3 ( t ) = 2 cos 3t = 2 cos ( 3t + 180 ) V in3 = 2 180 V j j ---------- = ---------------------------------------- = j1 3 3 3 C 3 10 10 3 Z 3 = 1 j1 = 2 45
V in3 2 180 I C3 = ---------- = ----------------------- = 1.41 225 = 1.41 ( 225 135 ) Z3 2 45 i C3 ( t ) = 1.41 cos ( 3t 135 ) A
(7.130)
(7.131)
(7.132)
or Check:
P ave = 0.8 w
(7.133)
The average power absorbed by the capacitor is zero, and therefore, the average power absorbed by the resistor, must be equal to the average power delivered by the source. The average power absorbed by the resistor is
1 2 1 1 2 2 2 2 P ave = -- I max R = -- ( I 1max I 3max ) = -- ( 1.90 1.41 ) = 0.8 w 2 2 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
745
Since the arguments of the sine and the cosine are in radians, we multiply degrees by (3.1459...) and divide by 180 to perform the conversion. We enter these in Column B and we denote them as x . In Column C we enter the corresponding values of y = f ( x ) as measured from the waveform. In Columns D and E we enter the values of cos x and the product y cos x respectively. Similarly, we enter the values of sin x and y sin x in Columns F and G respectively. Next, we form the sums of y cos x and y sin x , we multiply these by x , and we divide by to obtain the coefficients a 1 and b 1 . To compute the coefficients of the higher order harmonics, we
746
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
MATLAB displays the following: Cn = 0 Cn = 1/2 Cn = 0 Cn = 0 The values displayed by MATLAB indicate that C n = 1 2 is the only nonzero frequency component, and since cos t is an even function, all C n coefficients in relation (7.95), Page 732 are real and C n = C n = 1 2 . Therefore,
jt jt 1 jt 1 jt e +e + 0 + -- e + 0 + = -------------------------- = cos t f ( t ) = + 0 + -- e 2 2 2
Also, for the trigonometric Fourier series, from (7.100), Page 733,
a n = C n + C n = 1 + 1 = 1 -- -- 2 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
747
Figure 7.48. Numerical computation of the coefficients of the square waveform (partial listing)
748
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Figure 7.49. Numerical computation of the coefficients of a clipped sine waveform (partial listing)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
749
( a cos nt + b sin nt )
n n
n=1
where the first term a 0 2 is a constant, and represents the DC (average) component of f ( t ) . The terms with the coefficients a 1 and b 1 together, represent the fundamental frequency component . Likewise, the terms with the coefficients a 2 and b 2 together, represent the second harmonic component 2 , and so on. The coefficients a 0 , a n , and b n are found from the following relations:
1 1 -- a 0 = ----2 2 1 a n = -
f ( t ) dt
f ( t ) cos nt dt
1 b n = -
f ( t ) sin nt dt
If a waveform has odd symmetry, that is, if it is an odd function, the series will consist of sine terms only. We recall that odd functions are those for which f ( t ) = f ( t ) . If a waveform has even symmetry, that is, if it is an even function, the series will consist of cosine terms only, and a 0 may or may not be zero. We recall that even functions are those for
which f ( t ) = f ( t )
A periodic waveform with period T , has halfwave symmetry if f ( t + T 2 ) = f ( t )
that is, the shape of the negative halfcycle of the waveform is the same as that of the positive half-cycle, but inverted. If a waveform has halfwave symmetry only odd (odd cosine and odd sine) harmonics will be present. In other words, all even (even cosine and even sine) harmonics will be zero.
The trigonometric Fourier series for the square waveform with odd symmetry is 4A 1 1 4A f ( t ) = ------ sin t + -- sin 3t + -- sin 5t + = ----- 3 5
n = odd
1 -- sin nt n
750
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
The trigonometric Fourier series for the square waveform with even symmetry is 4A 1 4A 1 f ( t ) = ------ cos t -- cos 3t + -- cos 5t = ----- 5 3
n = odd
( 1 )
(n 1) ---------------2 1
-- cos n t n
The trigonometric Fourier series for the sawtooth waveform with odd symmetry is 2A 1 1 1 2A f ( t ) = ------ sin t -- sin 2t + -- sin 3t -- sin 4t + = ----- 2 3 4
( 1 )
n1
1 -- sin nt n
The trigonometric Fourier series for the triangular waveform with odd symmetry is 8A 1 1 8A 1 f ( t ) = ------ sin t -- sin 3t + ----- sin 5t ----- sin 7t + = -----( 1 ) 2 2 49 25 9 n = odd
(n 1) ---------------2
1 ---- sin n t 2 n
The trigonometric Fourier series for the halfwave rectifier with no symmetry is A A cos 2t cos 4t cos 6t cos 8t f ( t ) = A + --- sin t --- ------------- + ------------- + ------------- + ------------- + --- 3 15 35 63 2 The trigonometric form of the Fourier series for the fullwave rectifier with even symmetry is 2A 4A f ( t ) = ------ ----- 1 ------------------ cos nt 2 (n 1) n = 2, 4, 6,
+ C 1 e
jt
+ C0 + C1 e
jt
+ C2 e
j2t
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
751
f ( t )e
jnt
1d( t ) = ----2
f ( t )e
jnt
d( t )
We can derive the trigonometric Fourier series from the exponential series from the relations an = Cn + Cn
and
bn = j ( Cn Cn ) For even functions, all coefficients C i are real For odd functions, all coefficients C i are imaginary If there is halfwave symmetry, C n = 0 for n = even C n = C n always A line spectrum is a plot that shows the amplitudes of the harmonics on a frequency scale. The frequency components of a recurrent rectangular pulse follow a sin x x form. he line spectrum of an impulse train consists of a train of equal amplitude, and are equally
spaced harmonics.
he RMS value of a waveform consisting of sinusoids of different frequencies, is equal to the square root of the sum of the squares of the RMS values of each sinusoid. Thus, I RMS = I 0 + I 1 RMS + I 2 RMS + + I N RMS
2 2 2 2
or
I RMS = 1 2 1 2 1 2 2 I 0 + -- I + -- I + + -- I 2 1m 2 2m 2 Nm
We can compute the average power of a Fourier series from the relation P ave = P dc + P 1ave + P 2ave + = V dc I dc + V 1RMS I 1RMS cos 1 + V 2RMS I 2RMS cos 2 + We can evaluate the Fourier coefficients of a function based on observed values instead of an
752
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
2. Compute the first 5 components of the trigonometric Fourier series for the waveform shown below. Assume = 1 .
f(t)
A t 0
3. Compute the first 5 components of the exponential Fourier series for the waveform shown below. Assume = 1 .
f(t)
A
4.Compute the first 5 components of the exponential Fourier series for the waveform shown below. Assume = 1 .
f( t)
A2
0
A 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
753
6. Compute the first 5 components of the exponential Fourier series for the waveform shown below. Assume = 1 .
f(t)
A t
0 A
754
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
This is an even function; therefore, the series consists of cosine terms only. There is no half wave symmetry and the average ( DC component) is not zero. We will integrate from 0 to and multiply by 2 . Then,
2 a n = -
0 t cos nt dt
(1)
x cos ax dx
and thus (1) becomes
t 2A 1 - a n = ------ ---- cos nt + -- sin nt 2 2 n n
We cannot evaluate the average ( 1 2 )a 0 from (2); we must use (1). Then, for n = 0 ,
2A 1 -- a 0 = -------2 2 2
A t - t dt = ---- --2 2
A - = ---- ---2 2
or
( 1 2 ) a0 = A 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
755
n = odd
1---- cos nt 2 n
2.
f(t) A 2A ------ t 2 3 2
This is an even function; therefore, the series consists of cosine terms only. There is no half wave symmetry and the average ( DC component) is not zero.
1 3A 3A ( 2 ) 2 [ ( A 2 ) ( 2 ) ] + A Area Average = -- a 0 = ---------------- = --------------------------------------------------------------- = -------------------------- = -----2 4 2 2 Period 2 a n = -
2A 2 ------ t cos nt dt + -
2 A cos nt dt
(1)
and with
x cos ax dx
2A + ------ sin nt n
We observe that the fourth harmonic and all its multiples are zero. Therefore,
756
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
3.
f(t)
A
This is neither an even nor an odd function and has no halfwave symmetry; therefore, the series consists of both cosine and sine terms. The average ( DC component) is not zero. Then,
1 C n = ----2
f ( t )e
jnt
d( t )
and with = 1
1 C n = ----2
f ( t )e
jnt
1 dt = ----2
Ae
jnt
dt +
0e
jnt
A dt = ----2
0 e
jnt
dt
The DC value is
A C 0 = ----2
A 0 e dt = ----- t 2
0
= A --2
For n 0 ,
A C n = ----2
jnt
A jnt dt = -------------- e j2 n
A jn = ----------- ( 1 e ) j2n
Recalling that
e
jn
= cos n j sin n
jn
for n = even , e
jn
= 1 . Then,
and
A A C n = odd = ----------- [ 1 ( 1 ) ] = ------j2n jn
By substitution into
f ( t ) = + C 2 e
j2t
+ C 1 e
jt
+ C0 + C1 e
jt
+ C2 e
j2t
we find that Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
757
The minus () sign of the first two terms within the parentheses results from the fact that C n = C n . For instance, since C 1 = 2A j , it follows that C 1 = C 1 = 2A j . We observe that f ( t ) is complex, as expected, since there is no symmetry. 4.
f(t)
A2
0
A 2
This is the same waveform as in Exercise 3 where the DC component has been removed. Then,
1 j3t jt A jt 1 j3t f ( t ) = ---- -- e e + e + -- e + 3 j 3
It is also the same waveform as in Example 7.3, Page 734, except that the amplitude is halved. This waveform is an odd function and thus the expression for f ( t ) is imaginary. 5.
f( t)
A
0 2
This is the same waveform as in Exercise 3 where the vertical axis has been shifted to make the waveform an even function. Therefore, for this waveform C n is real. Then,
1C n = ----2
f ( t )e
jnt
Adt = ----2
2 e
jnt
dt
The DC value is
AC 0 = ----- t 2
2 2
A- A = ----- -- + -- = --- 2 2 2 2
For n 0 ,
758
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
jnt
A - jnt dt = -------------- e j2 n
2 2
A - jn 2 jn 2 = -------------- ( e e ) j2 n
jn 2
jn 2
and we observe that for n = even , C n = 0 For n = odd , C n alternates in plus (+) and minus () signs, that is,
AC n = ----- if n = 1, 5, 9, n A C n = ----- if n = 3, 7, 11, n
Thus,
A f ( t ) = --- + 2
n = odd
A ----- e jnt n
where the plus (+) sign is used with n = 1, 5, 9, and the minus () sign is used with n = 3, 7, 11, . We can express f ( t ) in a more compact form as
A f ( t ) = --- + 2
n = odd
( 1 )
(n 1) 2
A----- e jnt n
6.
f(t) 2 A
2A ------ t 1 2
t
f ( t )e
ax
jnt
dt
Then,
e xe dx = ------ ( ax 1 ) 2 a
ax
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
759
2A t 1 e jnt dt + -----
0 ------- t 1 e
2A
jnt
dt
j3t
and e
jt
real. This is to be expected since f ( t ) is an even function. It also has halfwave symmetry and thus C n = 0 for n = even as weve found.
760
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 8
The Fourier Transform
his chapter introduces the Fourier Transform, also known as the Fourier Integral. The definition, theorems, and properties are presented and proved. The Fourier transforms of the most common functions are derived, the system function is defined, and several examples are provided to illustrate its application in circuit analysis.
f ( t )e
jt
dt
(8.1)
and assuming that it exists for every value of the radian frequency , we call the function F ( ) the Fourier transform or the Fourier integral. The Fourier transform is, in general, a complex function. We can express it as the sum of its real and imaginary components, or in exponential form, that is, as
F ( ) = Re { F ( ) } + jIm { F ( ) } = F ( ) e
j ( )
(8.2)
F ( )e
jt
(8.3)
We will often use the following notation to express the Fourier transform and its inverse. and
F F
{f(t)} = F()
1
(8.4) (8.5)
{ F( )} = f( t)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
81
Chapter 8 The Fourier Transform 8.2 Special Forms of the Fourier Transform
The time function f ( t ) is, in general, complex, and thus we can express it as the sum of its real and imaginary parts, that is, as
f ( t ) = f Re ( t ) + j f Im ( t )
(8.6)
The subscripts Re and Im will be used often to denote the real and imaginary parts respectively. These notations have the same meaning as Re { f ( t ) } and Im { f ( t ) } . By substitution of (8.6) into the Fourier integral of (8.1), we obtain
F( ) =
f Re ( t )e
jt
dt + j
fIm ( t )e
jt
dt
(8.7)
[ f Re ( t ) cos t + f Im ( t ) sin t ] dt j
(8.8)
From (8.8), we see that the real and imaginary parts of F ( ) are
F Re ( ) =
(8.9)
and
F Im ( ) =
(8.10)
We can derive similar forms for the Inverse Fourier transform as follows: Substitution of (8.2) into (8.3) yields
1f ( t ) = ----2
[ FRe ( ) + jFIm ( ) ]e
jt
(8.11)
[ FRe ( ) cos t FIm ( ) sin t ] d [ FRe ( ) sin t + FIm ( ) cos t ] d [ FRe ( ) cos t FIm ( ) sin t ] d
(8.12)
1+ j ----2
Therefore, the real and imaginary parts of f ( t ) in terms of the Inverse Fourier transform are
1f Re ( t ) = ----2
(8.13)
and
8 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(8.14)
Now, we will use the above relations to derive the time to frequency domain correspondence for real, imaginary, even, and odd functions in both the time and the frequency domains. We will show these in tabular form, as indicated in Table 8.1. The derivations are shown in Subsections 8.2.1 and 8.2.2.
TABLE 8.1 Time Domain and Frequency Domain Correspondence (Refer to Tables 8.2 8.7) f(t) Real Real Real and Even Real and Odd Imaginary Imaginary and Even Imaginary and Odd Imaginary F( ) Complex Even Odd
(8.15)
and
F Im ( ) =
(8.16)
Conclusion: If f ( t ) is real, F ( ) is, in general, complex. We indicate this result with a check mark in Table 8.2. We know that any function f ( t ) can be expressed as the sum of an even and an odd function. Therefore, we will also consider the cases when f ( t ) is real and even, and when f ( t ) is real and odd*. * In our subsequent discussion, we will make use of the fact that the cosine is an even function, while the sine is an odd function. Also, the product of two odd functions or the product of two even functions will result in an even function, whereas the product of an odd function and an even function will result in an odd function.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
83
a. f Re ( t ) is even If f Re ( t ) = f Re ( t ) , the product f Re ( t ) cos t , with respect to t , is even, while the product
f Re ( t ) sin t is odd. In this case, (8.15) and (8.16) reduce to: F Re ( ) = 2
f Re ( t ) cos t dt
f Re ( t ) = even
(8.17)
and
F Im ( ) =
fRe ( t ) sin t dt
= 0
f Re ( t ) = even
(8.18)
Therefore, if f Re ( t ) = even , F ( ) is real as seen in (8.17). To determine whether F ( ) is even or odd when f Re ( t ) = even , we must perform a test for evenness or oddness with respect to . Thus, substitution of for in (8.17), yields
F Re ( ) = 2
f Re ( t ) cos ( )t dt = 2
f Re ( t ) cos t dt = F Re ( )
(8.19)
Conclusion: If f ( t ) is real and even, F ( ) is also real and even. We indicate this result in Table 8.3. b. fRe ( t ) is odd If f Re ( t ) = f Re ( t ) , the product f Re ( t ) cos t , with respect to t , is odd, while the product
f Re ( t ) sin t is even. In this case, (8.15) and (8.16) reduce to:
8 4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
F Re ( ) =
fRe ( t ) cos t dt 0
= 0
f Re ( t ) = odd
(8.20)
and
F Im ( ) = 2
f Re ( t ) sin t dt
f Re ( t ) = odd
(8.21)
Therefore, if f Re ( t ) = odd , F ( ) is imaginary. To determine whether F ( ) is even or odd when f Re ( t ) = odd , we perform a test for evenness or oddness with respect to . Thus, substitution of for in (8.21), yields
F Im ( ) = 2
f Re ( t ) sin ( )t dt = 2
f Re ( t ) sin t dt = F Im ( )
(8.22)
Conclusion: If f ( t ) is real and odd, F ( ) is imaginary and odd. We indicate this result in Table 8.4.
TABLE 8.4 Time Domain and Frequency Domain Correspondence (Refer also to Tables 8.5 8.7) f(t) Real Real Real and Even Real and Odd Imaginary Imaginary and Even Imaginary and Odd Imaginary F( ) Complex Even Odd
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
85
(8.23)
and
F Im ( ) =
(8.24)
Conclusion: If f ( t ) is imaginary, F ( ) is, in general, complex. We indicate this result in Table 8.5.
TABLE 8.5 Time Domain and Frequency Domain Correspondence (Refer also to Tables 8.6 8.7) f(t) Real Real Real and Even Real and Odd Imaginary Imaginary and Even Imaginary and Odd Imaginary F( ) Complex Even Odd
Next, we will consider the cases where f ( t ) is imaginary and even, and f ( t ) is imaginary and odd. a. f Im ( t ) is even If f Im ( t ) = f Im ( t ) , the product f Im ( t ) cos t , with respect to t , is even while the product
f Im ( t ) sin t is odd. In this case, (8.23) and (8.24) reduce to: F Re ( ) =
fIm ( t ) sin t dt 0
= 0
f Im ( t ) = even
(8.25)
and
F Im ( ) = 2 f Im ( t ) cos t dt f Im ( t ) = even
(8.26)
Therefore, if f Im ( t ) = even , F ( ) is imaginary. To determine whether F ( ) is even or odd when f Im ( t ) = even , we perform a test for evenness or oddness with respect to . Thus, substitution of for in (8.26) yields
8 6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
f Im ( t ) cos ( )t dt = 2
f Im ( t ) cos t dt = F Im ( )
(8.27)
Conclusion: If f ( t ) is imaginary and even, F ( ) is also imaginary and even. We indicate this result in Table 8.6.
TABLE 8.6 Time Domain and Frequency Domain Correspondence (Refer also to Table 8.7) f(t) Real Real Real and Even Real and Odd Imaginary Imaginary and Even Imaginary and Odd Imaginary F( ) Complex Even Odd
b. f Im ( t ) is odd If f Im ( t ) = f Im ( t ) , the product f Im ( t ) cos t , with respect to t , is odd, while the product
f Im ( t ) sin t is even. In this case, (8.23) and (8.24) reduce to F Re ( ) =
f Im ( t ) sin t dt = 2
f Im ( t ) sin t dt
f Im ( t ) = odd
(8.28)
and
F Im ( ) =
fIm ( t ) cos t dt
= 0
f Im ( t ) = odd
(8.29)
Therefore, if f Im ( t ) = odd , F ( ) is real. To determine whether F ( ) is even or odd when f Im ( t ) = odd , we perform a test for evenness or oddness with respect to . Thus, substitution of for in (8.28) yields
F Re ( ) = 2
f Im ( t ) sin ( )t dt = 2
f Im ( t ) sin t dt = F Re ( )
(8.30)
Conclusion: If f ( t ) is imaginary and odd, F ( ) is real and odd. We indicate this result in Table 8.7.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
87
Table 8.7 is now complete and shows that if f ( t ) is real (even or odd), the real part of F ( ) is even, and the imaginary part is odd. Then,
F Re ( ) = F Re ( ) f ( t ) = Real f ( t ) = Real
and
F Im ( ) = F Im ( )
Since,
F ( ) = F Re ( ) + jF Im ( )
it follows that
F ( ) = F Re ( ) + jF Im ( ) = F Re ( ) jF Im ( )
or
F ( ) = F ( ) f ( t ) = Real
(8.34)
Now, if F ( ) of some function of time f ( t ) is known, and F ( ) is such that F ( ) = F ( ) , can we conclude that f ( t ) is real? The answer is yes; we can verify this with (8.14), Page 83, which is repeated here for convenience.
1f Im ( t ) = ----2
(8.35)
We observe that the integrand of (8.35) is zero since it is an odd function with respect to because both products inside the brackets are odd functions*. Therefore, f Im ( t ) = 0 , that is, f ( t ) is real.
* In relations (8.31) and (8.32) above, we determined that F Re ( ) is even and F Im ( ) is odd.
8 8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(8.36)
and since the integrand is an even function with respect to , we rewrite (8.36) as
1 f Re ( t ) = 2 ----2 1 = -
[ F Re ( ) cos t F Im ( ) sin t ] d
1 A ( ) cos [ t + ( ) ] d = -- Re
(8.37)
F ( )e
j [ t + ( ) ]
8.3.1 Linearity
If F 1 ( ) is the Fourier transform of f 1 ( t ) , F 2 ( ) is the transform of f 2 ( t ) , and so on, the linearity property of the Fourier transform states that
a1 f1 ( t ) + a2 f2 ( t ) + + an fn ( t ) a1 F1 ( ) + a2 F2 ( ) + + an Fn ( )
(8.38)
where a i is some arbitrary real constant. Proof: The proof is easily obtained from (8.1), Page 81, that is, the definition of the Fourier transform. The procedure is the same as for the linearity property of the Laplace transform in Chapter 2.
8.3.2 Symmetry
If F ( ) is the Fourier transform of f ( t ) , the symmetry property of the Fourier transform states that
F ( t ) 2f ( )
(8.39)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
89
F ( )e F ( )e
jt
then,
2f ( t ) =
j t
F ( t )e
j t
dt
(8.40)
that is, the time scaling property of the Fourier transform states that if we replace the variable t in the time domain by at , we must replace the variable in the frequency domain by a , and divide F ( a ) by the absolute value of a . Proof: We must consider both cases a > 0 and a < 0 . For a > 0 ,
F { f ( at ) }
f ( at )e
jt
dt
(8.41)
F {f()}
For a < 0 ,
f ( )e
j - a
1 d - = -a a
f ( )e
jt
j --- a
1 d = -- F --- a a
F { f ( at ) }
810
f ( at )e
dt
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(8.42)
that is, the time shifting property of the Fourier transform states that if we shift the time function f ( t ) by a constant t 0 , the Fourier transform magnitude does not change, but the term t 0 is added to its phase angle. Proof:
F { f ( t t0 ) }
f ( t t )e
0
jt
dt
F { f ( t t0 ) }
or
f ( )e
j ( + t 0 )
d = e
jt 0
f ( )e
j ( )
F { f ( t t0 ) }
8.3.5 Frequency Shifting
If F ( ) is the Fourier transform of f ( t ) , then,
e
j 0 t
= e
jt 0
F()
f ( t ) F ( 0 )
j 0 t
(8.43)
that is, multiplication of the time function f ( t ) by e the Fourier transform by 0 . Proof:
F {e
or
0
j 0 t
f(t)} =
j 0 t
f ( t )e
jt
dt
F { e j t f ( t ) }
Also, from (8.40) and (8.43)
f ( t )e
j ( 0 )
dt = F ( 0 )
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
811
0 1 f ( at ) ---- F --------------- a a
(8.44)
The Frequency Shifting Property, that is, (8.43) is also used to derive the Fourier transform of the modulated signals f ( t ) cos t and f ( t ) sin t . Thus, from
e
j 0 t
f ( t ) F ( 0 )
j 0 t j 0 t
and we obtain
e +e cos 0 t = -----------------------------2
F ( 0 ) + F ( + 0 ) f ( t ) cos 0 t --------------------------------------------------------2
(8.45)
Similarly,
F ( 0 ) F ( + 0 ) f ( t ) sin 0 t ------------------------------------------------------j2
(8.46)
(8.47)
F ( )e
n
jt
1 d = ---- 2
d - jt F ( ) ------- e d n dt
F ( ) ( j ) e
jt
n 1 d = ( j ) ---- 2
F ( )e
jt
812
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(8.48)
f ( t )e
j t
dt =
d j t dt f ( t ) --------- e n d
n
f ( t ) ( j t ) e
n j t
dt = ( j t )
f ( t )e
j t
dt
f ( ) d ------------ + F ( 0 ) ( ) j
Proof:
F( )
(8.49)
We postpone the proof of this property until we derive the Fourier transform of the Unit Step Function u 0 ( t ) in Subsection 8.4.6, Page 822, and the proof for the Time Integration Property, Page 823. In the special case where in (8.49) F ( 0 ) = 0 , then,
F()
f ( ) d -----------j
(8.50)
and this is easily proved by integrating both sides of the Inverse Fourier transform.
(8.51)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
813
f ( t )e
jt
dt =
jt
dt
f Re ( t )e
jt
dt + j
dt
Then,
F ( ) =
f Re ( t )e
jt
dt j
fIm ( t )e
j t
jt
dt
[ fRe ( t ) jfIm ( t ) ]e
dt
(8.52)
that is, convolution in the time domain, corresponds to multiplication in the frequency domain. Proof:
F { f1 ( t ) f2 ( t ) }
= =
f ( )f2 ( t ) d
1
jt
dt
f ( ) f ( t )e
1 2
(8.53)
dt d
jt
F { f1 ( t ) f2 ( t ) }
Alternate Proof:
f1 ( )
f 2 ( )e
j j
d d =
f 1 ( )e
f ( )e
2
The first integral above is F 1 ( ) while the second is F 2 ( ) , and thus (8.52) follows.
We can apply the time shifting property f ( t t 0 ) F ( )e (8.53); then, replacing it with F 2 ( )e
jt 0
jt 0
, we obtain
814
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
F { f1 ( t ) f2 ( t ) }
= =
f1 ( )
f 2 ( t )e
jt
dt d =
f 1 ( ) dF 2 ( )e
jt 0
f ( )e
1
jt
dF 2 ( ) = F 1 ( )F 2 ( )
(8.54)
that is, multiplication in the time domain, corresponds to convolution in the frequency domain divided by the constant 1 2 . Proof:
F { f1 ( t )f2 ( t ) }
[ f 1 ( t ) f 2 ( t ) ]e
jt
dt =
1 ----2
F ( )e
1
jt
d f 2 ( t )e
jt
dt
1= ----2
F1 ( )
f 2 ( t )e
j ( )t
1dt d = ----2
F ( )F ( ) d
1 2
f ( t ) d t
(8.55)
that is, the area under a time function f ( t ) is equal to the value of its Fourier transform evaluated at = 0 . Proof: Using the definition of F ( ) and that e
jt =0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
815
F ( ) d
(8.56)
that is, the value of the time function f ( t ) , evaluated at t = 0 , is equal to the area under its Fourier transform F ( ) times 1 2 . Proof: In the Inverse Fourier transform of (8.3), we let e
jt t=0
12 f ( t ) dt = ----2
F ( )
(8.57)
that is, if the time function f ( t ) represents the voltage across, or the current through an 1 resistor, the instantaneous power absorbed by this resistor is either v 2 R , v 2 1 , v 2 , or i 2 R , i 2 . Then, the integral of the magnitude squared, represents the energy (in watt-seconds or joules) dissipated by the resistor. For this reason, the integral is called the energy of the signal. Relation (8.57) then, states that if we do not know the energy of a time function f ( t ) , but we know the Fourier transform of this function, we can compute the energy without the need to evaluate the Inverse Fourier transform. Proof: From the frequency convolution property,
1 f 1 ( t )f 2 ( t ) ----- F 1 ( ) F 2 ( ) 2
or
F { f1 ( t )f2 ( t ) }
[ f 1 ( t )f 2 ( t ) ]e
jt
1 dt = ----2
F ( )F ( ) d
1 2
(8.58)
Since (8.58) must hold for all values of , it must also be true for = 0 , and under this condition, it reduces to
1 [ f 1 ( t )f 2 ( t ) ] dt = ----2
F ( )F ( ) d
1 2
(8.59)
For the special case where f 2 ( t ) = f 1 ( t ) , and the conjugate functions property f ( t ) F ( ) , by substitution into (8.59), we obtain:
816
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1 [ f ( t )f ( t ) ] dt = ----2
2
1 F ( )F [ ( ) ] d = ----2
2
F ( )F ( ) d
Since f ( t )f ( t ) = f ( t )
For convenience, the Fourier transform properties and theorems are summarized in Table 8.8.
TABLE 8.8 Fourier Transform Properties and Theorems Property Linearity Symmetry Time Scaling Time Shifting Frequency Shifting Time Differentiation
F(t) f ( at ) f ( t t0 )
f(t)
a1 f1 ( t ) + a2 f2 ( t ) + 2f ( ) 1 ---- F --- a a F ( )e
F( )
a1 F1 ( ) + a2 F2 ( ) +
jt 0
j 0 t
f(t)
F ( 0 ) n ( j ) F ( )
n d -------- f ( t ) n dt n ( jt ) f ( t )
Frequency Differentiation
n d ---------- F ( ) n d F( ) ----------- + F ( 0 ) ( ) j F ( )
Time Integration Conjugate Functions Time Convolution Frequency Convolution Area under f ( t ) Area under F ( ) Parsevals Theorem
f ( ) d
f ( t ) f 1 ( t ) f 2 ( t ) f1 ( t ) f2 ( t )
F1 ( ) F2 ( )
1 ----- F 1 ( ) F 2 ( ) 2
F(0) =
f ( t ) dt
1 f ( 0 ) = ----F ( ) d 2
2 2 1 F ( ) d f ( t ) dt = ----2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
817
Chapter 8 The Fourier Transform 8.4 Fourier Transform Pairs of Common Functions
The Fourier transform pair of the most common functions described in Subsections 8.4.1 through 8.4.9 below.
(8.60)
f ( t ) ( t t ) dt
0
= f ( t0 )
f ( t ) ( t ) dt
By the definition of the Fourier transform
F( ) =
= f(0)
( t )e
jt
dt = e
jt t=0
= 1
and (8.60) follows. Likewise, the Fourier transform for the shifted delta function ( t t 0 ) is
( t t0 ) e
jt 0
(8.61)
We will use the notation f ( t ) F ( ) to show the time domain to frequency domain correspondence. Thus, (8.60) may also be denoted as in Figure 8.1.
f(t) (t) 0 F() 1
(8.62)
818
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1 { 2A ( ) } = ----2
2A ( )e
jt
d = A
( )e
jt
d = Ae
jt =0
= A
Also, by direct application of the Inverse Fourier transform, or the frequency shifting property and (8.62), we derive the transform
e
j 0 t
2 ( 0 )
(8.63)
The transform pairs of (8.62) and (8.63) can also be derived from (8.60) and (8.61) by using the symmetry property F ( t ) 2f ( )
(8.64)
Proof: This transform pair follows directly from (8.63). The f ( t ) F ( ) correspondence is also shown in Figure 8.3.
cos 0 t t t 0 0 F Re ( ) 0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
819
(8.65)
Proof: This transform pair also follows directly from (8.63). The f ( t ) F ( ) correspondence is also shown in Figure 8.4.
sin 0 t tt 0 0 Figure 8.4. The Fourier transform of f ( t ) = sin 0 t 0 F Im ( )
We know that sin 0 t is real and odd function of time, and we found out that its Fourier transform is an imaginary and odd function of frequency. This is consistent with the result in Table 8.7.
(8.66)
t
1
820
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
at
u0 ( t )
0
at
u0 ( t )
Then,
sgn ( t ) = lim [ e
a0 at
u0 ( t ) e u0 ( t ) ]
at
(8.67)
and
F { sgn ( t ) }
a0
e e e
at j t
dt +
0 0
e e
a t j t
dt dt
( a j )t
a0
dt +
( a + j ) t
(8.68)
a0
t
0 1
We now know that sgn ( t ) is real and odd function of time, and we found out that its Fourier transform is an imaginary and odd function of frequency. This is consistent with the result in Table 8.7.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
821
Chapter 8 The Fourier Transform 8.4.6 The Unit Step Function Pair
1 u 0 ( t ) ( ) + ----j
(8.69)
Proof: If we attempt to verify the transform pair of (8.69) by direct application of the Fourier transform definition, we will find that
F( ) =
f ( t )e
jt
dt = F ( ) =
jt
e dt = --------- j
jt
jt
(8.70)
0
jt
approaches 0 as t , because e
tude of e is always unity, and its angle changes continuously as t assumes greater and greater values. Since the upper limit cannot be evaluated, the integral of (8.70) does not converge. To work around this problem, we will make use of the sgn ( t ) function which we express as
sgn ( t ) = 2u0 ( t ) 1
(8.71)
This expression is derived from the waveform of Figure 8.8 below. f(t)
2
t
1
We rewrite (8.71) as
1 1 1 - u 0 ( t ) = -- [ 1 + sgn ( t ) ] = -- + -- sgn ( t ) 2 2 2
(8.72)
and since we know that 1 2 ( ) and sgn ( t ) 2 ( j ) , by substitution of these into (8.72) we obtain
1u 0 ( t ) ( ) + ----j
and this is the same as(8.69). This is a complex function in the frequency domain whose real part is ( ) and imaginary part 1 .
822
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
F Im ( ) t
F Re ( ) F Im ( )
Since u 0 ( t ) is real but neither even nor odd function of time, its Fourier transform is a complex function of frequency as shown in (8.69). This is consistent with the result in Table 8.7. Now, we will prove the time integration property of (8.49), Page 813, that is,
f ( ) d ------------ + F ( 0 ) ( ) j
as follows: By the convolution integral,
u 0 ( t ) f ( t ) =
F( )
f ( )u ( t ) d
0
and since u 0 ( t ) = 1 for t > , and it is zero otherwise, the above integral reduces to
u 0 ( t ) f ( t ) =
f ( ) d
and since
1U 0 ( ) = ( ) + ----j
using these results and the sampling property of the delta function, we obtain
F() 1 F() U 0 ( ) F ( ) = ( ) + ----- F ( ) = = ( )F ( ) + ----------- = F ( 0 ) ( ) + ---------- j j j
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
823
1 u 0 ( t ) ( 0 ) + ---------------------j ( 0 )
(8.73)
f ( t ) F ( 0 )
we obtain (8.73).
(8.74)
From (8.73),
e
j 0 t
1 u 0 ( t ) ( 0 ) + ---------------------j ( 0 )
and
e
j 0 t
1 u 0 ( t ) ( + 0 ) + ---------------------j ( + 0 ) 1 u 0 ( t ) ( ) + ----j
824
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Derivation of the Fourier Transform from the Laplace Transform 8.4.9 The ( sin 0 t )u 0 ( t ) Function Pair
2 ( sin 0 t ) ( u 0 t ) ---- [ ( 0 ) + ( + 0 ) ] + ----------------2 2 j2 0
(8.75)
From (8.73),
e
j 0 t
1 u 0 ( t ) ( 0 ) + ---------------------j ( 0 )
and
e
j 0 t
1 u 0 ( t ) ( + 0 ) + ---------------------j ( + 0 ) 1u 0 ( t ) ( ) + ----j
1 u 0 ( t ) ] = ----------- . Compute s+
F { et u0 ( t ) }
1 = ----------s+ 1 = --------------j +
F { et u0 ( t ) }
= L [e
u0 ( t ) ]
s = j
s = j
1 u 0 ( t ) --------------j +
(8.76)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
825
s+ cos 0 t )u 0 ( t ) ] = ------------------------------2 2 ( s + ) + 0
Compute Solution:
cos 0 t )u 0 ( t ) ]
s = j
s+ = ------------------------------2 2 ( s + ) + 0
s = j
j + = ----------------------------------2 2 ( j + ) + 0
j + cos 0 t )u 0 ( t ) ----------------------------------2 2 ( j + ) + 0
(8.77)
We can also find the Fourier transform of a time function f ( t ) that has nonzero values for t < 0 , and it is zero for all t > 0 . But because the onesided Laplace transform does not exist for t < 0 , we must first express the negative time function in the t > 0 domain, and compute the onesided Laplace transform. Then, the Fourier transform of f ( t ) can be found by substituting s with j . In other words, when f ( t ) = 0 for t 0 , and f ( t ) 0 for t < 0 , we use the substitution
F { f(t) }
Example 8.3
= L [ f ( t ) ]
s = j
(8.78)
a t
b. by substitution into the Laplace transform equivalent Solution: a. Using the Fourier transform definition, we obtain
826
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
F { ea t }
e e
at jt
dt +
a t jt
dt =
( a j )t
dt +
0 e
( a + j ) t
dt
2 ----------------2 2 +a
(8.79)
F { e a t }
= L [e
at
s = j
+ L [e ]
at
s = j
1 = ---------s+a
1 + ---------s+a s = j
s = j
and this result is the same as (8.79). We observe that since f ( t ) is real and even, F ( ) is also real and even.
(8.80)
t
T
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
827
f ( t )e
T
jt
dt =
T Ae
jt
Ae dt = -------------- j
jt T T
Ae = --------------j
jt T
We observe that the transform of this pulse has the sin x x form, and has its maximum value 2AT at T = 0 .* Thus, we have the waveform pair
sin T A [ u 0 ( t + T ) u 0 ( t T ) ] 2AT --------------T
(8.81)
The f ( t ) F ( ) correspondence is also shown in Figure 8.11, where we observe that the axis crossings occur at values of T = n where n is an integer.
F() f(t)
A
0 2 T
t
T
We also observe that since f ( t ) is real and even, F ( ) is also real and even.
(8.82)
t
2T
828
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
f ( t )e
jt
dt =
2T
Ae
jt
Ae dt = -------------- j
jt 2T 0
Ae = --------------j
jt 0 2T
A(1 e ) = --------------------------------j
j2T
jT jT
= e
j T
(8.83)
we obtain
e sin T Ae - e jT sin T --------------- = 2ATe jT --------------- F ( ) = ---------------- ---------------------------- = 2Ae T j
jT jT jT
(8.84)
Alternate Derivation: We can obtain the Fourier transform of (8.82) using the time shifting property, i.e,
f ( t t 0 ) F ( )e
jt 0
sin T T
jT
, we obtain (8.84).
(8.85)
t
2T
We observe that this waveform is the sum of the waveforms of Subsections 8.6.1 and 8.6.2. We also observe that this waveform is obtained by the graphical addition of the waveforms of Figures
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
829
+e
T j ------- 2
sin T -------------- T
(8.86)
= 4ATe
We observe that F ( ) is complex since f ( t ) of (8.85) is neither an even nor an odd function.
(8.87)
Then,
sin [ ( 0 )T ] sin [ ( + 0 )T ] A cos 0 t [ u 0 ( t + T ) u 0 ( t T ) ] AT ------------------------------------- + ------------------------------------( 0 )T ( + 0 )T
(8.88)
We also observe that since f ( t ) is real and even, F ( ) is also real and even.*
830
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Fourier Transforms of Common Waveforms 8.6.5 The Transform of a Periodic Time Function with Period T
The Fourier transform of a periodic time function with period T can be derived from the definition of the exponential Fourier series, that is,
f(t) =
n =
Cn e
jn 0 t
(8.89)
2 ( 0 )
Then,
Cn e Cn e
j 0 t
2C 1 ( 0 ) 2C 2 ( 2 0 ) 2C n ( n 0 )
j2 0 t
(8.90)
Cn e
jn 0 t
Taking the Fourier transform of (8.89), and applying the linearity property for the transforms of (8.90), we obtain
F { f(t) }
Cn e
jn 0 t
n =
n =
Cn F { e
jn 0 t
} = 2
n =
C n ( n 0 )
(8.91)
The line spectrum of the Fourier transform of (8.91) is shown in Figure 8.14.
F() 2C 0 2C 1 2C 3 0 0 2C 1
2C 2 2C 4
.....
2C 2 2C 3 2C 4
.....
4 0 3 0 2 0 0
2 0
3 0
4 0
The line spectrum of Figure 8.14 reveals that the Fourier transform of a periodic time function with period T , consists of a train of equally spaced delta functions. The strength of each ( n 0 ) is equal to 2 times the coefficient C n .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
831
Chapter 8 The Fourier Transform 8.6.6 The Transform of the Periodic Time Function f ( t )
The periodic time function
f(t) = A =
n =
( t nT )
n =
( t nT )
(8.92)
consists of a train of equally spaced delta functions in the time domain, and each has the same strength A , as shown in Figure 8.15.
f(t)
..... .....
n =
( t nT )
Since this is a periodic function of time, its Fourier transform is as derived in Subsection 8.6.5, that is, relation (8.91). Then,
F ( ) = 2
n =
C n ( n 0 )
(8.93)
T 2 f ( t )e
T2
jn 0 t
dt
(8.94)
From the waveform of Figure 8.15, we observe that, within the limits of integration from T 2 to +T 2 , there is only the impulse ( t ) at the origin. Therefore, replacing f ( t ) with ( t ) and using the sifting property of the delta function, we obtain
1 C n = -T
T 2 ( t )e
T2
jn 0 t
1 dt = -T
(8.95)
Thus, we see that all C n coefficients are equal to 1 T , and (8.93) is expressed as
2 F ( ) = ---- ( n 0 ) T n =
(8.96)
832
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
..... .....
4 0 3 0 2 0 0
2 0
3 0
4 0
Figure 8.16. The Fourier transform of a train of equally spaced delta functions
Figure 8.16 shows that the Fourier transform of a periodic train of equidistant delta functions in the time domain, is a periodic train of equally spaced delta functions in the frequency domain. This result is the basis for the proof of the sampling theorem which states that a time function f ( t ) can be uniquely determined from its values at a sequence of equidistant points in time.
8.7 Using MATLAB for Finding the Fourier Transform of Time Functions
MATLAB has the builtin fourier and ifourier functions to compute the Fourier transform and its inverse. Their descriptions and examples, can be displayed with the help fourier and help ifourier commands. In examples 8.4 through 8.7 we present some Fourier transform pairs, and how they are verified with MATLAB. Example 8.4
e
1 2 -- t 2
2e
1 2 -- 2
(8.97)
This time function, like the time function of Subsection 8.6.6, is its own Fourier transform multiplied by the constant 2 .
syms t v w x; ft=exp(t^2/2); Fw=fourier(ft)
Fw = 2^(1/2)*pi^(1/2)*exp(-1/2*w^2)
pretty(Fw)
ft = exp(-1/2*x^2) Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
833
1 4 -- j e 2
1 --
(8.98)
Fw = -1/2*i*pi^(1/2)*w*exp(-1/4*w^2)
pretty(Fw)
2 w exp(- 1/4 w )
t 1 e u 0 ( t ) + 3 ( t ) -------------- + 3 j + 1
(8.99)
syms t v w x; fourier(sym('exp(t)*Heaviside(t)+3*Dirac(t)'))
(8.100)
Fw = pi*Dirac(w)-i/w We have summarized the most common Fourier transform pairs in Table 8.9.
u ( t )h ( ) d
(8.101)
We let
g ( t ) = f ( t ) h ( t )
(8.102)
834
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
F() 1 e
jt 0
1 e
jt 0
2 ( ) 2 ( 0 ) 2 ( j ) 1----- + ( ) j [ ( 0 ) + ( + 0 ) ] j [ ( 0 ) ( + 0 ) ] 1 -------------j + a a>0 1 --------------------2 ( j + a ) a>0 j + a ---------------------------------2 2 ( j + a ) + a>0 sin 0 tu 0 ( t ) a>0 ---------------------------------2 2 ( j + a ) + a>0 sin T 2AT --------------T
u0 ( t )
a>0 te
at
u0 ( t )
a>0 e
at
cos 0 tu 0 ( t ) a>0
at
A [ u0 ( t + T ) u0 ( t T ) ]
and recalling that convolution in the time domain corresponds to multiplication in the frequency domain, we obtain
f ( t ) h ( t ) = g ( t ) G ( ) = F ( ) H ( )
(8.103)
We call H ( ) the system function. From (8.103), we see that the system function H ( ) and the impulse response h ( t ) form the Fourier transform pair Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
835
(8.104)
Therefore, if we know the impulse response h ( t ) , we can compute the response g ( t ) of any input f ( t ) , by multiplication of the Fourier transforms H ( ) and F ( ) to obtain G ( ) . Then, we take the Inverse Fourier transform of G ( ) to obtain the response g ( t ) . Example 8.8 For the linear network of Figure 8.17 (a) below, it is known that the impulse response is as shown in Figure 8.17 (b). Use the Fourier transform method to compute the response g ( t ) when the input f ( t ) is as shown in Figure 8.17 (c).
3
f ( t ) = 2 [ u0 ( t ) u0 ( t 3 ) ] h ( t ) = 3e 2t
t (b) 0 1 (c) 2 3 2 t
f(t)
g(t)
and
f 2 ( t ) = 2u 0 ( t 3 )
The system function H ( ) is the Fourier transform of the impulse response h ( t ) . Thus,
F {h(t)}
3 = H ( ) = -------------j + 2
F { f1 ( t ) }
Then,
1 = F 1 ( ) = 2 ( ) + ----- j
3 1 G 1 ( ) = H ( ) F 1 ( ) = -------------- 2 ( ) + ----- j + 2 j
or
836
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(8.105)
To evaluate the first term of (8.105), we apply the sampling property of the delta function, i.e.,
X() ( ) = X(0) ()
and this term reduces to 3 ( ) or 1.5 [ 2 ( ) ] . Since 1 2 ( ) , the Inverse Fourier transform of this term is
{ 1.5 [ 2 ( ) ] } = 1.5
(8.106)
To find the Inverse Fourier transform of the second term in (8.105), we use partial fraction expansion. Thus,
3 1.5 -------------------------- = 1.5 -----------------------j ( j + 2 ) j ( j + 2 )
and therefore,
g 1 ( t ) = 1.5 + F
1 1.5
or
g 1 ( t ) = 1.5 + 0.75 sgn ( t ) 1.5e u0 ( t )
2t
u 0 ( t ) = 0.75 + 1.5 ( 1 e
2t
)u 0 ( t )
(8.107)
Next, we denote the response due to the second term of the input as g 2 ( t ) , and replacing u 0 ( t ) in (8.107) with u 0 ( t 3 ) , we obtain
g 2 ( t ) = 0.75 + 1.5 ( 1 e
2 ( t 3 )
)u 0 ( t 3 )
(8.108)
or
g ( t ) = 1.5 { ( 1 e
2t
)u 0 ( t ) ( 1 e
2 ( t 3 )
)u 0 ( t 3 ) }
Example 8.9 For the circuit of Figure 8.18, use the Fourier transform method, and the system function H ( ) to compute v L ( t ) . Assume i L ( 0 ) .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
837
+
v in ( t ) = 5e
3t
4 L + vL ( t )
2H
u0 ( t )
Solution: We will find the system function H ( ) from the phasor equivalent circuit shown in Figure 8.19.
R
4 L +
+
V in ( )
j2
V L ( ) = V out ( )
5 u 0 ( t ) V in ( ) = -------------j + 3
and
v L ( t ) = v out ( t ) =
or
v L ( t ) = 5 ( 3e
3t
2e
2t
)u 0 ( t )
(8.109)
838
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(8.110)
where v in ( t ) is as shown in Figure 8.20. Use the Fourier transform method, and the system function H ( ) to compute the output v out ( t ) .
3
v in ( t )
Linear Network
+ v out ( t )
v in ( t ) = 3e
2t
Solution: Taking the Fourier transform of both sides of (8.110), and recalling that
d ------ f ( t ) ( j ) n F ( ) n dt
n
we obtain,
jV out ( ) + 4V out ( ) = 10V in ( )
or
( j + 4 )V out ( ) = 10V in ( )
and thus,
V out ( ) 10 H ( ) = ------------------- = -------------j + 4 V in ( )
(8.111)
Also,
V in ( ) =
{ v in ( t ) } =
( 3e
2t
3 u 0 ( t ) ) = -------------j + 2
(8.112)
and
r2 r1 10 3 V out ( ) = H ( ) V in ( ) = -------------- -------------- = -------------- + -------------j + 4 j + 2 j + 4 j + 2
(8.113)
Therefore,
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
839
2t 4t 15 15 -------------- + -------------- = 15 ( e e )u 0 ( t ) j + 2 j + 4
(8.114)
Example 8.11 The voltage across an 1 resistor is known to be v R ( t ) = 3e u 0 ( t ) . Compute the energy dissipated in this resistor for 0 < t < , and verify the result by application of Parsevals theorem.
2t
u0 ( t )
(8.115)
v R dt =
9e
4t
e dt = 9 -------4
4t 0
9 4t = -- e 4
= 2.25 joules
(8.116)
Since
1 2 f ( t ) dt = ----2
F ( )
(8.117)
F() =
F { 3e2t u0 ( t ) }
3 = -------------j + 2
(8.118)
and
F( )
2
9 = F ( ) F ( ) = ----------------2 2 +2
(8.119)
9 ----------------- d 2 2 +2
(8.120)
We observe that the integrand of (8.120) is an even function of ; therefore, we can multiply the integral by 2 , and integrate from 0 to . Then,
2W R = ----2
9 9 ----------------- d = -2 2 +2
1 ----------------- d 2 2 +2
(8.121)
840
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
---------------- dx 2 2 a +x
Thus,
9 1 - W R = -- -- atan -- 2 2
1 = -- atan x + C -a a
(8.122)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
841
f ( t )e
jt
dt
F ( )e
jt
The Fourier transform is, in general, a complex function. We can express it as the sum of its
F ( ) = Re { F ( ) } + jIm { F ( ) } = F ( ) e
j ( )
We often use the following notations to express the Fourier transform and its inverse.
F F
{f(t)} = F()
1
{F()} = f(t)
If f ( t ) is real, F ( ) is, in general, complex. If f ( t ) is real and even, F ( ) is also real and even. If f ( t ) is real and odd, F ( ) is imaginary and odd. If f ( t ) is imaginary, F ( ) is, in general, complex. If f ( t ) is imaginary and even, F ( ) is also imaginary and even. If f ( t ) is imaginary and odd, F ( ) is real and odd. If F ( ) = F ( ) , f ( t ) is real. The linearity property states that a1 f1 ( t ) + a2 f2 ( t ) + + an fn ( t ) a1 F1 ( ) + a2 F2 ( ) + + an Fn ( ) The symmetry property states that F ( t ) 2f ( ) The scaling property states that 1 f ( at ) ---- F --- a a
842
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
The time shifting property states that f ( t t 0 ) F ( )e The frequency shifting property states that e
j 0 t jt 0
f ( t ) F ( 0 )
The Fourier transforms of the modulated signals f ( t ) cos t and f ( t ) sin t are F ( 0 ) + F ( + 0 ) f ( t ) cos 0 t --------------------------------------------------------2 F ( 0 ) F ( + 0 ) f ( t ) sin 0 t ------------------------------------------------------j2 The time differentiation property states that d ------- f ( t ) ( j ) n F ( ) n dt The frequency differentiation property states that d n ( j t ) f ( t ) --------- F ( ) n d The time integration property states that
n n
f ( ) d ------------ + F ( 0 ) ( ) j
If F ( ) is the Fourier transform of the complex function f ( t ) , then, f ( t ) F ( ) The time convolution property states that f 1 ( t ) f 2 ( t ) F 1 ( )F 2 ( ) The frequency convolution property states that 1 f 1 ( t )f 2 ( t ) ----- F 1 ( ) F 2 ( ) 2 The area under a time function f ( t ) is equal to the value of its Fourier transform evaluated at = 0 . In other words,
F( )
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
843
f ( t ) dt
The value of a time function f ( t ) , evaluated at t = 0 , is equal to the area under its Fourier transform F ( ) times 1 2 . In other words, 1 f ( 0 ) = ----2 Parsevals theorem states that
F ( ) d F ( )
F()
2
f(t) (t) 0
1 2 f ( t ) dt = ----2
The delta function and its Fourier transform are as shown below. 1
The unity time function and its Fourier transform are as shown below. f(t) 1 F() 2 ( )
t
j 0 t
is as indicated below.
2 ( 0 )
The Fourier transforms of the time functions cos 0 t , and sin 0 t are as shown below. cos 0 cos t0 t t t 0 0 F Re ( ) 0
844
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
sin 0 t tt 0 0 The signum function and its Fourier transform are as shown below. f(t)
1 0 F Im ( )
F Im ( ) 0
t
0 1
The unit step function and its Fourier transform are as shown below. f(t)
1
F Im ( ) t
F Re ( ) F Im ( )
j 0 t
j 0 t
1 u 0 ( t ) ( 0 ) + ---------------------j ( 0 )
j u 0 ( t ) cos 0 t -- [ ( 0 ) + ( + 0 ) ] + ----------------2 2 2 0
2 u 0 ( t ) sin 0 t ---- [ ( 0 ) + ( + 0 ) ] + ----------------2 2 j2 0
If a time function f ( t ) is zero for t 0 , we can obtain the Fourier transform of f ( t ) from the one-sided Laplace transform of f ( t ) by substitution of s with j .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
845
F {f(t)}
= L [ f ( t ) ]
s = j
t
T
F {f(t)}
Cn e
jn 0 t
n =
n =
Cn F { e
jn 0 t
} = 2
n =
C n ( n 0 )
The Fourier transform of a periodic train of equidistant delta functions in the time domain, is a
The system function H ( ) and the impulse response h ( t ) form the Fourier transform pair h(t) H()
and
f ( t ) h ( t ) = g ( t ) G ( ) = F ( ) H ( )
846
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
u ( t ) ( t ) dt
0
= 12
2. Compute
{ te
at
u0 ( t ) } a > 0
7. For the circuit below, use the Fourier transform method to compute v C ( t ) .
R1 1 C
1F
v in ( t )
v C ( t ) R2
0.5
v in ( t ) = 50 cos 4tu 0 ( t )
9. In a bandpass filter, the lower and upper cutoff frequencies are f 1 = 2 Hz , and f 2 = 6 Hz respectively. Compute the 1 energy of the input, and the percentage that appears at the output, if the input signal is v in ( t ) = 3e
2t
u 0 ( t ) volts.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
847
t
T
Compute the percentage of the 1 energy of f ( t ) contained in the interval T T of F ( ) . 11. In Subsection 8.6.2, Page 8-28, we derived the Fourier transform pair
A [ u 0 ( t ) u 0 ( t 2T ) ] 2ATe
jT
sin T --------------- T
Use the fplot MATLAB command to plot the Fourier transform of this rectangular waveform.
848
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
u 0 ( t ) ( t ) dt =
d u 0 ( t ) u 0 ( t ) dt = dt
u ( t ) d( u ( t ) )
0 0
and since at t = + , u 0 ( t ) = 1 whereas at t = , u 0 ( t ) = 0 , we replace the limits of integration with 1 and 0 . Then,
2.
F( ) =
u0 ( t ) u 0 ( t ) d( u 0 ( t ) ) = ----------2 0
1 jt
= 12
0
f ( t )e
dt =
te
at jt
dt =
te
( j + a )t
dt
Then,
( j + a )t
e ax xe dx = ------ ( ax 1 ) 2 a
ax
e [ ( j + a )t 1 ] F ( ) = ----------------------------------------------------------------2 ( j + a )
[ ( j + a )t + 1 ] = --------------------------------------------( j + a )t 2 e ( j + a )
1 = --------------------2 ( j + a )
and thus
Check:
F() = F(s)
s = j
and since
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
849
1 u 0 ( t ) ----------------2 (s + a) 1 = --------------------2 ( j + a )
it follows that
1 F ( ) = ----------------2 (s + a)
s = j
3.
t
T 0 T 0 0
0 2 ----T
4.
f ( t ) = A [ u 0 ( t + 3T ) u 0 ( t + T ) + u 0 ( t T ) u 0 ( t 3T ) ]
f( t) A
t
3T 2T T 0 T 2T 3T
850
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or
+e sin T sin T e F ( ) = 4AT --------------- ------------------------------ = 4AT cos 2T -------------- 2 T T
j2t j 2t
5.
A f ( t ) = --- t [ u 0 ( t + T ) u 0 ( t T ) ] T
T 0 A
T T
A f ( t ) = --- t T A t T
F() =
f ( t )e
jt
dt =
A jt --- t e dt T
A = --T
T t e
jt
dt
Then,
F() =
A --T
e ax xe dx = ------ ( ax 1 ) 2 a
T T
ax
e ------------ ( jt 1 ) 2 ( j )
jt
=
T
A --T
e ---------- ( jt 1 ) 2
jt
=
T
A --T
e ---------- [ ( jt + 1 ) ] 2
jt
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
851
f2 ( t )
AT
t
T
The waveform of f 2 ( t ) is the derivative of the waveform of f 1 ( t ) and thus f 1 ( t ) = tf 2 ( t ) . From Subsection 8.6.1, Page 827,
sin T A sin T f 2 ( t ) 2 --- T --------------- = 2A --------------T T T
From the frequency differentiation property, transform pair (8.48), Page 813,
d n ( j t ) f ( t ) --------- F ( ) n d
n
or
n n d t f ( t ) j --------- F ( ) n d n
Then,
d sin T sin T d { f 1 ( t ) = tf 2 ( t ) } = j ------ 2A --------------- = j2A ------ --------------- d d T T ( T )T cos T T ( sin T ) j2A = j2A ---------------------------------------------------------------- = --------- ( T cos T sin T ) 2 2 ( T ) T
f2 ( t )
AT
f3( t )
AT
a
t T 0 T
T 0
A T
852
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
T2
jt
A e = --- ---------- T j
jt
j ( T 2 )
j ( T 2 )
This sin ( x ) x curve is shown below and it is created with the following MATLAB script:
2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
853
We can plot F 1 ( ) by letting T 2 = 1 . Then, F 1 ( ) simplifies to the form K [ ( sin x ) x ] This curve is shown below and it is created with the following MATLAB script.
fplot('(sin(x)./x).^2',[-8*pi 8*pi 0 1])
1
7.
1
+
v in ( t )
1F
vC ( t )
0.5
By KCL
dv C v C ( t ) v C ( t ) v in ( t ) -------------------------------- + 1 -------- + ------------ = 0 dt 1 0.5 dv C -------- + 3v C = v in dt
and since
V out ( ) = V C ( ) ,
854
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and
V out ( ) 1 H ( ) = ------------------- = -------------j + 3 V in ( )
where
v in ( t ) = 50 cos 4tu 0 ( t ) V in ( ) = 50 [ ( 4 ) + ( + 4 ) ]
Then,
1 V out ( ) = V C ( ) = H ( ) V in ( ) = -------------- 50 [ ( 4 ) + ( + 4 ) ] j + 3
and
vC ( t ) =
1{ V C ( ) } = ----2
---------------------------------------------------------------- e j + 3 --------------------- e j + 3
50 [ ( 4 ) + ( + 4 ) ] ( + 4)
jt
= 25
( 4 ) jt -------------------- e d + 25 j + 3
jt
j ( 4t 53.1 )
j ( 4t 53.1 )
8.
dd2 ------ v out ( t ) + 5 ---- v out ( t ) + 6v out ( t ) = 10v in ( t ) = 2e t u 0 ( t ) 2 dt dt
We use the following MATLAB script for partial fraction expansion where we let j = s .
syms s; collect((s+1)*(s+2)*(s+3))
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
855
and thus
v out ( t ) =
2t
+ 10e
3t
= 10 ( e 2e
+e
3t
)u 0 ( t )
9.
v in ( t ) dt = 9e = ----------4
4t 0
3e
2t 2
dt =
3e
2t 2
dt =
0 9e
4t
dt
9e = ----------4
4t 0
9 = -- = 2.25 J 4
{ v in ( t ) } =
{ 3e
2t
3 u 0 ( t ) } = -------------j + 2
The energy at the output for the frequency interval 2 Hz f 6 Hz or 4 rad 12 rad is
1 W out = ----2
1 2 F ( ) d = ----2
1 3 -2 -------------- d = ----2 j + 2
12
9 ----------------- d 2 2 +2
---------------- dx 2 2 x +a
Then,
1 x = -- atan -a a
856
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
atan(2*pi) = 1.41
9 W out = ----- ( 1.52 1.41 ) = 0.08 J 4
10.
sin T A [ u 0 ( t + T ) u 0 ( t T ) ] 2AT --------------T F() f(t)
A
0 2 T
t
T
f ( t ) dt =
T A d t
2 2
A dt = 2A t
2 T 0
= 2A T
Next, we denote the energy in the frequency interval T rad T rad as W out in the frequency domain we obtain
1 W out = ----2
1 2 F ( ) d = ----2
T 2AT ---------------T
sin T
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
857
For simplicity, we let T = y . Then, = y T and d = ( 1 T )dy . Also, when = 0 , y = 0 , and when = T or T = , y = . With these substitutions we express (1) as
4A T W out = ---------------
2 2
sin y ----------------------------------------- dy = 4A T 2 T ( ( y T )T )
sin y ------------------------ dy = 4A T 2 y
But the last integral in (2) is an improper integral and does not appear in tables of integrals.* Therefore, we will attempt to simplify (2) using integration by parts. We start with the familiar relation
d ( uv ) = udv + vdu
from which
d ( uv ) = u dv + vdu
or
u dv
2 2
= uv vdu
Letting u = sin y and dv = 1 y , it follows that du = 2 cos y sin y = sin 2y and v = 1 y . With these substitutions (2) is written as
W out 4A T sin y = ------------- ----------- y 4A T = 2 ------------
2 2 2
sin 2y ------------- dy y
(3)
sin 2y ------------- dy 2y
The last integral in (3) is also an improper integral. Fortunately, some handbooks of mathematical tables include numerical values of the integral
0 ---------- dx x
* It is shown in Advanced Calculus textbooks that if the upper limit is , then
sin x
0
but for other finite limits are not equal.
sin x ---------- dx = x
sin x ------------ dx = -2 2 x
858
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
From Table 5.3 of Handbook of Mathematical Functions, 1972 Edition, Dover Publications, with x = 2 or x = 2 we obtain
0
and thus (4) reduces to
sin w ----------- dw w
= 1.418
x=2 2
Therefore, the percentage of the output for the frequency interval T rad T rad is
2 W out ( 4A T ) 1.418 ----------------------------------- 100% = ------------------------------------------- 100% = 2 1.418 100% = 90.3% 2 W total 2A T
Since this computation involves numerical integration, we can obtain the same result much faster and easier with MATLAB as follows: First, we define the function fourierxfm1 and we save it as an .m file as shown below. This file must be created with MATLABs editor (or any other editor) and saved as an .m file in a drive that has been added to MATLABs path.
function y1=fourierxfm1(x) x=x+(x==0)*eps;% This statement avoids the sin(0)/0 value. % It says that if x=0, then (x==0) = 1 % but if x is not zero, then (x==0) = 0 % and eps is approximately equal to 2.2e-16 % It is used to avoid division by zero. y1=sin(x)./x;
Then, at MATLABs Command prompt, we write and execute the program below.
% The quad function below performs numerical integration from 0 to 2*pi % using a form of Simpson's rule of numerical integration. value1=quad('fourierxfm1',0,2*pi)
value1 = 1.4182
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
859
sin x ------------ dx 2 0 x
thereby avoiding the integration by parts procedure. Shown below are the function fourierxfm2 which is saved as an .m file and the program execution using this function.
function y2=fourierxfm2(x) x=x+(x==0)*eps; y2=(sin(x)./x).^2;
and after this file is saved, we execute the statement below observing that the limits of integration are from 0 to .
value2=quad('fourierxfm2',0,pi)
1.5
0.5
10
12
860
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 9
DiscreteTime Systems and the Z Transform
his chapter is devoted to discretetime systems, and introduces the onesided Z Transform. The definition, theorems, and properties are discussed, and the Z transforms of the most common discretetime functions are derived. The discrete transfer function is also defined, and several examples are given to illustrate its application. The Inverse Z transform, and the methods available for finding it, are also discussed.
f [ n ]z
n=0
(9.1)
(9.2)
We can obtain a discretetime waveform from an analog (continuous or with a finite number of discontinuities) signal, by multiplying it by a train of impulses. We denote the continuous signal as f ( t ) , and the impulses as
[n] =
n=0
[ t nT ] [ t nT ]
(9.3)
(9.4)
n=0
* Whereas continuous-time signals are described by differential equations, discretetime signals are described by difference equations.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
91
(a) [n]
n 0
(b) f ( t ) [ n ]
Of course, after multiplication by [ n ] , the only values of f ( t ) which are not zero, are those for which t = nT , and thus we can express (9.4) as
g ( t ) = f [ nT ]
n=0
[ t nT ] =
n=0
f [ nT ] [ t nT ]
(9.5)
Next, we recall from Chapter 2, that the t domain to s domain transform pairs for the delta function are ( t ) 1 and ( t T ) e . Therefore, taking the Laplace transform of both sides of (9.5), and, for simplicity, letting f [ nT ] = f [ n ] , we obtain
sT nsT = e G(s) = L f [ n] [ t nT ] = f [ n ] n=0 n=0
f [n ]e n=0
nsT
(9.6)
92
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Z {f [n]} Z
1
(9.7) (9.8)
and
f [n] = {F(z)}
The function F ( z ) , as defined in (9.1), is a series of complex numbers and converges outside the circle of radius R , that is, it converges (approaches a limit) when z > R . In complex variables theory, the radius R is known as the radius of absolute convergence. In the complex z plane the region of convergence is the set of z for which the magnitude of F ( z ) is finite, and the region of divergence is the set of z for which the magnitude of F ( z ) is infinite.
9.2.1 Linearity
af 1 [ n ] + bf 2 [ n ] + cf 3 [ n ] + aF 1 ( z ) + bF 2 ( z ) + cF 3 ( z ) +
(9.9)
where a, b, c, are arbitrary real or complex constants. Proof: The proof is easily obtained by application of the definition of the Z transform to each term on the left side. In our subsequent discussion, we will denote the discrete unit step function as u 0 [ n ] .
F(z)
(9.10)
Proof: Applying the definition of the Z transform, we obtain Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
93
f [ n m ]u0 [ n m ]z
n=0
and since u 0 [ n m ] = 0 for n < m and u 0 [ n m ] = 1 for n > m , the above expression reduces to
Z { f [n m]} =
f [ n m ]z
n=0
k=0
f [k] z
( k + m )
k=0
f [ k ]z z
k m
= z
f [ k ]z
k=0
= z
F(z )
F(z) +
m1 n=0
f [ n m ]z
(9.11)
f [ n m ]z
n=0
k = m
m
f [ k ]z
( k + m )
k = m
k=0
f [ k ]z z
k
k m
= z
f [ k ]z k = m
k = m 1
= z
k = m
f [ k ]z
f [ k ]z
=z
F(z) +
f [ k ]z
When k = m , n = 0 , and when k = 1 , n = m 1 . Then, by substitution into the last summation term above, we obtain
Z { f [n m]} = z
m
F(z) +
m1
f [ n m ]z
mn
= z
F(z) +
m1 n=0
f [ n m ]z
n=0
94
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.12)
(9.13)
n = m
f [ n + m ]z
(9.14)
that is, if f [ n ] is a discretetime signal, and m is a positive integer, the mth left shift of f [ n ] is f [n + m] . Proof:
Z { f [n + m]} =
f [ n + m ]z
n=0
k=m m
f [k] z
( k m )
f [ k ]z f [k] z
k m
= z
f [k] z
k=0
k=m m1 k
m1 k
=z
F( z)
f [k] z
k=0
k=0
When k = 0 , n = m , and when k = m 1 , n = 1 . Then, by substitution into the last summation term of the above expression, we obtain
Z {f [n + m]} = z
m
F(z ) +
n = m
f [n + m] z
( n + m )
= z F(z ) +
n = m
f [ n + m ]z
and this is the same as (9.14). For m = 1 , the above expression reduces to
Z { f [ n + 1 ] } = zF ( z ) f [ 0 ]z
(9.15)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
95
(9.16)
z n a f [n] F - a
(9.17)
Proof:
Z {a f [n]} =
n
k=0
a f [ n ]z
k=0
1 ------ f [ n ]z n = n a
k=0
z n z f [n] - = F - a a
9.2.6 Multiplication by e
naT
f [n ] F( e z)
aT
(9.18)
n
Proof:
Z {e
naT
f [n]} =
k=0
naT
f [n] z
f [n ](e
k=0
aT
z)
= F(e z)
aT
(9.19)
Proof: By definition,
F(z) =
f [ n ]z
n=0
and taking the first derivative of both sides with respect to z , we obtain
d ----- F ( z ) = dz
( n )f [ n ]z
n=0
n1
= z
nf [ n ]z
n=0
96
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
nf [ n ]z
n=0
d= z ----- F ( z ) dz
0 f [ m ] ----------- F ( z ) z1 m=
z
(9.20)
that is, the Z transform of the sum of the values of a signal, is equal to z ( z 1 ) times the Z transform of the signal. This property is equivalent to time integration in the continuous time domain since integration in the discretetime domain is summation. We will see on the next section that the term z ( z 1 ) is the Z transform of the discrete unit step function u 0 [ n ] , and recalling that in the s domain
1 u 0 ( t ) -s
and
0 f ( ) d ---------s
Proof: Let
y[ n] =
F(s)
0 x [ m ] m=
(9.21)
n1
m=0
x[ m] + x[n]
(9.22)
Since the summation symbol in (9.21) is y [ n ] , then the summation symbol in (9.22) is y [ n 1 ] , and thus we can write (9.22) as
y[ n] = y[n 1] + x[n ]
(9.23)
Next, we take the Z transform of both sides of (9.23), and using the property
x [ n m ]u 0 [ n m ] z
m
X(z)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
97
or
1 z Y ( z ) = --------------- X ( z ) = ---------- X ( z ) 1 z1 1z
and the response at any arbitrary value m, is obtained by summing all the components that have occurred up to that point, that is, if y [ n ] is the output due to the input x [ m ] convolved with h [ n ] , then,
y[ n] =
x [ m ]h [ n m ]
m=0 n
(9.24)
or
y[ n] =
h [ n m ]x [ m ]
m=0
(9.25)
We will now prove that convolution in the discretetime domain corresponds to multiplication in the Z domain, that is,
f 1 [ n ] f 2 [ n ] F 1 ( z ) F 2 ( z )
(9.26)
98
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
x [ m ]h [ n m ]
n=0 m=0
m=0 n=0
x [ m ]h [ n m ]z
m=0
x[m]
h[n m] z
n=0
m=0
x[m]
n=0
h[k]z
( k + m )
m=0
x [ m ]z
h[k]z
n=0
or
(9.27)
xF ( v )F --- v v
z
1 2
dv
(9.28)
for X 1 ( v ) and X 2 ( z v ) . The proof requires contour integration; it will not be provided here.
(9.29)
1= ---- 0 n z
f [n] z
n=0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
99
f [ n ]z
n=0
= f [0] z
= f [0]
Therefore,
lim X ( z ) = f [ 0 ]
lim f [ n ] = lim ( z 1 ) F ( z )
z1
(9.30)
( f [ n + 1 ] f [ n ] )z
n=0 k
We replace the upper limit of the summation with k, and we let k . Then,
Z { f [ n + 1 ] f [ n ] } = lim
( f [ n + 1 ] f [ n ] )z
n=0
(9.31)
From (9.15),
Z { f [ n + 1 ] } = zF ( z ) f [ 0 ]z
(9.32)
( f [ n + 1 ] f [ n ] )z
n=0
( f [ n + 1 ] f [ n ] )z
n=0
= lim
zlim1 ( f [ n + 1 ] f [ n ] )z
n=0
910
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
z1
zlim1 { f [ n + 1 ] f [ n ] } z
n=0
z1
lim ( z 1 )F ( z ) f [ 0 ] = lim
n=0
{f [n + 1]} f [n]
k
= lim { f [ k ] f [ 0 ] } = lim f [ k ] f [ 0 ]
k
lim f [ k ] = lim ( z 1 )F ( z )
z1
We must remember, however, that if the sequence f [ n ] does not approach a limit, the final value theorem is invalid. The right side of (9.30) may exist even though f [ n ] does not approach a limit. In instances where we cannot determine whether f [ n ] exists or not, we can be certain that it exists if X ( z ) can be expressed in a proper rational form as
A(z) X ( z ) = ----------B(z)
where A ( z ) and B ( z ) are polynomials with real coefficients. For convenience, we summarize the properties and theorems of the Z transform in Table 9.1.
(9.33)
f [ n ]z
n=0
a z
n=0
n n
( az
n=0
1 n
(9.34)
To evaluate this infinite summation, we form a truncated version of F ( z ) which contains the first k terms of the series. We denote this truncated version as F k ( z ) . Then, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
911
Z transform aF 1 ( z ) + bF 2 ( z ) + z F(z ) +
m
F(z )
n
m1 n=0
f [ n m ]z
Left Shift
f [n + m]
z F( z) +
n = m
f [ n + m ]z
Multiplication by a n Multiplication by e
naT
a f [n] e
naT
f [n]
Multiplication by n Multiplication by n 2 Summation in Time Time Convolution Frequency Convolution Initial Value Theorem Final Value Theorem
nf [ n ] n f [n]
n 2
f [m] m=0
f 1 [ n ] f 2 [ n ] f1 [ n ] f2 [ n ]
j 2
z
1 --------
z 1 xF 1 ( v )F 2 -- v dv v
f [ 0 ] = lim F ( z )
n
lim f [ n ] = lim ( z 1 ) F ( z )
z1
Fk ( z ) =
k1
a z
n n
= 1 + az
+a z
2 2
++a
k 1 ( k 1 )
(9.35)
n=0
and we observe that as k , (9.35) becomes the same as (9.34). To express (9.35) in a closed form, we multiply both sides by az . Then,
1
912
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
+a z
2 2
+a z
3 3
++a z
k k
(9.36)
or
1a z 1 ( az ) F k ( z ) = --------------------- = ------------------------1 1 1 az 1 az
k k 1 k
(9.37)
for az 1
1
To determine F ( z ) from F k ( z ) , we examine the behavior of the term ( az ) in the numerator of (9.37). We write the terms az and ( az ) in polar form, that is, az
1 1 k 1
1 k
= az
and (9.38)
( az ) = az
1 k
1 k jk
From (9.38) we observe that, for the values of z for which az plex number ( az ) 0 as k and therefore,
1 k
(9.39)
for az
<1
1
1 k
> 1.
n=0
( az )
1
1 n
> 1 . Also,
a a= - = ---z z
1
then, az
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
913
Z { a u0 [ n ] } =
a z
n=0
n n
(9.40)
The regions of convergence and divergence for the sequence of (9.40) are shown in Figure 9.2.
Im[z] Region of Convergence
z F ( z ) = ---------za
|a| Region of Divergence Re[z]
F( z)
Figure 9.2. Regions of convergence and divergence for the geometric sequence a
To determine whether the circumference of the circle, where z = a |, lies in the region of convergence or divergence, we evaluate the sequence F k ( z ) at z = a . Then,
Fk ( z ) =
a z n=0
k1
n n
= 1 + az
+a z
2 2
++a
k 1 ( k 1 )
z=a
(9.41)
= 1+1+1++1 = k
We see that this sequence becomes unbounded as k , and therefore, the circumference of the circle lies in the region of divergence.
....
n
914
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
n=0
f [ n ]z
[ 1 ]z
n=0
(9.42)
As in Subsection 9.3.1, to evaluate this infinite summation, we form a truncated version of F ( z ) which contains the first k terms of the series, and we denote this truncated version as F k ( z ) . Then,
Fk ( z ) =
k1
z
1
= 1+z
+z
++z
( k 1 )
(9.43)
n=0
and we observe that as k , (9.43) becomes the same as (9.42). To express (9.43) in a closed form, we multiply both sides by z
1
and we obtain
1
z Fk ( z ) = z
+z
+z
++z
(9.44)
or
1z 1 (z ) F k ( z ) = --------------- = ---------------------1 1 1z 1z
k 1 k
(9.45)
for z 1
1
Since ( z ) = z
1 k
1 k jk
, as k , ( z ) 0 . Therefore,
1 z F ( z ) = lim F k ( z ) = --------------- = ---------1 z1 k 1z
1 k
(9.46)
for z > 1 , and the region of convergence lies outside the unit circle. Alternate Derivation: The discrete unit step u 0 [ n ] is a special case of the sequence a with a = 1 , and since 1 = 1 , by substitution into (9.40) we obtain
n n
Z { u0 [ n ] } =
[ 1 ]z
n=0
(9.47)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
915
Chapter 9 DiscreteTime Systems and the Z Transform 9.3.3 The Transform of the DiscreteTime Exponential Sequence
The discretetime exponential sequence is defined as
f [n] = e
naT
u0 [ n ]
2aT 2 3aT 3
Then,
F( z) =
e n=0
naT n
= 1+e
aT 1
+e
+e
z 1 u 0 [ n ] ] = -------------------------- = ----------------- aT aT 1 ze 1e z
(9.48)
for e
aT 1
< 1.
and
f 2 [ n ] = sin naT
To derive the Z transform of f 1 [ n ] and f 2 [ n ] , we use (9.48) of Subsection 9.3.3, that is,
e
naT
z ----------------- aT ze
z ] = Z [ cos naT + j sin naT ] = ------------------jaT ze z - ze = Z [ cos naT ] + jZ [ sin n aT ] = ------------------ ------------------jaT j aT ze ze z z cos aT + jz sin aT = Z [ cos naT ] + jZ [ sin n aT ] = ------------------------------------------------------2 z 2z cos aT + 1
2 j aT
(9.49)
916
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.50)
To define the regions of convergence and divergence, we express the denominator of (9.49) or (9.50) as
(z e
jaT
) (z e
j aT
)
jaT
We see that both pairs of (9.49) and (9.50) have two poles, one at z = e
z = e
j aT
, that is, the poles lie on the unity circle as shown in Figure 9.4.
Im[z] Region of Convergence
Pole
1 Region of Divergence Re[z]
Pole
Figure 9.4. Regions of convergence and divergence for cos n aT and sin n aT
From Figure 9.4, we see that the poles separate the regions of convergence and divergence. Also, since the circumference of the circle lies on the region of divergence, as we have seen before, the poles lie on the region of divergence. Therefore, for the discretetime cosine and sine functions we have the pairs
z 2 z cos aT cos naT ----------------------------------------z 2 2z cos aT + 1 for z > 1
(9.52)
and
z sin a T sin n aT ----------------------------------------2 z 2z cos aT + 1 for z > 1
(9.53)
It is shown in complex variables theory that if F ( z ) is a proper rational function*, all poles lie outside the region of convergence, but the zeros can lie anywhere on the z -plane.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
917
Chapter 9 DiscreteTime Systems and the Z Transform 9.3.5 The Transform of the DiscreteTime Unit Ramp Function
The discretetime unit ramp function is defined as
f [ n ] = nu 0 [ n ]
Then,
Z { nu 0 [ n ] }
nz
n=0
= 0+z
+ 2z
+ 3z
(9.54)
We can express (9.54) in closed form using the discrete unit step function transform pair
Z { u0 [ n ] }
( 1 )z
n=0
z = ---------- for z1
z > 1
(9.55)
( 1 )z
n=0
z d ---------- dz z 1
or
n z
n=0
n1
1 = -----------------2 (z 1)
n
Multiplication by z yields
n=0
nz
= n
(1) z
n=0
z = -----------------2 (z 1)
(9.56)
We summarize the transform pairs we have derived, and others, given as exercises at the end of this chapter, in Table 9.2.
918
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
F(z) 1 z
m
z ---------za z ---------z1
z >a z >1 e
aT 1
)u 0 [ n ]
z ----------------- aT ze
2
<1
( cos naT )u 0 [ n ]
z z cos aT ----------------------------------------- z > 1 2 z 2z cos aT + 1 z sin a T ----------------------------------------- z > 1 2 z 2z cos aT + 1 z az cos aT ---------------------------------------------- z > a 2 2 z 2az cos aT + a az sin a T ---------------------------------------------- z > a 2 2 z 2az cos aT + a z 1 ---------------------------m1 z (z 1) z (z 1)
2 3 m 2
nu 0 [ n ] n u0 [ n ] [ n + 1 ]u 0 [ n ] a nu 0 [ n ] a n u0 [ n ] a n [ n + 1 ]u 0 [ n ]
n n 2 n 2
z(z + 1) (z 1) z (z 1)
2 2 2
( az ) ( z a )
az ( z + a ) ( z a ) 2az ( z a )
2 3
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
919
Chapter 9 DiscreteTime Systems and the Z Transform 9.4 Computation of the Z Transform with Contour Integration*
Let F ( s ) be the Laplace transform of a continuous time function f ( t ) and F ( s ) the transform of the sampled time function f ( t ) which we denote as f ( t ) . It is shown in complex variables theory that F ( s ) can be derived from F ( s ) by the use of the contour integral
1 F ( s ) = ------j2
F(v) -------------------------- dv sT vT 1e e
(9.57)
where C is a contour enclosing all singularities (poles) of F ( s ) , and v is a dummy variable for s . We can compute the Z transform of a discretetime function f [ n ] using the transformation
F ( z ) = F ( s )
z=e
sT
(9.58)
F(s ) ----------------------- ds 1 sT 1z e
(9.59)
F(s)
s = pk
(9.60)
Example 9.1 Derive the Z transform of the discrete unit step function u 0 [ n ] using the residue theorem. Solution: We learned in Chapter 2, that
L [ u0 ( t ) ] = 1 s
This section may be skipped without loss of continuity. It is intended for readers who have prior knowledge of complex variables theory. However, the following examples will show that this procedure is not difficult.
920
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Example 9.2 Derive the Z transform of the discrete exponential function e rem. Solution: From Chapter 2,
L [e
at naT
1u 0 ( t ) ] = ---------s+a
for z > 1 and this is the same as (9.48), Page 916. Example 9.3 Derive the Z transform of the discrete unit ramp function nu 0 [ n ] using the residue theorem. Solution: From Chapter 2,
L [ tu 0 ( t ) ] = 1 s
2
Since F ( s ) has a second order pole at s = 0 , we need to apply the residue theorem applicable to a pole of order n. This theorem states that
F(s) 1 d F ( z ) = lim ------------------ ( s p k ) ------------- ----------------------n1 1 sT ( n 1 )! s pk 1z e ds
n1
(9.61)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
921
and
F( z) =
f [n]e n=0
n=0
nsT
(9.62)
f [ n ]z
(9.63)
(9.64)
(9.65)
and
1 s = -- ln z T
(9.66)
Therefore,
F( z) = G(s)
1 s = -- ln z T
(9.67)
Since s , and z are both complex variables, relation (9.67) allows the mapping (transformation) of regions of the s -plane into the z -plane. We find this transformation by recalling that s = + j and therefore, expressing z in magnitude-phase form and using (9.65), we obtain
922
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
= e
jT
where,
z = e
T
and
= T
Since
T = 1 fs
(9.71)
j2 ( s )
(9.72)
The quantity e j2 ( s ) in (9.72), defines the unity circle; therefore, let us examine the behavior of z when is negative, zero, or positive. Case I < 0 : When is negative, from (9.69), we see that z < 1 , and thus the left half of the s -plane maps inside the unit circle of the z -plane, and for different negative values of , we obtain concentric circles with radius less than unity. Case II > 0 : When is positive, from (9.69), we see that z > 1 , and thus the right half of the s -plane maps outside the unit circle of the z -plane, and for different positive values of we obtain concentric circles with radius greater than unity. Case III = 0 : When is zero, from (9.72), we see that z = e j2 ( s ) and all values of lie on the circumference of the unit circle. For illustration purposes, we have mapped several fractional values of the sampling radian frequency s , and these are shown in Table 9.3. From Table 9.3, we see that the portion of the j axis for the interval 0 s in the s plane, maps on the circumference of the unit circle in the z plane as shown in Figure 9.5. Thus, in digital signal processing the unit circle represents frequencies from zero to the sampling frequency, and the frequency response is the discretetime transfer function evaluated on the unit circle.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
923
z 1 1 1 1 1 1 1 1 1
0 4 2 3 4 5 4 3 2 7 4 2
Im [ z ]
x x
zplane
= 0.25 s
x
0.375 s = 0.5 s
x
0.125 s = 0
x
z =1
0
x x x
= s
Re [ z ]
0.625 s
0.875 s
= 0.75 s
The mapping from the z plane to the s plane is a multivalued transformation since, as we have seen, s = ( 1 T ) ln z , and it is shown in complex variables textbooks that
ln z = ln z + j2n
(9.73)
924
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.74)
where k is a constant, and r i and p i represent the residues and poles respectively; these can be real or complex. Before we expand F ( z ) into partial fractions, we must express it as a proper rational function. This is done by expanding F ( z ) z instead of F ( z ) , that is, we expand it as
r1 r2 k F(z) ---------- = -- + ------------- + ------------- + z z p1 z p2 z
(9.75)
(9.76)
z = pk
we rewrite (9.75) as
r2 z r1 z F ( z ) = k + ------------- + ------------- + z p1 z p2
(9.77)
Example 9.4 Use the partial fraction expansion method to compute the Inverse Z transform of
1 F ( z ) = ----------------------------------------------------------------------------------1 1 1 ( 1 0.5 z ) ( 1 0.75 z ) ( 1 z )
(9.78)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
925
( 0.5 ) = ------------------------------------------------- = 2 ( 0.5 0.75 ) ( 0.5 1 ) ( 0.75 ) = ---------------------------------------------------- = 9 ( 0.75 0.5 ) ( 0.75 1 ) 1 = --------------------------------------------- = 8 ( 1 0.5 ) ( 1 0.25 )
2 2
z = 0.75
z=1
Then,
8 9 z 2 F( z) = ---------------------------------------------------------------------- = -------------------- + ----------------------- + --------------( z 0.5 ) ( z 0.75 ) ( z 1 ) z ( z 0.5 ) ( z 0.75 ) ( z 1 )
2
(9.79)
(9.80)
ans = z^3-9/4*z^2+13/8*z-3/8
926
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
r1 = 8.00 p1 = 1.00
syms n z fn=2*(0.5)^n9*(0.75)^n+8; Fz=ztrans(fn,n,z); simple(Fz)
r2 = -9.00 p2 = 0.75
r3 = 2.00 p3 = 0.50
% This is the answer in (9.80) % Verify answer by first taking Z transform of f[n]
ans = 8*z^3/(2*z-1)/(4*z-3)/(z-1)
iztrans(Fz) % Now, verify that Inverse of F(z) gives back f[n]
ans = 2*(1/2)^n-9*(3/4)^n+8 We can use Microsoft Excel to obtain and plot the values of f [ n ] . The spreadsheet of Figure 9.6 shows the first 25 values of n but only part of the spreadsheet is shown.
n f[n] 0.000 1.0000 1.000 2.2500 2.000 3.438 3.000 4.453 4.000 5.277 5.000 5.927 6.000 6.429 7.000 6.814 8.000 7.107 9.000 7.328 10.000 7.495 11.000 7.621 12.000 7.715 13.000 7.786 14.000 7.84 15.000 7.88
Figure 9.6. The discretetime sequence f [ n ] = 2 ( 0.5 ) 9 ( 0.75 ) + 8 for Example 9.4
n n
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
927
(9.81)
12 = ---------------------- = 3 2 ( 1 1)
z=1
12 = ---------------- = 6 (1 + 1) 12 = ------------------ = 3 2 (z + 1)
12 d r 3 = ----- ----------- dz z + 1
z=1
Then,
6 12 3 3 F(z) ---------- = ----------------------------------- = ---------------- + ------------------ + --------------2 ( z + 1 ) ( z 1 )2 ( z 1 ) z (z + 1)(z 1)
or
12z 6z 3z 3z F ( z ) = ----------------------------------- = ----------------------- + ------------------ + --------------2 ( z ( 1 ) ) ( z 1 )2 ( z 1 ) (z + 1 )(z 1 )
and
z nu 0 [ n ] -----------------2 (z 1)
(9.82)
ans =
928
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
denpol = z^3-z^2-z+1
num=[12 0]; den=[1 1 1 1]; fn=dimpulse(num,den,20) % The coefficients of the numerator of F(z) in (9.81) % The coefficients of the denominator in polynomial form % Compute the first 20 values of f[n]
fn = 0 0 12 12 24 24 36 36 48 48 60 60 72 72 84 84 96 96 108 108 The MATLAB function dimpulse(num,den) plots the impulse response of the polynomial transfer function G ( z ) = num ( z ) den ( z ) where num ( z ) and den ( z ) contain the polynomial coefficients in descending powers of z . Thus, the MATLAB script
num=[0 0 12 0]; den=[1 1 1 1]; dimpulse(num,den)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
929
Example 9.6 Use the partial fraction expansion method to compute the Inverse Z transform of
z+1 F ( z ) = ----------------------------------------------2 ( z 1 ) ( z + 2z + 2 )
(9.83)
Solution: Dividing both sides by z and performing partial fraction expansion, we obtain
r2 r3 r4 r1 F(z) z+1 ---------- = -------------------------------------------------- = --- + ---------- + ----------------------- + -----------------------2 z z 1 (z + 1 j) (z + 1 + j) z z ( z 1 ) ( z + 2z + 2 )
(9.84)
= 2 = 0.4 -5
z=1
z = 1+j
Then,
z+1 F(z) = 0.5 0.4 0.05 + j0.15 0.05 j0.15 ----------------------------------------------------------- = --------- + ---------- + ---------------------------- + ---------------------------2 (z + 1 + j) (z + 1 j) z1 z z z ( z 1 ) ( z + 2z + 2 )
or
930
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Recalling that
[n] 1
and
z n a u 0 [ n ] ---------za
jn135
) + 0.05 ( 2 e )
n j n135
) j0.15 ( 2 e
n
n j n135
or
3 2 2f [ n ] = 0.5 [ n ] + 0.4 + -------- cos n135 ------------ sin n135 10 10
n
(9.85)
We will use the MATLAB dimpulse function to display the first 8 values of f [ n ] in (9.85). We recall that his function requires that F ( z ) is expressed as a ratio of polynomials in descending order.
syms n z collect((z1)*(z^2+2*z+2)) % First, expand denominator of given F(z)
ans = z^3+z^2-2 The following script displays the first 10 values of f [ n ] and plots the impulse response shown in Figure 9.8.
num=[0 0 1 1]; den=[1 1 0 2]; fn=dimpulse(num,den,11), dimpulse(num,den,16)
fn = 0 0 1 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
931
C F ( z )z
n1
dz
(9.86)
where C is a closed curve that encloses all poles of the integrant, and by Cauchys residue theorem, this integral can be expressed as
f [n] =
Res [ F ( z )z
k
n1
]
z = pk
(9.87)
n1
] and Res [ F ( z )z
n1
] represents a residue at z = p k .
* This section may be skipped without loss of continuity. It is intended for readers who have prior knowledge of complex variables theory.
932
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.88)
(9.89)
n1
n2
(9.90)
z = pk
We are interested in the values f [ 0 ], f [ 1 ], f [ 2 ], , that is, values of n = 0, 1, 2, . For n = 0 , (9.90) becomes
f[0] =
z = pk
z=0
(9.91)
z=1
z = 0.75
The first term on the right side of (9.91) has a pole of order 2 at z = 0 ; therefore, we must evaluate the first derivative of
( z + 2z + 1 ) ---------------------------------------( z 1 ) ( z 0.75 )
3 2
z=1
( z + 2z + 1 ) + --------------------------------2 z (z 1)
z = 0.75
or
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
933
(9.92)
z=1
(9.93)
z = 0.75 3 2
3 2 ( z + 2z + 1 ) + ---------------------------------z(z 1) z=1
z = 0.75
For n 2 there are no poles at z = 0 , that is, the only poles are at z = 1 and z = 0.75 . Therefore,
f[n] =
3 2 n2 ( z + 2z + 1 )z ---------------------------------------------Res ( z 1 ) ( z 0.75 )
z = pk
(9.94)
3 2 n2 ( z + 2z + 1 )z = ---------------------------------------------( z 0.75 )
z=1
3 2 n2 ( z + 2z + 1 )z + ---------------------------------------------(z 1)
z = 0.75
for n 2 . From (9.94), we observe that for all values of n 2 , the exponential factor z z = 1 , but varies for values z 1 . Then,
( z + 2z + 1 ) f [ n ] = --------------------------------( z 0.75 )
3 3 2 n2
( z + 2z + 1 )z + --------------------------------------------(z 1) z=1
2 n2
n2 z = 0.75
(9.95)
934
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.96)
where the coefficients of [ n ] and [ n 1 ] are the residues that were found in (9.92) and (9.93) for n = 0 and n = 1 respectively at z = 0 . The coefficient 28 9 is multiplied by [ n ] to emphasize that this value exists only for n = 0 and coefficient 4 3 is multiplied by [ n 1 ] to emphasize that this value exists only for n = 1 . Check with MATLAB:
syms z n; Fz=(z^3+2*z^2+1)/(z*(z1)*(z0.75)); iztrans(Fz)
ans = 4/3*charfcn[1](n)+28/9*charfcn[0](n)+16-163/9*(3/4)^n We evaluate and plot f [ n ] for the first 20 values. This is shown on the spreadsheet of Figure 9.9.
n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 f[n] 1.000 3.750 5.813 8.359 10.270 11.702 12.777 13.582 14.187 14.640 14.980 15.235 15.426 15.570
Discrete Time Sequence of f[0] = 1, f[1] = 3.75, and f[n] = 16(163/9)*(3/4)n for n 2
16
12
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example 9.8 Use the inversion integral method to find the Inverse Z transform of
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
935
(9.97)
(9.98)
This function has no poles at z = 0 . The poles are at z = 1 and z = 0.75 . Then by (9.87),
f[n] =
2 n1
n+1
z = 0.75 n+1
(9.99)
z + --------------(z 1) z=1
n
z = 0.75
(9.100)
Solution: First, we multiply numerator and denominator by z 3 , expand the denominator to a polynomial, and arrange the numerator and denominator polynomials in descending powers of z . Then,
936
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Next, we use the MATLAB collect function to expand the denominator to a polynomial.
syms z; den=collect((z0.25)*(z0.5)*(z0.75))
(9.101)
5 1 81 2 1 + -- z + ----- z + 2 16 z + z + 2z + 3
3 3 2 11 3z -- z + ----- z ----2 16 32 3 2
Quotient
Dividend
5 2 21 -- z + ----- z + 35 ----2 16 32
1st Remainder
(9.102)
f [n] z
n=0
= f [ 0 ] + f [ 1 ]z
+ f [ 2 ]z
(9.103)
(9.104)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
937
fn = 1.0000 2.5000 5.0625 8.9688 10.2070 9.6191 8.2522 6.7220 5.3115 4.1195 3.1577 2.4024 1.8189 1.3727 1.0338
Table 9.4 lists the advantages and disadvantages of the three methods of evaluating the Inverse Z transform.
938
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.105)
where a i and b i are constant coefficients. In a compact form, relation (9.105) is expressed as
y [n] =
i=0
ai x [ n i ]
bi y [ n i ]
i=0
(9.106)
Assuming that all initial conditions are zero, taking the Z transform of both sides of (9.106), and using the Z transform pair
[f [n m]] z
m
F(z )
k
we obtain
Y ( z ) + b1 z Y ( z ) + b2 z Y ( z ) + + bk z Y ( z ) = a0 X ( z ) + a1 z X ( z ) + a2 z X ( z ) + + ak z X ( z )
1 2 k 1 2
(9.107)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
939
+ b2 z
+ + b k z )Y ( z )
1
= ( a0 + a1 z
1
+ a2 z
2
+ + ak z ) X ( z )
k
(9.108)
a0 + a1 z + a2 z + + ak z Y ( z ) = -------------------------------------------------------------------------- X ( z ) 1 2 k 1 + b1 z + b2 z + + bk z
(9.109)
(9.110)
(9.111)
The discrete impulse response h [ n ] is the response to the input x [ n ] = [ n ] , and since
Z {[n]}
[ n ]z
n=0
= 1
we can find the discretetime impulse response h [ n ] by taking the Inverse Z transform of the discrete transfer function H ( z ) , that is,
h[ n] =
{H(z)}
(9.112)
Example 9.10 The difference equation describing the inputoutput relationship of a discretetime system with zero initial conditions, is
y [ n ] 0.5y [ n 1 ] + 0.125y [ n 2 ] = x [ n ] + x [ n 1 ]
(9.113)
Compute: a. The transfer function H ( z ) b. The discretetime impulse response h [ n ] c. The response when the input is the discrete unit step u 0 [ n ]
940
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and thus
z +z Y(z) 1+z H ( z ) = ----------- = ------------------------------------------------ = ---------------------------------------1 2 2 X(z) 1 0.5 z + 0.125z z 0.5z + 0.125
1 2
(9.114)
b. To obtain the discretetime impulse response h [ n ] , we need to compute the Inverse Z transform of (9.114). We first divide both sides by z and we obtain:
z+1 H(z) ----------- = ---------------------------------------2 z z 0.5z + 0.125
(9.115)
Using the MATLAB residue function, we obtain the residues and the poles of (9.115) as follows:
num=[0 1 1]; den=[1 0.5 0.125]; [num,den]=residue(num,den);fprintf(' \n');... disp('r1 = '); disp(num(1)); disp('p1 = '); disp(den(1));... disp('r2 = '); disp(num(2)); disp('p2 = '); disp(den(2))
or
( 0.5 j2.5 )z ( 0.5 + j2.5 )z ( 0.5 j2.5 )z ( 0.5 + j2.5 )z H ( z ) = ------------------------------------------ + ----------------------------------------- = -------------------------------------- + --------------------------------------j45 j 45 z ( 0.25 + j0.25 ) z ( 0.25 j0.25 ) z 0.25 2e z 0.25 2e
(9.116)
Recalling that
zn a u 0 [ n ] ---------za
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
941
j 45 n
] + 0.5 [ ( 0.25 2 ) e
] ]
n jn45
jn45
] + j2.5 [ ( 0.25 2 ) e
j n45
n j n45
jn45
+e
) ] j2.5 ( 0.25 2 ) ( e
j n45
or
(9.117)
c. From Y ( z ) = H ( z )X ( z ) , the transform u 0 [ n ] ----------- , and using the result of part (a) we obtain:
2 z +z z z(z + z) Y ( z ) = ---------------------------------------- ---------- = -------------------------------------------------------------2 2 z 0.5z + 0.125 z 1 ( z 0.5z + 0.125 ) ( z 1 ) 2
or
(z + z) Y ( z ) = -----------------------------------------------------------------------2 z ( z 0.5z + 0.125 ) ( z 1 )
2
(9.118)
We will use the MATLAB residue function to compute the residues and poles of expression (9.117). First, we must express the denominator as a polynomial.
syms z; denom=(z^20.5*z+0.125)*(z1); collect(denom)
(9.119)
r1 = 3.2000 p1 = 1.0000 r2 =
942
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(9.120)
or
3.2z ( 1.1 + j0.3 )z ( 1.1 j 0.3 )zY ( z ) = ---------- + ----------------------------------- + ---------------------------------z 1 z 0.25 j 0.25 z 0.25 + j0.25 3.2z ( 1.1 + j0.3 )z ( 1.1 j 0.3 )z = ---------- + -------------------------------------- + --------------------------------------z 1 z 0.25 2e j45 z 0.25 2e j 45
(9.121)
Recalling that
zn a u 0 [ n ] ---------za
j 45 n
+e
n
j n45
jn45
j n45
)]
or
2 2 y [ n ] = 3.2 2.2 ------ cos n45 0.6 ------ sin n45 4 4 2 = 3.2 ------ ( 2.2 cos n45 + 0.6 sin n45 ) 4
n
(9.122)
The plots for the discretetime sequences h [ n ] and y [ n ] are shown in Figure 9.13. The plot for y [ n ] can be readily obtained with the Simulink model shown in Figure 9.14 where in the Function Block Parameters dialog box for the Discrete Transfer Fcn block the Numerator and Denominator coefficients were specified as [ 1 1 0 ] and [ 1 0.5 0.125 ] respectively in accordance with the transfer function of relation (9.114), Page 941, where we found that
1+z Y(z) z +z H ( z ) = ----------- = ------------------------------------------------ = ---------------------------------------1 2 2 X(z) 1 0.5 z + 0.125z z 0.5z + 0.125
1 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
943
n 0.000 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000
h[n] 1.000 1.500 0.625 0.125 -0.02 -0.02 -0.010 -0 0.000 0.000 0.000 3E-05 -0 -0
y[n] 1.000 2.500 3.125 3.250 3.234 3.211 3.201 3.199 3.199 3.200 3.200 3.200 3.200 3.200
The plot for y [ n ] , displayed on the Scope block of Figure 9.14, is shown in Figure 9.15.
944
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
State Equations for DiscreteTime Systems 9.8 State Equations for DiscreteTime Systems
As with continuous time systems, we choose state variables for discretetime systems, either from block diagrams that relate the inputoutput information, or directly from a difference equation. Consider the block diagram of Figure 9.16.
u b + +
dt
A d
We learned in Chapter 5 that the state equations representing this continuous time system are
x = Ax + bu y = Cx + du
(9.123)
In a discretetime block diagram, the integrator is replaced by a delay device. The analogy between an integrator and a unit delay device is shown in Figure 9.17.
x(t)
dt
x( t)
x[ n + 1] Delay
x[n]
discretetime
Z{x[ n + 1]}
sdomain
z zdomain
Z{x[ n] }
(9.124)
where u [ n ] is any input, and y [ n ] is the output. Write the discretetime state equations for this system.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
945
(9.125)
Then,
x3 [ n + 1 ] = y [ n + 3 ] x2 [ n + 1 ] = y [ n + 2 ] = x3 [ n ] x1 [ n + 1 ] = y [ n + 1 ] = x2 [ n ]
(9.126)
n1i
b [ i ]u [ i ]
(9.127)
i=0
(9.128)
We can use the MATLAB c2d function to convert the continuoustime statespace equation
x ( t ) = Ax ( t ) + bu ( t )
(9.129)
(9.130)
946
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
where
A = 0 1 3 4
and b = 0
1
(9.131)
0.0820 0.6588
(9.132)
We can invoke the MATLAB command help d2c to obtain a detailed description of this function.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
947
f [ n ]z
n=0
and it is denoted as
F( z) = The Inverse Z transform is defined as
Z {f [n]}
1 k1 dz f [ n ] = ------- F ( z )z j2
and it is denoted as
f [n] =
{ F(z )}
The linearity property of the Z transform states that af 1 [ n ] + bf 2 [ n ] + cf 3 [ n ] + aF 1 ( z ) + bF 2 ( z ) + cF 3 ( z ) + The shifting of f [ n ]u 0 [ n ] where u 0 [ n ] is the discrete unit step function, produces the Z trans-
form pair
f [ n m ]u 0 [ n m ] z
m
F(z )
The right shifting of f [ n ] allows use of non-zero values for n < 0 and produces the Z transform
pair
f [n m] z
m
F(z) +
m1 n=0
f [ n m ]z
948
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
The mth left shifting of f [ n ] where m is a positive integer, produces the Z transform pair f [n + m] z F(z) +
m
n = m
f [ n + m ]z
z n a f [n] F - a Multiplication by e
naT
f [n] F(e z )
aT
Multiplications by n and n 2 produce the Z transform pairs d nf [ n ] z ----- F ( z ) dz d 2 2d n f [ n ] z ----- F ( z ) + z ------- F ( z ) 2 dz dz The summation property of the Z transform states that
2
0 f [ m ] ----------- F ( z ) z1 m=
z Convolution in the discretetime domain corresponds to multiplication in the z -domain, that
is,
f 1 [ n ] f 2 [ n ] F 1 ( z ) F 2 ( z ) Multiplication in the discretetime domain corresponds to convolution in the z -domain, that
is,
1 f 1 [ n ] f 2 [ n ] -------j 2 - v xF ( v )F -- v z
1 2
dv
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
949
lim f [ n ] = lim ( z 1 ) F ( z )
z1
The Z transform of the geometric sequence 0 f [n] = n a n = 1, 2, 3, n = 0, 1, 2, 3, z---------- for z > a za = unbounded for z < a
is
Z [a ] =
n
a z
n=0
n n
The Z transform of the discrete unit step function u 0 [ n ] shown below u0 [ n ] 0 u0 [ n ] = 1 n<0 n0
0 1
....
n
is
Z [ u0 [ n ] ] =
[ 1 ]z
n=0
is
Z [ enaT ]
for e
aT 1
z 1 = -------------------------- = ----------------- aT aT 1 ze 1e z
<1
The Z transforms of the discretetime functions f 1 [ n ] = cos n aT and f 2 [ n ] = sin naT are
respectively
950
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Summary
z 2 z cos aT cos naT ----------------------------------------z 2 2z cos aT + 1 z sin a T sin n aT ----------------------------------------2 z 2z cos aT + 1 for z > 1 for z > 1
The Z transform of the discrete unit ramp f [ n ] = nu 0 [ n ] is z nu 0 [ n ] -----------------2 (z 1) The Z transform can also be found by means of the contour integral 1F ( s ) = ------j2
F(v) -------------------------- dv sT vT 1e e
z = e
sT
and
1 s = -- ln z T The relation F(z) = G(s)
1 s = -- ln z T
The discretetime system transfer function H ( z ) is defined as a0 + a1 z + a2 z + + ak z N(z) H ( z ) = ----------- = -------------------------------------------------------------------------1 2 k D(z) 1 + b1 z + b2 z + + bk z
1 2 k
The input X ( z ) and output Y ( z ) are related by the system transfer function H ( z ) as Y ( z ) = H ( z )X ( z ) The discretetime impulse response h [ n ] and the discrete transfer function H ( z ) are related
as
h[n] =
{H(z)}
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
951
n1i
b [ i ]u [ i ]
i=0
The MATLAB c2d function converts the continuous time state space equation x ( t ) = Ax ( t ) + bu ( t )
952
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
n = 0, 1, 2, , m 1 otherwise
2. Find the Z transform of a p [ n ] where p [ n ] is defined as in Exercise 1. 3. Prove the following Z transform pairs: a. [ n ] 1 d. b. [ n 1 ] z
m
c. na u 0 [ n ] ----------------2
n
az
(z a)
2
az ( z + a ) 2 n n a u 0 [ n ] --------------------3 (z a)
e. [ n + 1 ]u 0 [ n ] -----------------2
(z 1)
1
[ F ( z ) ] given that
A F ( z ) = ------------------------------------------------1 1 ( 1 z ) ( 1 0.5z )
5. Use the partial fraction expansion method to compute the Inverse Z transform of
z F ( z ) = -----------------------------------------2 ( z + 1 ) ( z 0.75 )
2
7. Use the long division method to compute the first 5 terms of the discretetime sequence whose Z transform is
z +z z F ( z ) = ----------------------------------------------1 2 3 1 + z + z + 4z
1 2 3
8.
naT
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
953
a. Compute the discrete transfer function H ( z ) b. Compute the response to the input x [ n ] = e
naT
where
y [ n ] = 0 for n < 0
a. Compute the transfer function H ( z ) b. Compute the impulse response h [ n ] c. Compute the response when the input is x [ n ] = 10 for n 0 11. Given the discrete transfer function
z+2 H ( z ) = ---------------------------2 8z 2z 3
write the difference equation that relates the output y [ n ] to the input x [ n ] .
954
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
p [ n ] = u0 [ n ] u0 [ n m ] z u 0 [ n ] ---------z1 m z u 0 [ n m ] z ---------z1
Z{p[ n] }
2.
z n a f [n] F - a
Then,
n 1a z a p [ n ] 1 ( z a ) - = ( a z ) a - = ----------------------------------- = ---------------------------------) = -------------------------------------------------- --------------------------------------- a ( a z ) a ( a z 1 1 1 1 m 1 1 1 1 1 1 (z a) a (a z ) a(a z ) 1 az (a z ) a m m m m 1 m m m m m m m
or
z(1 a z ) n a p [ n ] ------------------------------za
m m
3.
a.
Z{[n]} =
[ n ]z
n=0
= [ 0 ]z
= 1
b.
Z{[n m]} =
[ n m ]z
n=0
[ 0 ]z
n=0
= z
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
955
d.
956
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
The term ( n + 1 )u 0 [ n ] represents the sum of the first n values, including n = 0 , of u 0 [ n ] and thus it can be written as the summation
g [ n ] = ( n + 1 )u 0 [ n ] =
u0 [ k ]
k=0
Since summation in the discretetime domain corresponds to integration in the continuous time domain, it follows that
u 1 [ n ] = ( n + 1 )u 0 [ n ]
where u 1 [ n ] represents the discrete unit ramp. Now, from the summation in time property,
k=0
f [ k ] ----------- F ( z ) z1
z
and thus
z [ n + 1 ]u 0 [ n ] -----------------2 (z 1)
2
4. First, we multiply the numerator and denominator by z to eliminate the negative exponents of z .
2
Then, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
957
or
r1 r2 F ( z ) = ------------------------------------- = ---------- + --------------Az ---------z ( z 1 ) ( z 0.5 ) z 1 z 0.5 Az r 1 = --------------z 0.5 = 2A
z=1
Azr 2 = ---------z1
= A
z = 0.5
Since
z ---------- 1 z1 z---------- a n za
it follows that
Z
5.
1 n 1 n [ F ( z ) ] = f [ n ] = 2A A -- = A 2 -- 2 2
With z = 0.75 (2) reduces to 1.75r 3 = 0.75 from which r 3 = 3 7 With z = 1 (2) reduces to ( 1.75 ) r 1 = 1 from which r 1 = 16 49
2
or ( 3 4 ) ( 16 49 ) ( 3 4 )r 2 + 3 7 = 0 from which r 2 = 16 49
2
958
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
z z1
za
(z a)
z + 2z + 1 F ( z ) = ---------------------------------------z ( z 1 ) ( z 0.5 )
Res [ F ( z )z
k 3 2
n1
]
z = pk n2
Next, we examine z to find out if there are any values of n for which there is a pole at the origin. We observe that for n = 0 there is a second order pole at z = 0 because
n2
n2 n=0
= z
1 = ---2 z
Also, for n = 1 there is a simple pole at z = 0 . But for n 2 the only poles are z = 1 and z = 0.5 . Then, following the same procedure as in Example 9.12, for n = 0 we obtain:
f[0] =
z = pk
z=0
z=1
z = 0.5
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
959
z=1
( z + 2z + 1 ) + --------------------------------2 z (z 1)
z = 0.5
For n = 1 , it reduces to
f[1] =
z = 0.5
or
( z + 2z + 1 ) f [ 1 ] = ---------------------------------------( z 1 ) ( z 0.75 )
3 2
z = 0.5
= 2 + 8 13 ( 0.5 ) = 3.5
For n 2 there are no poles at z = 0 , that is, the only poles are at z = 1 and z = 0.5 . Therefore,
f[ n] =
3 2 n2 ( z + 2z + 1 )z = ---------------------------------------------( z 0.5 )
z=1
3 2 n2 ( z + 2z + 1 )z + ---------------------------------------------(z 1)
z = 0.5
for n 2 .
960
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
where the coefficients of [ n ] and [ n 1 ] are the residues that were found for n = 0 and n = 1 at z = 0 .The coefficient 6 is multiplied by [ n ] to emphasize that this value exists only for n = 0 and coefficient 2 is multiplied by [ n ] to emphasize that this value exists only for n = 1 . Check with MATLAB:
syms z n; Fz=(z^3+2*z^2+1)/(z*(z1)*(z0.5)); iztrans(Fz)
z 2 z
2
+ z
Quotient Dividend
z +z1 z +z+1+ z 2 z
2 1
1 1 1
1st Remainder 2z
2
22z
2z
z + 2z + 2z 1 z +
2nd Remainder
Therefore,
F ( z ) = z 2 z
1 3
+ z
+ (1) + f[3] z
3
Also,
F(z) =
f [ n ]z
0
= f[ 0] + f[ 1] z
+ f[2] z
+ f[4 ] z
+ (2)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
961
8.
a.
y [ n ] y [ n 1 ] = Tx [ n 1 ]
and thus b.
z X ( z ) = ----------------- aT ze
Then, or
T z Tz Y ( z ) = H ( z )X ( z ) = ---------- ------------------ = ------------------------------------------ aT z 1 z e aT (z 1) (z e ) r2 r1 T Y(z) ----------- = ------------------------------------------- = ---------- + ------------------ (1) aT z z 1 z e aT (z 1) (z e ) T r 1 = ----------------- aT ze T = ----------------- aT 1e T r 2 = ---------z1 T = ----------------- aT 1e
z=1
z=e
aT
9.
a.
T y [ n ] y [ n 1 ] = -- { x [ n ] + x [ n 1 ] } 2
962
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and thus
T 1+z T z+1 H ( z ) = Y ( z ) = -- ---------------- = -- --------------------2 1 z 1 2 z1 X(z)
1
b.
x[ n] = e
naT
z X ( z ) = ----------------- aT ze
Then,
T z+1 z Tz ( z + 1 ) Y ( z ) = H ( z )X ( z ) = -- ----------- ------------------ = ---------------------------------------------- aT aT 2 z1 ze 2( z 1) (z e )
or
r2 r1 Y(z) T(z + 1) ----------- = ----------------------------------------------- = ---------- + ------------------ (1) aT z z 1 z e aT 2(z 1) (z e ) T z+1 r 1 = -- -----------------2 z e aT T z+1 r 2 = -- ----------2 z1 2 T T = -- ------------------ = ----------------- aT 2 1 e aT 1e T e +1 T = -- ------------------ = ----------------- aT 2 e aT 1 1e
aT
z=1
z=e
aT
10. a.
y[ n] + y[n 1] = x[n] y [ n ] = 0 for n < 0
Taking the Z transform of both sides we obtain Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
963
and thus
1 z z H ( z ) = Y ( z ) = ---------------- = ----------- = ---------------------------1 X(z) z + 1 z ( 1 ) 1+z
b.
z - 1 1 n h [ n ] = Z { H ( z ) } = Z ------------------ = ( 1 ) z ( 1 )
c.
x [ n ] = 10 for n 0 z X ( z ) = 10 ---------z1
2 10z z 10z Y ( z ) = H ( z )X ( z ) = ----------- ---------- = -------------------------------z+1 z1 (z + 1)(z 1)
11.
z+2 H ( z ) = ---------------------------2 8z 2z 3
964
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Chapter 10
The DFT and the FFT Algorithm
his chapter begins with the actual computation of frequency spectra for discrete time systems. For brevity, we will use the acronyms DFT for the Discrete Fourier Transform and FFT for Fast Fourier Transform algorithm respectively. The definition, theorems, and properties are also discussed, and several examples are presented to illustrate their uses.
In this chapter we will see that a periodic and discrete time function results in a periodic and discrete frequency function. For convenience, we summarize these facts in Table 10.1.
TABLE 10.1 Characteristics of Fourier and Z transforms Topic Time Function Frequency Function
In our subsequent discussion we will denote a discrete time signal as x [ n ] , and its discrete frequency transform as X [ m ] . Let us consider again the definition of the Z transform, that is,
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
101
f [ n ]z
n=0
(10.1)
) =
f [ n ]e
n=0
nj T
(10.2)
This represents an infinite summation; it must be truncated before it can be computed. Let this truncated version be represented by
X[m] =
N1
x [ n ]e
mn j2 ------N
(10.3)
n=0
where N represents the number of points that are equally spaced in the interval 0 to 2 on the unit circle of the z -plane, and
2 = ------- m NT
for m = 0, 1, 2, , N 1 . We refer to relation (10.3) as the N point DFT of X [ m ] . The Inverse DFT is defined as
j2 1 N1 x [ n ] = --X [ m ]e N
mn ------N
(10.4)
m=0
for n = 0, 1, 2, , N 1 . In general, the discrete frequency transform X [ m ] is complex, and thus we can express it as
X [ m ] = Re { X [ m ] } + Im { X [ m ] }
(10.5)
for m = 0, 1, 2, , N 1 . Since
e
mn j2 ------N
(10.6)
x [ n ]e
mn j2 ------N
N1
n=0
n=0
(10.7)
n=0
102
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
n=1
x [ n ] cos --------------N
2mn
for m = 0, 1, 2, , N 1
(10.8)
n=1
x [ n ] sin --------------N
2mn
for m = 0, 1, 2, , N 1
(10.9)
We observe that the summation in (10.8) and (10.9) is from n = 1 to n = N 1 since x [ 0 ] appears in (10.8). Example 10.1 A discrete time signal is defined by the sequence
x [ 0 ] = 1, x [ 1 ] = 2, x [ 2 ] = 2, and x [ 3 ] = 1
and x [ n ] = 0 for all other n . Compute the frequency components X [ m ] . Solution: Since we are given four discrete values of x [ n ] , we will use a 4 point DFT, that is, for this example, N = 4 . Using (10.8) with n = 0, 1, 2, and 3 , we obtain
Re { X [ m ] } = x [ 0 ] +
n=1
x [ n ] cos --------------N
2mn
(10.10)
(10.11)
Now, we compute the imaginary components using (10.9). For this example, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
103
x [ n ] sin --------------N
n=1
2mn
(10.12)
The discrete frequency components X [ m ] for m = 0, 1, 2 , and 3 are found by addition of the real and imaginary components X re [ i ] of (10.11) and X im [ i ] of (10.12). Thus,
X [ 0 ] = 6 + j0 = 6 X [1] = 1 j X [ 2 ] = 0 + j0 = 0 X [3] = 1 + j
(10.13)
Example 10.2 Use the Inverse DFT, i.e., relation (10.4), and the results of Example 10.1, to compute the values of the discrete time sequence x [ n ] . Solution: Since we are given four discrete values of x [ n ] , we will use a 4 point DFT, that is, for this example, N = 4 . Then, (10.4) for m = 0, 1, 2, and 3 , reduces to
1 x [ n ] = -4
X [ m ]e
m=0
mn j2 ------4
1 = -4
X [ m ]e
m=0 jn
mn j ------2
(10.14)
+ X [ 3 ]e
3n j ----2
1 = -- X [ 0 ] + X [ 1 ]e 4
n j -2
+ X [ 2 ]e
104
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
We observe that these are the same values as in Example 10.1. We will check the answers of Examples 10.1 and 10.2 with MATLAB and Excel. With MATLAB, we use the fft(x) function to compute the DFT, and the ifft(x) function to compute the Inverse DFT.
xn=[1 2 2 1]; Xm=fft(xn) % The discrete time sequence of Example 10.1 % Compute the FFT of this discrete time sequence
Xm = 6.0000
-1.0000-1.0000i
-1.0000+1.0000i
Xm = [6 1j 0 1+j]; xn=ifft(Xm)
% The discrete frequency components of Example 10.2 % Compute the Inverse FFT
xn = 1.0000
2.0000+0.0000i
2.0000
1.0000-0.0000i
To use Excel for the computation of the DFT, the Analysis ToolPak must have been installed. If not, it can installed it by clicking AddIns on the Tools drop menu, and following the instructions on the screen. With Excels Fourier Analysis Tool, we get the spreadsheet shown in Figure 10.1. The instructions on how to use it, are given on the spreadsheet. The term e ( j2 ) N is a rotating vector, where the range 0 2 is divided into 360 N equal segments. Therefore, it is convenient to represent it as W N , that is, we let
WN = e
j2 -------N
(10.15)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
105
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
A B C D E Input data x(n) are same as in Example 10.1 and are entered in cells A11 through A14 From the Tools drop down menu, we select Data Analysis and from it, Fourier Analysis The Input Range is A11 through A14 (A11:A14) and the Output Range is B11 through B14 (B11:B14) x(n) 1 2 2 1 X(m) 6 -1-i 0 -1+i
To obtain the discrete time sequence, we select Inverse from the Fourier Analysis menu Input data are the same as in Example 10.2 The Input Range is A25 through A28 (A25:A28) and the Output Range is B25 through B28 (B25:B28) X(m) 6 -1-j 0 -1+j x(n) 1 2 2 1
Figure 10.1. Using Excel to find the DFT and Inverse DFT
and consequently
WN = e
1
j2 -------N
(10.16)
x ( n )WN
mn
(10.17)
n=0
and
1N1 m n x [ n ] = --X ( m )W N N
(10.18)
n=0
106
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(10.19)
In Example 10.1, we found that, although the discrete time sequence x [ n ] is real, the discrete frequency sequence X [ m ] is complex. However, in most applications we are interested in X [ m ] , that is, the magnitude of X [ m ] . Example 10.3 Use MATLAB to compute the magnitude of the frequency components of the following discrete time function. Then, use Excel to display the time and frequency values.
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9] x[10] x[11] x[12] x[13] x[14] x[15] 1.0 1.5 2.0 2.3 2.7 3.0 3.4 4.1 4.7 4.2 3.8 3.6 3.2 2.9 2.5 1.8
Solution: We compute the magnitude of the frequency spectrum with the MATLAB script below.
xn=[1 1.5 2 2.3 2.7 3 3.4 4.1 4.7 4.2 3.8 3.6 3.2 2.9 2.5 1.8]; magXm=abs(fft(xn));... fprintf(' \n'); fprintf('magXm1 = %4.2f \t', magXm(1)); fprintf('magXm2 = %4.2f \t', magXm(2));... fprintf('magXm3 = %4.2f \t', magXm(3)); fprintf(' \n'); fprintf('magXm4 = %4.2f \t', magXm(4));... fprintf('magXm5 = %4.2f \t', magXm(5)); fprintf('magXm6 = %4.2f \t', magXm(6)); fprintf(' \n');... fprintf('magXm7 = %4.2f \t', magXm(7)); fprintf('magXm8 = %4.2f \t', magXm(8));... fprintf('magXm9 = %4.2f \t', magXm(9)); fprintf(' \n');... fprintf('magXm10 = %4.2f \t', magXm(10)); fprintf('magXm11 = %4.2f \t', magXm(11)); ... fprintf('magXm12 = %4.2f \t', magXm(12)); fprintf(' \n');... fprintf('magXm13 = %4.2f \t', magXm(13)); fprintf('magXm14 = %4.2f \t', magXm(14));... fprintf('magXm15 = %4.2f \t', magXm(15))
magXm1 = 46.70 magXm4 = 2.41 magXm7 = 0.07 magXm10 = 0.47 magXm13 = 0.22
magXm2 = 11.03 magXm5 = 0.22 magXm8 = 0.47 magXm11 = 0.07 magXm14 = 2.41
Now, we use Excel to plot the x [ n ] and X [ m ] values. These are shown in Figure 10.2.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
107
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
A B C D n x(n) m |X(m)| 0 1.0 0 46.70 1 1.5 1 11.03 2 2.0 2 0.42 3 2.3 3 2.41 4 2.7 4 0.22 5 3.0 5 1.19 6 3.4 6 0.07 7 4.1 7 0.47 8 4.7 8 0.10 9 4.2 9 0.47 10 3.8 10 0.07 11 3.6 11 1.19 12 3.2 12 0.22 13 2.9 13 2.41 14 2.5 14 0.42 15 1.8 15 11.03
G
x(n) 4.7 4.1 3.4 2.7 3.0
2.3
46.70
|X(m)|
11.03
2.41
1.19
0.47
0.42
0.47
1.19
2.41
0.22
0.07
0.10
On the plot of X [ m ] in Figure 10.2, the first value X [ 0 ] = 46.70 represents the DC component. We observe that after the X [ 8 ] = 0.10 value, the magnitude of the frequency components for the range 9 m 15 , are the mirror image of the components in the range 1 m 7 . This is not a coincidence; it is a fact that if x [ n ] is an N point real discrete time function, only N 2 of the frequency components of X [ m ] are unique. Figure 10.3 shows typical discrete time and frequency magnitude waveforms, for a N = 16 point DFT.
108
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0.07
0.22
0.42
11.03
X[m]
Next, we will examine the even and odd properties of the DFT.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
109
The even and odd properties of the DFT shown in Table 10.2 can be proved by methods similar to those that we have used for the continuous Fourier transform. For instance, to prove the first entry we expand
X [m] =
N1
x [ n ]WN
mn
n=0
into its real and imaginary parts using Eulers identity, and we equate these with the real and imaginary parts of X [ m ] = X re [ m ] + jX im [ m ] . Now, since the real part contains the cosine, and the imaginary contains the sine function, and cos ( m ) = cos m while sin ( m ) = sin m , this entry is proved.
and
x[ n] =
D{x [n]}
1
(10.24) (10.25)
10.3.1 Linearity
{X [m]}
ax 1 [ n ] + bx 2 [ n ] + aX 1 [ m ] + bX 2 [ m ] +
(10.26)
1010 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(10.27)
Proof: By definition,
D{x [n]}
N1
x [ n ]WN
mn
n=0
and if x [ n ] is shifted to the right by k sampled points for k > 0 , we must change the lower and upper limits of the summation from 0 to k , and from N 1 to N + k 1 respectively. Then, replacing x [ n ] with x [ n k ] in the definition above, we obtain
D{x[n k]}
N+k1
x [ n k ]W N
mn
(10.28)
n=k
Now, we let n k = ; then n = k + , and when n = k , = 0 . Therefore, the above relation becomes
D{x []}
N1
m(k + ) x [ ]W N
N1
= W
km
x []WN
= WN X [ ] = WN X [ m ]
km
km
(10.29)
=0
=0
We must remember, however, that although the magnitudes of the frequency components are not affected by the shift, a phase shift of 2km N radians is introduced as a result of the time shift. To prove this, let us consider the relation y [ n ] = x [ n k ] . Taking the DFT of both sides of this relation, we obtain
Y [ m ] = W N X [ m ] = X [ m ]e
km 2km j -------------N
2 km = X [ m ] ----------------N
(10.30)
Since both X [ m ] and Y [ m ] are complex quantities, they can be expressed in magnitude and phase angle form as
X [ m ] = X [ m ]
and
Y [ m ] = Y [ m ]
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1011
(10.31)
(10.32)
x [ n ] X [ m k ]
(10.33)
Proof:
D { W Nkn x [ n ] } N1
WN
k m
x [ n ]W N
mn
N1
x [ n ]WN
( m k )n
(10.34)
n=0
n=0
and we observe that the last term on the right side of (10.34) is the same as D { x [ n ] } except that m is replaced with m k . Therefore,
D { WN k m x [ n ] }
= X[m k]
(10.35)
(10.36)
Proof: Since
x [ n ] h [ n ] =
N1
x [ n ]h [ n k ]
WN
mn
then,
k=0
D { x [ n ] h [ n ] }
N1
N1
x [ k ]h [ n k ]
(10.37)
n=0
k=0
Next, interchanging the order of the indices n and k in the lower limit of the summation, and also changing the range of summation from N 1 to N + k 1 for the bracketed term on the right side of (10.37), we obtain
1012 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
x[k]
N+k1
h [ n k ] WN
kn
(10.38)
k=0
n=k
n=k
h [ n k ] WN = WN H [ m ]
kn
kn
(10.39)
D { x [ n ] h [ n ] }
N1
x [ k ] [ WN
kn
(10.40)
k=0
X [ k ]Y [ m k ] =
1 --- X [ m ] Y [ m ] N
(10.41)
k=0
Proof: The proof is obtained by taking the Inverse DFT, changing the order of the summation, and letting m k = .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1013
These quantities are shown in Figure 10.4. Thus, we have the relations
T t t = ----t N 1 f s = -tt T t f = ----f N 1t t = ---Tf 1t f = ---Tt
(10.42)
1014 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
tt
n
N (Start of New Period)
N1 (End of Period)
X[m]
Tf
tf
0
(N/2)1 N/2 (N/2)+1 N1 N
(End of Period)
Figure 10.4. Intervals between samples and periods in discrete time and frequency domains
Example 10.4 The period of a periodic discrete time function is 0.125 millisecond, and it is sampled at 1024 equally spaced points. It is assumed that with this number of samples, the sampling theorem is satisfied and thus there will be no aliasing. a. Compute the period of the frequency spectrum in KHz . b. Compute the interval between frequency components in KHz . c. Compute the sampling frequency f s d. Compute the Nyquist frequency f n
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1015
d. the Nyquist frequency must be equal or less than half the sampling frequency, that is,
1 1 f n -- f s -- 8.2 MHz 4.1 MHz 2 2
(10.43)
To compute the number of operations required to complete this task, let us expand the N point DFT defined as
X[m] =
N1
x [ n ]WN
mn
(10.44)
n=0
1016 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(10.45)
(N 1)
2
+ x [ 2 ]W N
j 2 ( 0 ) ---- N
2(N 1)
+ + x [ N 1 ]W N
= e
= 1
(10.46)
Since W N is a complex number, the computation of any frequency component X [ k ] , requires N complex multiplications and N complex additions, that is, 2N complex arithmetic operations are required to compute any frequency component of X [ k ] . If we assume that x [ n ] is real, then only N 2 of the | X [ m ] components are unique. Therefore, we would require 2N N 2 = N complex operations to compute the entire frequency spectrum. Thus, for an N = 1024 point
2
DFT, such as the one with 18 KHz signal, we would require N = 1024 = 1048576 complex operations, and these would have to be completed within 20.48 ms as we found in (10.43). Although the means of doing this task may be possible with todays technology, it seems impractical.
2 2
Fortunately, many of the W N terms in (10.45) are unity. Moreover, because of some symmetry properties, the number of complex operations can be reduced considerably. This is possible with the algorithm known as FFT (Fast Fourier Transform) that was developed by Cooley and Tukey, and it is very well documented. This algorithm is the subject of the next section.
(10.47)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1017
= e = e = e
j2
= 1 = 1 = j = j = 1 k = 0, 1, 2, = 1 WN = WN
r r
= e = e = e
N4
j 2
3N 4
= e = e
j3 2
(10.48)
WN = e WN
kN + r
kN
j2k
= e = e
j2 -------- ( kN + r ) N j2 -------- k 2N
j2 j2 -------- kN -------- r N N e e k2
k W 2N
= e
j2 k -------- - N 2
= WN
WN
WN
WN
WN WN
N1
2(N 1)
(N 1)
2
WN
(10.49)
(10.50)
The algorithm that was developed by Cooley and Tukey, is based on matrix decomposition methods, where the matrix W N in (10.50) is factored into L smaller matrices, that is,
WN = W1 W2 WL
(10.51)
Each row of the matrices on the right side of (10.51) contains only two non-zero terms, unity and
W N . Then, the vector X [ m ] is obtained from
k
1018 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(10.52)
The FFT computation begins with matrix W L in (10.52). This matrix operates on vector x [ n ] producing a new vector, and each component of this new vector, is obtained by one multiplication and one addition. This is because there are only two nonzero elements on a given row, and one of these elements is unity. Since there are N components on x [ n ] , there will be N complex additions and N complex multiplications. This new vector is then operated on by the [ W L 1 ] matrix, then on [ W L 2 ] , and so on, until the entire computation is completed. It appears that the entire computation would require NL = Nlog 2 N complex multiplications, and also Nlog 2 N additions for a total of 2Nlog 2 N arithmetic operations. However, since W N = 1 , W N
0 2 N2
= 1 ,
and other reductions, it is estimated that only about half of these, that is, Nlog 2 N total arithmetic operations are required by the FFT versus the N computations required by the DFT. Under those assumptions, we construct Table 10.3 to compare the percentage of computations achieved by the use of FFT versus the DFT.
TABLE 10.3 DFT and FFT Computations DFT N 8 16 32 64 128 256 512 1024 2048 N
2
A plethora of FFT algorithms has been developed and published. They are divided into two main categories: Category I a. Decimation in Time b. Decimation in Frequency Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1019
x [ n ]WN
mn
(10.53)
and
n=0
1N1 m n X [ m ]W N x [ n ] = --N
(10.54)
n=0
We observe that (10.53) and (10.54) differ only by the factor 1 N , and the replacement of W N with W N . If the DFT algorithm is developed in terms of the direct DFT of (10.53), it is referred to as decimation in time, and if it is developed in terms of the Inverse DFT of (10.54), it is referred to as decimation in frequency. In the latter case, the vector
1
WN = e
2 j ----N
2 j ----e N
that is, the sine terms are reversed in sign, and the multiplication by the factor 1 N can be done either at the input or output. The Category II algorithm schemes are described in the Table 10.4 along with their advantages and disadvantages.
TABLE 10.4 In-Place and Natural InputOutput algorithms Category II InPlace Description The process where the result of a computation of a new vector is stored in the same memory location as the result of the previous computation Advantages Disadvantages Eliminates the need for The output appears in an intermediate storage unnatural order and must and memory require- be reordered. ments Requires more internal memory to preserve the natural order
The process where the output No reordering is appears in same (natural) required order as the input
1020 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
f [ n ]WN n=0
mn
(10.55)
We assume that N is a power of 2 and thus, it is divisible by 2 . Then, we can decompose the sequence f [ n ] into two subsequences, f even [ n ] which contains the even components, and
f odd [ n ] which contains the odd components. In other words, we choose these as f even [ n ] = f [ 2n ]
and
f odd [ n ] = f [ 2n + 1 ]
for n = 0, 1, 2, N 2 1 Each of these subsequences has a length of N 2 and thus, their DFTs are, respectively,
F even [ m ] =
N21
f even [ n ]W N 2 =
mn
N21
f [ 2n ]W N 2
mn
(10.56)
and
F odd [ m ] =
n=0 N21
n=0 N21
f odd [ n ]W N 2 =
mn
f [ 2n + 1 ]W N 2
mn
(10.57)
where
n=0
n=0 j 2 2 ---- N
WN 2 =
2 j ---------N2 e
= e
= WN
(10.58)
f [ n ]WN
n=0
mn
= f [ 0 ] + f [ 1 ]W N + f [ 2 ]W N + f [ 4 ]W N
4m
2m
+ f [ 3 ]W N
6m
3m 7m
(10.59)
+ f [ 5 ]W N
5m
+ f [ 6 ]W N
+ f [ 7 ]W N
0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1021
f [ 2n ]WN
n=0 0
2mn
= f [ 0 ]W N + f [ 2 ]W N = f [ 0 ] + f [ 2 ]W N
2m
2m
+ f [ 4 ]W N
4m
4m
+ f [ 6 ]W N
6m
6m
(10.60)
+ f [ 4 ]W N
+ f [ 6 ]W N
0
f [ 2n + 1 ]WN
n=0
2 mn
= f [ 1 ]W N + f [ 3 ]W N
4m
2m
+ f [ 5 ]W N
4m
+ f [ 7 ]W N
6m
(10.61)
= f [ 1 ] + f [ 3 ]W N
2m
+ f [ 5 ]W N
+ f [ 7 ]W N
6m
The vector W N is the same in (10.59), (10.60) and (10.61), and N = 8 . Then,
WN = W8 =
m 2 j ----e N
= e
2 j ----8
+ f [ 5 ]W N
5m
+ f [ 7 ]W N
7m
(10.62)
(10.63)
for n = 1, 2, 3, , 7 . Continuing the process, we decompose { f [ 0 ], f [ 2 ], f [ 4 ], and f [ 6 ] } into { f [ 0 ], f [ 4 ] } and { f [ 2 ], f [ 6 ] } . These are sequences of length N 4 = 2 . Denoting their DFTs as F even1 [ m ] and F even2 [ m ] , and using the relation
WN 4 = e
2 j ---------N4
=e
j 2 4 ---- N
= WN
for n = 0, 1 , we obtain
F even1 [ m ] = f [ 0 ] + f [ 4 ]W N
4m
and
F even2 [ m ] = f [ 2 ] + f [ 6 ]W N
4m
1022 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
F even2 [ m ]
(10.67)
Likewise, F odd [ m ] can be decomposed into DFTs of length 2; then, F [ m ] can be computed from
F ( m ) = F even ( m ) + W N F odd ( m ) m = 0, 1, 2, , 7
m
(10.68)
for N = 8 . Of course, this procedure can be extended for any N that is divisible by 2. Figure 10.5 shows the signal flow graph of a decimation in time, inplace FFT algorithm for N = 8 , where the input is shuffled in accordance with the above procedure. The subscript N in W has been omitted for clarity.
Column 0 (x[n]) Column 1 (N /4 ) Row 0 Column 2 (N / 2) Column 3 (N) X[m]
W0
W0
W0
Row 1
W4
W2
W1
Row 2
W0
W4
W2
Row 3
W4
W6
W3
Row 4
W0
W0
W4
Row 5
W4
W2
W5
Row 6
W0
W4
W6
Row 7
W4
W6
W7
Figure 10.5. Signal flow graph of a decimation in time, in-place FFT algorithm, for N = 8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1023
The binary input words and the bitreversed words applicable to the this signal flow graph, are shown in Table 10.5.
TABLE 10.5 Binary words for the signal flow graph of Figure 10.5 n 0 1 2 3 4 5 6 7 Binary Word 000 001 010 011 100 101 110 111 Reversed-Bit Word 000 100 010 110 001 101 011 111 Input Order x[0] x[4] x[2] x[6] x[1] x[5] x[3] x[7]
We will illustrate the use of (10.69) with the following example. Example 10.5 Using (10.69) with the signal flow graph of Figure 10.5, compute the spectral component X [ 3 ] in terms of the inputs x [ i ] and vectors W . Then, verify that the result is the same as that obtained by direct application of the DFT.
j
1024 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
W Y [ Rj , C 1 ]
Solid line
m
(10.69)
(10.70)
(10.71)
(10.72)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1025
Y [ 3, 2 ] = Y [ 1, 1 ] + W Y [ 3 , 1 ] Y [ 7, 2 ] = Y [ 5, 1 ] + W Y [ 7, 1 ] Y [ 1, 1 ] = Y [ 0, 0 ] + W Y [ 1 , 0 ] Y [ 3, 1 ] = Y [ 2, 0 ] + W Y [ 3 , 0 ] Y [ 5, 1 ] = Y [ 4, 0 ] + W Y [ 5 , 0 ] Y [ 7, 1 ] = Y [ 6, 0 ] + W Y [ 7 , 0 ]
4 4 4 4 6
(10.76)
Y [ 3, 0 ] + W
13
Y [ 7, 0 ]
(10.77)
Y [ 3, 3 ] = X [ 3 ]
1026 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
+ x [ 7 ]W
9
= x [ 0 ] + x [ 1 ]W + x [ 2 ]W + x [ 3 ]W + x [ 4 ]W + x [ 5 ]W + x [ 6 ]W
4 7 10
(10.78)
13
+ x [ 7 ]W
We will verify that this expression is correct by the use of the direct DFT of (10.17), that is,
X[m] =
N1
x ( n )WN n=0
6
mn
+ x [ 5 ]W
15
+ x [ 6 ]W
r
18
+ x [ 7 ]W
21
(10.79)
= W
= W ,
15
=W ,
18
=W
10
and W
21
= W
13
+ x [ 7 ]W
(10.80)
We observe that (10.80) is the same as (10.78). The signal flow graph of Figure 10.5, represents a shuffled input, natural output algorithm. Others are natural input, natural output, or natural input, shuffled output. These combinations occur in both decimation in time, and decimation in frequency algorithms.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1027
x [ n ]e
n=0
where N represents the number of points that are equally spaced in the interval 0 to 2 on the unit circle of the z -plane, and m = 0, 1, 2, , N 1 .
The N point Inverse DFT is defined as
j2 1 N1 X [ m ]e x [ n ] = --N
mn ------N
m=0
for n = 0, 1, 2, , N 1 .
In general, the discrete frequency transform X [ m ] is complex, and it is expressed as X [ m ] = Re { X [ m ] } + Im { X [ m ] }
n=1
x [ n ] cos --------------N
2mn
for m = 0, 1, 2, , N 1
n=1
x [ n ] sin --------------N
2mn for m = 0, 1, 2, , N 1
We can use the fft(x) function to compute the DFT, and the ifft(x) function to compute the
Inverse DFT.
The term e ( j2 ) N is a rotating vector, where the range 0 2 is divided into 360 N equal
and consequently
WN = e
1 j2 -------N
1028 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Summary
X[m] =
N1
x ( n )WN
mn
and
n=0
1N1 m n X ( m )W N x [ n ] = --N
n=0
The correspondence between x [ n ] and X [ m ] is denoted as x [n] X [m] If x [ n ] is an N point real discrete time function, only N 2 of the frequency components of X [ m ] are unique. The discrete time and frequency functions are defined as even or odd, in accordance with the
relations
Even Time Function Odd Time Function Even Frequency Function Odd Frequency Function
f[ N n] = f [n] f [ N n ] = f [ n ] F[ N m] = F[ m ] F [ N m ] = F [ m ]
The even and odd properties of the DFT are similar to those of the continuous Fourier trans-
The linearity property of the DFT states that ax 1 [ n ] + bx 2 [ n ] + aX 1 [ m ] + bX 2 [ m ] + The time shift property of the DFT states that x [ n k ] WN X [ m ] The frequency shift property of the DFT states that WN
k m km
x [ n ] X [ m k ]
The time convolution property of the DFT states that x [ n ] h [ n ] X [ m ] H [ m ] The frequency convolution property of the DFT states that 1 x [ n ] y [ n ] --N
N1
X [ k ]Y [ m k ] =
1 --- X [ m ] Y [ m ] N
k=0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1029
can be completely recovered from its sampled values, if the sampling frequency if equal to or greater than 2W .
A typical digital signal processing system contains a low-pass analog filter, often called pre-sam-
pling filter, to ensure that the highest frequency allowed into the system, will be equal or less the sampling rate so that the signal can be recovered. The highest frequency allowed by the presampling filter is referred to as the Nyquist frequency, and it is denoted as f n . signal will overlap each another and this condition is called aliasing.
If a signal is not band-limited, or if the sampling rate is too low, the spectral components of the If a discrete time signal has an infinite length, we can terminate the signal at a desired finite
number of terms, by multiplying it by a window function. However, we must choose a suitable window function; otherwise, the sequence will be terminated abruptly producing the effect of leakage lines and goes undetected, the picket-fence effect is produced. This effect can be alleviated by adding zeros at the end of the discrete signal, thereby changing the period, which in turn changes the location of the spectral lines. FFT algorithm.
If in a discrete time signal some significant frequency component that lies between two spectral
The number of operations required to compute the DFT can be significantly reduced by the The Category I FFT algorithms are classified either as decimation it time or decimation in fre-
quency. Decimation in time implies that DFT algorithm is developed in terms of the direct DFT, whereas decimation in frequency implies that the DFT is developed in terms of the Inverse DFT.
The Category II FFT algorithms are classified either as in-place or natural inputoutput. In-
place refers to the process where the result of a computation of a new vector is stored in the same memory location as the result of the previous computation. Natural inputoutput refers to the process where the output appears in same (natural) order as the input. input is shuffled and the output is natural, and in others the input is natural and the output is shuffled. These combinations occur in both decimation in time, and decimation in frequency algorithms.
The FFT algorithms are usually shown in a signal flow graph. In some signal flow graphs the
1030 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Use MATLAB to compute and plot the magnitude X [ m ] of this sequence. 3. Prove that
-----------a. x [ n ] cos 2kn -- { X [ m k ] + X [ m + k ] } N -----------b. x [ n ] sin 2kn ---- { X [ m k ] + X [ m + k ] } N 1 j2 1 2
4. The signal flow below is a decimation in time, naturalinput, shuffledoutput type FFT algorithm. Using this graph and relation (10.69), compute the frequency component X [ 3 ] . Verify that this is the same as that found in Example 10.5.
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7]
W0 W0 W0 W0 W4 W4 W4 W4 W0 W0 W4 W4 W2 W2 W6 W6 W0 W4 W2 W6 W1 W5 W3 W7
5. The signal flow graph below is a decimation in frequency, natural input, shuffled output type FFT algorithm. There are two equations that relate successive columns. The first is
Y dash ( R, C ) = Y dash ( R i , C 1 ) + Y dash ( R j , C 1 )
and it is used with the nodes where two dashed lines terminate on them. The second equation is
Y sol ( R, C ) = W [ Y sol ( R i , C 1 ) Y sol ( R j , C 1 ) ]
m
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1031
W0 W
0
2 0 W W
W W W W
0 1 2 3 0 W
W0
2 0 W W
6. Plot the Fourier transform of the rectangular pulse shown below, using the MATLAB fft function. Then, use the ifft function to verify that the inverse transformation produces the rectangular pulse.
f(t)
1
t
1
7. Plot the Fourier transform of the triangular pulse shown below using the MATLAB fft function. Then, use the ifft function to verify that the inverse transformation produces the rectangular pulse.
f(t)
1
t
1
1032 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
f ( n )WN
mn
n=0
f ( n )W4
n=0
mn
= f [ 0 ]W 4
m[0]
+ f [ 1 ]W 4
m[1]
+ f [ 2 ]W 4
m[2]
+ f [ 3 ]W 4
m[3]
for m = 0, 1, 2, and 3
m = 0: F ( 0 ) = ( 1 ) ( e ) + ( 1 ) ( e ) + ( 1 ) ( e ) + ( 1 ) ( e ) = ( 1 ) ( 1 ) + ( 1 ) ( 1 ) + ( 1 ) ( 1 ) + ( 1 ) ( 1 ) = 0 m = 1: F(1) = (1) (e ) + (1) (e
0 ( j2 4 ) 1 ( j2 4 ) 2 ( j2 4 ) 3 0 0 0 0
) + ( 1 ) ( e
) + ( 1 ) ( e
3 3 = 1 + cos j sin cos + j sin cos ----- + j sin ------2 2 2 2 = 1 + 0 j + 1 + 0 0 j = 2 j2 m = 2: F(2) = (1) (e ) + (1) (e
0 ( j2 4 ) 2
) + ( 1 ) ( e
( j2 4 ) 4
) + ( 1 ) ( e
( j2 4 ) 6
= 1 + cos j sin cos 2 + j sin 2 cos 3 + j sin 3 = 1101+0+1+0 = 0 m = 3: F(3) = (1) (e ) + (1) (e
0 ( j2 4 ) 3
) + ( 1 ) ( e
( j2 4 ) 6
) + ( 1 ) ( e
( j2 4 ) 9
Fm = 0 2.0000 - 2.0000i
2.0000 + 2.0000i
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1033
magXm0 = 0.00 magXm1 = 5.23 magXm2 = 0.00 magXm3 = 2.16 magXm4 = 0.00 magXm5 = 2.16 magXm6 = 0.00 magXm7 = 5.23 The MATLAB stem command can be used to plot discrete sequence data. For this Exercise we use the script
fn=[1 1 1 1 1 1 1 1]; stem(abs(fft(fn)))
3.
1 2kn x [ n ] cos ------------ -- { X [ m k ] + X [ m + k ] } 2 N 1 2kn x [ n ] sin ------------ ---- { X [ m k ] + X [ m + k ] } j2 N
x [ n ] X [ m k ] (1)
Then,
W N x [ n ] X [ m + k ] (2)
km
1034 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
and thus
1 2kn x [ n ] cos ------------ -- [ X [ m k ] + X [ m + k ] ] 2 N
Likewise, subtracting (2) from (1) and multiplying the difference by 1 j2 we obtain
j2kn N j 2kn N ( WN WN ) ( x [ n ] ) (e e ) ------------------------------------------------------- = ----------------------------------------------------- x [ n ] = x [ n ] sin 2kn -----------j2 j2 N k m km
4.
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7]
W0 W0 W0 W0 W4 W4 W4 W4 W0 W0 W4 W4 W2 W2 W6 W6
3
W0 W4 W2 W6 W1 W5 W3 W7
F ( 3 ) = X ( 3 ) = Y ( 6, 3 ) = Y ( 6, 2 ) + W N Y ( 7, 2 ) (1)
where
Y ( 6, 2 ) = Y ( 4, 1 ) + W N Y ( 6, 1 )
6
and
Y ( 7, 2 ) = Y ( 5, 1 ) + W N Y ( 7, 1 )
6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1035
(2)
x(4) +
15 WN
x(5) +
18 WN
x(6) +
21 WN
x( 7)
(3)
By comparison, we see that the first 4 terms of (3) are the same the first, second, fourth, and sixth terms of (2) since Y ( k, 0 ) = x ( k ) , that is, Y ( 0, 0 ) = x ( 0 ) , Y ( 1, 0 ) = x ( 1 ) , and so on. The remaining terms in (2) and (3) are also the same since W 8
W 8 = W 8 , W 8 = W 8 , and W 8 = W 8 .
15 7 18 10 21 13 kN + r
= W 8 and thus W 8 = W 8 ,
r 12 4
5.
Y dash ( R, C ) = Y dash ( R i , C 1 ) + Y dash ( R j , C 1 ) Y sol ( R, C ) = W [ Y sol ( R i , C 1 ) Y sol ( R j , C 1 ) ]
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7]
m
X[0]
W0 W
0
2 0 W W
W W
0 1 0 W
W2 W
3
W0
2 0 W W
1036 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Y [ 5, 1 ] = W N [ Y ( 1, 0 ) Y ( 5, 0 ) ] Y [ 6, 1 ] = W N [ Y ( 2, 0 ) Y ( 6, 0 ) ] Y [ 7, 1 ] = W N [ Y ( 3, 0 ) Y ( 7, 0 ) ]
Column 2 (C=2):
Y ( 0, 2 ) = Y ( 0, 1 ) + Y ( 2, 1 ) Y ( 1, 2 ) = Y ( 1, 1 ) + Y ( 3, 1 ) Y ( 2, 2 ) = W N [ Y ( 0, 1 ) Y ( 2, 1 ) ] Y ( 3, 2 ) = W N [ Y ( 1, 1 ) Y ( 3, 1 ) ] Y [ 4, 2 ] = Y ( 4, 1 ) + Y ( 6, 1 ) Y [ 5, 2 ] = Y ( 5, 1 ) + Y ( 7, 1 ) Y [ 6, 2 ] = W N [ Y ( 4, 1 ) Y ( 6, 1 ) ] Y [ 7, 2 ] = W N [ Y ( 5, 1 ) Y ( 7, 1 ) ]
2 0 2 0
(2)
Column 3 (C=3):
Y ( 0, 3 ) = Y ( 0, 2 ) + Y ( 1, 2 ) Y ( 1 , 3 ) = W N [ Y ( 0, 2 ) Y ( 1, 2 ) ] Y ( 2, 3 ) = Y ( 2, 2 ) + Y ( 3, 2 ) Y ( 3 , 3 ) = W N [ Y ( 2, 2 ) Y ( 3, 2 ) ] Y [ 4, 3 ] = Y ( 4, 2 ) + Y ( 5, 2 ) Y [ 5 , 3 ] = W N [ Y ( 4, 2 ) Y ( 5, 2 ) ] Y [ 6, 3 ] = Y ( 6, 2 ) + Y ( 7, 2 ) Y [ 7 , 3 ] = W N [ Y ( 6, 2 ) Y ( 7, 2 ) ] F ( 3 ) = X ( 3 ) = Y ( 6, 3 ) = Y ( 6, 2 ) + Y ( 7, 2 ) (4)
0 0 0 0
(3)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1037
and
Y ( 7, 2 ) = W N [ Y ( 5, 1 ) Y ( 7, 1 ) ]
2
From (1)
Y [ 4, 1 ] = W N [ Y ( 0, 0 ) Y ( 4, 0 ) ] Y [ 5, 1 ] = W N [ Y ( 1, 0 ) Y ( 5, 0 ) ] Y [ 6, 1 ] = W N [ Y ( 2, 0 ) Y ( 6, 0 ) ] Y [ 7, 1 ] = W N [ Y ( 3, 0 ) Y ( 7, 0 ) ]
3 2 1 0
0) +
2 W N Y ( 6,
0) +
5 W N Y ( 7,
0)
(5)
From Exercise 4,
F ( 3 ) = X ( 3 ) = x ( 0 ) + WN x ( 1 ) + WN x ( 2 ) + WN x ( 3 ) +W N x ( 4 ) + W N x ( 5 ) + W N x ( 6 ) + W N x ( 7 )
12 15 18 21 3 6 9
(6)
Since Y ( k, 0 ) = x ( k ) , W 8
6 2 9 5
8i + n 12
= W 8 and W 8
n 0 15
n4
W 8 = W 8 , W 8 = W 8 , W 8 = W 8 , W 8 = W 8 , W 8 = W 8 , and W 8 = W N . Therefore,
= W8 :
n
W8
n4
= W8 W8 = W8 e
j2 8 ( 4 )
n n = W 8 ( cos sin ) = W 8 +
6.
1038 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
-1
100 50 0 -50 -100 -2
1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -2 -1.5 -1 -0.5
-1
0.5
1.5
7.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1039
0 -1
0 -1
1040 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Chapter 11
Analog and Digital Filters
his chapter is an introduction to analog and digital filters. It begins with the basic analog filters, transfer functions, and frequency response. The magnitude characteristics of Butterworth and Chebychev filters and conversion of analog to equivalent digital filters using the bilinear transformation is presented. It concludes with design examples using MATLAB and Simulink when applicable.
1
STOP BAND PASS BAND
C
Ideal highpass filter
V out ---------V in
1
STOP BAND PASS BAND STOP BAND
V out ---------V in
1
PASS BAND STOP BAND PASS BAND
Another, less frequently mentioned filter, is the allpass or phase shift filter. It has a constant magnitude response but is phase varies with frequency. Please refer to Exercise 4, Page 1194, at the end of this chapter. A digital filter, in general, is a computational process, or algorithm that converts one sequence of numbers representing the input signal into another sequence representing the output signal. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
111
+
V in
C
V out
or
V out 1 1 1 1 G ( j ) = ---------- = ----------------------- = ------------------------------------------------------------------------- = -------------------------------- tan ( RC ) (11.1) 2 2 2 1 + jRC V in 1 2 2 2 1+ R C ( 1 + R C ) tan ( RC )
(11.2)
(11.3)
112
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
for = 1 RC ,
G ( j ) = 1 2 = 0.707
and as ,
G(j) 0
We will use the MATLAB script below to plot G ( j ) versus radian frequency . This is shown in Figure 11.3 where, for convenience, we let RC = 1 .
w=0:0.02:10; RC=1; magGjw=1./sqrt(1+w.*RC); semilogx(w,magGjw);... xlabel('Frequency in rad/sec log scale'); ylabel('Magnitude of Vout/Vin');... title('Magnitude Characteristics of basic RC lowpass filter'); grid
Magnitude Characteristics of basic RC low-pass filter 1 0.9 Magnitude of Vout/Vin 0.8 0.7 0.6 0.5 0.4
Half-power point
10
-2
-1
10
We can also obtain a quick sketch for the phase angle, i.e., = arg { G ( j ) } versus by evaluating (11.3) at = 0 , = 1 RC , = 1 RC , and . Thus, As 0 ,
atan 0 0
For = 1 RC ,
= atan 1 = 45
For = 1 RC ,
= atan ( 1 ) = 45
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
113
and as ,
= atan ( ) = 90
We will use the MATLAB script below to plot the phase angle versus radian frequency . This is shown in Figure 11.4 where, for convenience, we let RC = 1 .
w=0:0.02:10; RC=1; phaseGjw=atan(w.*RC).*180./pi; semilogx(w,phaseGjw);... xlabel('Frequency in rad/sec log scale'); ylabel('Phase of Vout/Vin degrees');... title('Phase Characteristics of basic RC lowpass filter'); grid
Phase Characteristics of basic RC low-pass filter 0 -10 Phase of Vout/Vin - degrees -20 -30 -40 -50 -60 -70 -80 -90 -2 10
-1 0 1
10
V out
or
114
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(11.4)
(11.5)
(11.6)
We can obtain a quick sketch for the magnitude G ( j ) versus by evaluating (11.5) at = 0 , = 1 RC , and . Thus, As 0 , For = 1 RC , and as ,
G(j) 0 G ( j ) = 1 2 = 0.707 G(j) 1
We will use the MATLAB script below to plot G ( j ) versus radian frequency . This is shown in Figure 11.6 where, for convenience, we let RC = 1 .
Magnitude Characteristics of basic RC high-pass filter 1
Halfpower point
0.8 Magnitude of Vout/Vin
0.6
0.4
0.2
0 -2 10
10
-1
10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
115
We can also obtain a quick sketch for the phase angle, i.e., = arg { G ( j ) } versus , by evaluating (11.6) at = 0 , = 1 RC , = 1 RC , , and . Thus, As 0 ,
atan 0 0
For = 1 RC ,
= atan 1 = 45
For = 1 RC ,
= atan ( 1 ) = 45
As ,
= atan ( ) = 90
and as ,
= atan ( ) = 90
We will use the MATLAB script below to plot the phase angle versus radian frequency . This is shown in Figure 11.7 where, for convenience, we let RC = 1 .
w=0:0.02:10; RC=1; phaseGjw=atan(1./(w.*RC)).*180./pi; semilogx(w,phaseGjw);... xlabel('Frequency in rad/sec log scale'); ylabel('Phase of Vout/Vin degrees');... title('Phase Characteristics of basic RC highpass filter'); grid
Phase Characteristics of basic RC high-pass filter 90 80 Phase of Vout/Vin - degrees 70 60 50 40 30 20 10 0 -2 10
-1 0 1
10
116
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
+
V in R
+
V out
and thus
V out R jRC j ( R L ) G ( j ) = ---------- = ------------------------------------------- = ------------------------------------------------ = ------------------------------------------------------2 2 V in jL + 1 jC + R L C + 1 + jRC j ( R L ) 1 LC
(11.7)
There is no need to express relation (11.7) in magnitude and phase form. We will make use of the abs(x) and angle(x) MATLAB functions for the magnitude and phase plots. We will use the MATLAB script below to plot G ( j ) versus radian frequency . This is shown in Figure 11.9 where, for convenience, we let R = L = C = 1 , and thus (11.7) simplifies to:
j G ( j ) = -------------------------2 j 1 w=0:0.02:100; magGjw=abs(j.*w./(w.^2j.*w1)); semilogx(w,magGjw);... xlabel('Frequency in rad/sec log scale'); ylabel('Magnitude of Vout/Vin');... title('Magnitude Characteristics of basic RLC bandpass filter'); grid
(11.8)
The plot for the magnitude of (11.8) is shown in Figure 11.9. To plot the phase of (11.8), we use the MATLAB script below.
w=0:0.02:100; phaseGjw=angle(j.*w./(w.^2j.*w1)).*180./pi; semilogx(w,phaseGjw);... xlabel('Frequency in rad/sec log scale'); ylabel('Phase of Vout/Vin degrees');... title('Phase Characteristics of basic RLC bandpass filter'); grid
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
117
0.6
0.4
0.2
0 -2 10
10
-1
10
Figure 11.9. Magnitude characteristics of the basic RLC bandpass filter with R = L = C = 1
Phase Characteristics of basic RLC band-pass filter 100
50
-50
-100 -2 10
10
-1
10
Figure 11.10. Phase characteristics of the basic RLC bandpass filter with R = L = C = 1
* This is the same network as (b) in Exercise 7, Chapter 4, Page 422. A bandelimination filter is also referred to as a bandstop filter or notch filter.
118
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
+
j L
V out
1 j C
and thus
2 2 V out jL + 1 jC LC + 1 1 G ( j ) = ---------- = ------------------------------------------- = ------------------------------------------------ = ------------------------------------------------------2 2 jL + 1 jC + R V in j ( R L ) 1 LC L C + 1 + jRC
(11.9)
There is no need to express relation (11.9) in magnitude and phase form. As in the previous subsection, we will make use of the abs(x) and angle(x) MATLAB functions for the magnitude and phase plots. We will use the MATLAB script below to plot G ( j ) versus radian frequency . For convenience, we let R = L = C = 1 , and thus (11.9) simplifies to:
1 G ( j ) = -------------------------2 j 1 w=0:0.02:100; magG=abs((w.^21)./(w.^2j.*w1)); semilogx(w,magG); grid
2
(11.10)
0.6
0.4
0.2
0 -2 10
10
-1
10
Figure 11.12. Magnitude characteristics of the basic RLC bandelimination filter with R = L = C = 1
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
119
50
-50
-100 -2 10
10
-1
10
Figure 11.13. Phase characteristics of the basic RLC bandelimination filter with R = L = C = 1
Other passive filter networks are presented as endofchapter exercises in Chapter 4. Examples of active lowpass filters are presented in Figure 4.20, Chapter 4, Page 415, and at the end of this chapter. In the next section we introduce filter prototypes and use these as a basis for filter design.
A ( ) = G ( s ) G ( s )
s = j
(11.11)
Since ( j ) = ( j ) , the square of the magnitude of a complex number can be expressed as that number and its complex conjugate. Thus, if the magnitude is A , then
A ( ) = G ( j ) = G ( j )G ( j ) = G ( j ) G ( j )
2
(11.12)
Now, G ( j ) can be considered as G ( s ) evaluated at s = j , and thus (11.11) is justified. Also, since A is understood to represent the magnitude, it needs not be enclosed in vertical lines.
1110 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Compute A ( ) .
2
Solution: Since
3s + 5s + 7 G ( s ) = --------------------------2 s + 4s + 6
2
3s 5 s + 7 G ( s ) = ------------------------2 s 4 s + 6
4 2 3s + 5s + 7 3s 5 s + 7 ------------------------------------G ( s ) G ( s ) = ---------------------------- ------------------------- = 9s + 17s + 49 2 2 4 2 s + 4s + 6 s 4 s + 6 s 4s + 36 4 2 4 2 2 2
Therefore,
A ( ) = G ( s ) G ( s )
2 s = j
= 9s + 17s + 49 ------------------------------------4 2 s 4s + 36
s = j
9 17 + 49 = ------------------------------------4 2 + 4 + 36
C ( bk + bk 1 + + b0 ) 2 A ( ) = --------------------------------------------------------------------------------2k 2k 2 ak + ak 1 + + a0
2k
2k 2
(11.13)
where C is the DC gain, a and b are constant coefficients, and k is a positive integer denoting the order of the filter. Once the magnitudesquare function A ( ) is known, we can derive G ( s )
2
* It was stated earlier, that a rational function is said to be proper if the largest power in the denominator is equal to or larger than that of the numerator.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1111
(11.14)
In the simplest lowpass filter, the DC gain of the magnitudesquare function is unity. In this case (11.13) reduces to
b0 2 A ( ) = ----------------------------------------------------------------------2k 2k 2 ak + ak 1 + + a0
(11.15)
(11.16)
The attenuation rate of this approximation is 6k dB octave or 20k dB decade . To understand this, let us review the definitions of octave and decade. Consider two frequencies u 1 and u 2 , and let
2 u 2 u 1 = log 10 2 log 10 1 = log 10 ----1
(11.17)
If these frequencies are such that 2 = 2 1 , we say that these frequencies are separated by one octave, and if 2 = 10 1 , we say that they are separated by one decade. To compute the attenuation rate of (11.16), we take the square root of both sides. Then,
b0 ak BA ( ) = ----------------- = Cons tan - = --------------------------t k k k
(11.18)
Taking the common log of both sides of (11.18) and multiplying by 20, we obtain
20log 10 A ( ) = 20log 10 B 20log 10 = 20klog 10 + 20log 10 B
k
(11.19) (11.20)
or
A ( ) dB = 20klog 10 + 20log 10 B
Relation (11.20) is is an equation of a straight line with slope = 20k dB decade , and intercept = B as shown in Figure 11.14. The procedure of finding the transfer function G ( s ) from the magnitudesquare function A ( ) , is illustrated with the Example 11.2 below.
2
1112 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(11.21)
16 ( s + 1 ) = -------------------------------------------2 2 ( s + 4 ) ( s + 9 )
(11.22)
This function has zeros at s = j1 , and poles at s = 2 and s = 3 . There is no restriction on the zeros but, for stability*, we select the lefthalf s plane poles. We must also select the gain constant such that G ( 0 ) = A ( 0 ) . Let
K(s + 1) G ( s ) = -------------------------------(s + 2)(s + 3)
2
(11.23)
* Generally, a system is said to be stable if a finite input produces a finite output. Alternately, a system is stable if the impulse response h ( t ) vanishes after a sufficiently long time. Stability is discussed in Feedback and Control Systems textbooks.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1113
or From (11.23), and for G ( 0 ) = A ( 0 ) we must have, or By substitution into (11.23), we obtain
(11.24)
where k is a positive integer, and C is the cutoff ( 3 dB ) frequency. Figure 11.15 is a plot of the relation (11.24) for k = 1, 2, 4, and 8 .
Butterworth Analog Low-Pass Filter characteristics for k=1, 2, 4, and 8 1 Magnitude A (square root of relation (11.24)
0.8
k=1 k=2
0.6
0.4
k=4
0.2
K=8
0 0 0.5 1 1.5 2 2.5 Normalized Frequency (ratio of actual to cutoff) 3
Figure 11.15. Butterworth lowpass filter magnitude characteristics * The frequency response of the Butterworth filter is maximally flat (has no ripples) in the passband, and rolls off towards zero in the stopband. When viewed on a logarithmic Bode plot, the response slopes off linearly towards negative infinity.
1114 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
All Butterworth filters have the property that all poles of the transfer functions that describes them, lie on a circumference of a circle of radius C , and they are 2 2k radians apart. Thus, if
k = odd , the poles start at zero radians, and if k = even , they start at 2 2k . But regardless whether k is odd or even, the poles are distributed in symmetry with respect to the j axis. For stability, we choose the left halfplane poles to form G ( s ) .
We can find the nth roots of a the complex number s by DeMoivres theorem. This theorem states that
n
re
re
+ 2k j ------------------ n
k = 0, 1, 2,
(11.25)
Example 11.3 Derive the transfer function G ( s ) for the third order ( k = 3 ) Butterworth lowpass filter with normalized cutoff frequency C = 1 rad s . Solution: With k = 3 and C = 1 rad s , (11.24) simplifies to
2 1 A ( ) = --------------6 +1
(11.26)
1 G ( s ) G ( s ) = ----------------6 s +1
(11.27)
Then, s =
1e
1e
k = 0, 1, 2, 3, 4, 5
Thus, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1115
As expected, these six poles lie on the circumference of the circle with radius C = 1 as shown in Figure 11.16.
Im { s } s3
2
s1 Re { s }
s4
s5 s
Figure 11.16. Location of the poles for the transfer function of Example 11.3
The transfer function G ( s ) is formed with the left halfplane poles s 3 , s 4 , and s 5 . Then,
K G ( s ) = ---------------------------------------------------------------------------------3 3 1 ------ 1 ------ s + -- j - ( s + 1 ) s + -- + j 2 2 2 2
(11.28)
den = (s+1/2-1/2*i*3^(1/2))*(s+1)*(s+1/2+1/2*i*3^(1/2))
expand(den)
(11.29)
1 G ( s ) = --------------------------------------3 2 s + 2s + 2s + 1
(11.30)
and this is the transfer function G ( s ) for the third order ( k = 3 ) Butterworth lowpass filter with normalized cutoff frequency C = 1 rad s .
1116 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
b0 = --------------------------------------------------------------k 2 ak s + + a2 s + a1 s + a0
(11.31)
The pole locations and the coefficients of the corresponding denominator polynomials, have been derived and tabulated by Weinberg in Network Analysis and Synthesis, McGrawHill. Table 11.1 shows the first through the fifth order coefficients for Butterworth analog lowpass filter denominator polynomials with normalized frequency C = 1 rad s .
TABLE 11.1 Values for the coefficients a i in (11.31) Coefficients of Denominator Polynomial for Butterworth Low-Pass Filters Order a5 a4 a3 a2 a1 1 2 1 1.4142136 3 1 2 2 4 2.6131259 3.1442136 2.6131259 1 5 1 3.2360680 5.2360680 5.2360680 3.2360680 a0 1 1 1 1 1
We can also use the MATLAB buttap and zp2tf functions to derive the coefficients. The buttap function returns the zeros, poles, and gain for an Nth order normalized prototype Butterworth analog lowpass filter. The resulting filter has N poles around the unit circle in the left half plane, and no zeros. The zp2tf function performs the zeropole to transfer function conversion. Example 11.4 Use MATLAB to derive the numerator b and denominator a coefficients for the thirdorder Butterworth lowpass filter prototype with normalized cutoff frequency*. Solution:
[z,p,k]=buttap(3); [b,a]=zp2tf(z,p,k)
b = 0 a = 1.0000 2.0000 2.0000 1.0000 We observe that the denominator coefficients are the same as in Table 11.1.
* Henceforth, normalized cutoff frequency will be understood to be C = 1 rad s
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1117
(11.32)
i=0 n
---i 1 s
s
where the factor ( 1 ) is to ensure that G ( 0 ) = 1 , and s i denotes the poles on the left half of the
s plane. They can be found from ( 2i + 1 ) ( 2i + 1 ) s i = C sin ---------------------- + j cos ---------------------- 2k 2k
(11.33)
We must remember that the factors in Table 11.2 apply only when the cutoff frequency is normalized to C = 1 rad s . If C 1 , we must scale the transfer function appropriately. We can convert to the actual transfer function using the relation
norm s G ( s ) actual = G ---------------------- actual
1118 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(11.34)
that is, we replace s with s actual Quite often, we require that C , that is, in the stop band of the lowpass filter, the attenuation to be larger than 20 dB decade , i.e., we require a sharper cutoff. As we have seen from the plots of Figure 11.15, Page 1114, the Butterworth lowpass filter cutoff becomes sharper for larger values of k . Accordingly, we generate the plot for different values of k shown in Figure 11.17 using the MATLAB script below.
w_w0=1:0.02:10; dBk1=20.*log10(sqrt(1./(w_w0.^2+1)));... dBk2=20.*log10(sqrt(1./(w_w0.^4+1))); dBk3=20.*log10(sqrt(1./(w_w0.^6+1)));... dBk4=20.*log10(sqrt(1./(w_w0.^8+1))); dBk5=20.*log10(sqrt(1./(w_w0.^10+1)));... dBk6=20.*log10(sqrt(1./(w_w0.^12+1))); dBk7=20.*log10(sqrt(1./(w_w0.^14+1)));... dBk8=20.*log10(sqrt(1./(w_w0.^16+1))); semilogx(w_w0,dBk1,w_w0,dBk2,w_w0,dBk3,... w_w0,dBk4,w_w0,dBk5,w_w0,dBk6,w_w0,dBk7,w_w0,dBk8);... xlabel('Normalized Frequency (rads/sec) log scale'); ylabel ('Magnitude Response (dB)');... title('Magnitude Attenuation as a Function of Normalized Frequency');... set(gca, 'XTick', [1 2 3 4 5 6 7 8 9 10]); grid
Magnitude Attenuation as a Function of Normalized Frequency 0 -20 Magnitude Response (dB) -40
-60
k=4
-80 -100 -120 -140 -160
Figure 11.17 indicates that for k = 1 the attenuation is 20 dB decade , for k = 2 the attenuation is 40 dB decade , and so on.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1119
(11.35)
(11.36)
Of course, our objective is to learn how to design a circuit (passive or active), that will satisfy a transfer function such as the one above. Fortunately, the work for us has been done by others who have developed analog filter prototypes, both passive and active. Some good references are: Electronic Filter Design Handbook, Williams and Taylor, McGrawHill Electronic Engineers Handbook, Fink and Christiansen, McGrawHill Reference Data for Engineers Handbook, Van Valkenburgh, Howard Sams As an example, the Reference Data for Engineers Handbook provides the circuit of Figure 11.18 which is known as Second Order Voltage Controlled Voltage Source (VCVS) lowpass filter.
1120 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
vout
R1 R2 C1 C2
vin
Figure 11.18. VCVS lowpass filter (Courtesy Reference Data for Engineers Handbook)
The transfer function of the second order VCVS lowpass filter of Figure 11.18 is given as
Kb C G ( s ) = ---------------------------------------2 2 s + a C s + b C
2
(11.37)
This is referred to as a second order allpole* approximation to the ideal lowpass filter with cutoff frequency C , where K is the gain, and the coefficients a and b are provided by tables. For a non-inverting positive gain K , the circuit of Figure 11.18 satisfies the transfer function of (11.37) with the conditions that
2 R 1 = --------------------------------------------------------------------------------------------------------------- 2 2 aC 2 + ( [ a + 4b ( K 1 ) ]C 2 4bC 1 C 2 ) C 1 R 2 = ----------------------------2 bC 1 C 2 R 1 C K ( R1 + R2 ) R 3 = --------------------------(K 1) K1
(11.38)
(11.39)
(11.40) (11.41)
R4 = K ( R1 + R2 )
From (11.40) and (11.41), we observe that K = 1 + R 4 R 3 . A fourth-order allpole lowpass filter transfer function is a ratio of a constant to a fourth degree polynomial. A practical method of obtaining a fourth order transfer function, is to factor it into two secondorder transfer functions of the form of relation (11.37), i.e.,
* The terminology allpole stems from the fact that the splane contains poles only and the zeros are at , that is, the splane is all poles and no zeros.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1121
(11.42)
Each factor in (11.42) can be realized by a stage (circuit). Then, the two stages can be cascaded as shown in Figure 11.19.
Stage 1 Stage 2
vin
vout
Table 11.3 lists the Butterworth lowpass coefficients for second and fourthorder designs, where a and b apply to the transfer functions of (11.37) and (11.42) respectively.
TABLE 11.3 Coefficients for Butterworth lowpass filter designs Coefficients for Second and Fourth Order Butterworth LowPass Filter Designs Order a 2 b a1 b1 4 a2 b2 1.84776 1.0000 1.0000 0.76537 1.0000 1.41421
For a practical design of a secondorder VCVS circuit, we select standard values for capacitors C 1 and C 2 for the circuit of Figure 11.18, we substitute the appropriate values for the coefficients a and b from Table 11.3, we choose desired values for the gain K and cutoff frequency C , and we substitute these in relations (11.38) through (11.41) to find the values of the resistors R 1 through R 4 . Example 11.6 Design a secondorder VCVS Butterworth lowpass filter with gain K = 2 and cutoff frequency f C = 1 KHz .
1122 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
2 and b = 1 .
We substitute these values into (11.38) through (11.41), to find the values of the resistors. We use MATLAB to do the calculations as follows:
C1=10^(8); C2=C1; a=sqrt(2); b=1; K=2; wc=2*pi*10^3;... % and from (11.34) through (11.37);... R1=2/((a*C2+sqrt((a^2+4*b*(K1))*C2^24*b*C1*C2))*wc);... R2=1/(b*C1*C2*R1*wc^2); R3=K*(R1+R2)/(K1); R4=K*(R1+R2); fprintf(' \n');... fprintf('R1 = %6.0f \t',R1); fprintf('R2 = %6.0f \t',R2);... fprintf('R3 = %6.0f \t',R3); fprintf('R4 = %6.0f \t',R4)
R1 = 11254
R2 = 22508
R3 = 67524
R4 = 67524
These are the calculated values but they are not standard resistor values; we must select standard resistor values as close as possible to the calculated values. It will be interesting to find out what the frequency response of this filter looks like, with capacitors C 1 = C 2 = 0.01 F and standard 1% tolerance resistors with values R 1 = 11.3 K , R 2 = 2 R 1 = 22.6 K , and R 3 = R 4 = 68.1 K . We now substitute these values into the equations of (11.38) through (11.41), and we solve the first equation of this set for the cutoff frequency C . Then, we use C with the transfer function of (11.37). We do this with the following MATLAB script that produces the plot.
f=1:10:10^5; R1=11300; R2=22600; R3=68100; R4=R3; C1=10^(8); C2=C1;... a=sqrt(2); b=1; w=2*pi*f; fc=sqrt(1/(b*R1*R2*C1*C2))/(2*pi); wc=2*pi*fc;... K=1+R3/R4; s=w*j; Gw=(K.*b.*wc.^2)./(s.^2+a.*wc.*s+b.*wc.^2);... magGw=20.*log10(abs(Gw));... semilogx(f,magGw); xlabel('Frequency Hz'); ylabel('|Vout/Vin| (dB)');... title ('2nd Order Butterworth LowPass Filter Response'); grid
The frequency response of this lowpass filter is shown in Figure 11.20. We observe that the cutoff frequency occurs at about 1 KHz . As expected, the attenuation beyond 1 KHz is at the rate of 40 dB decade since this is a secondorder lowpass filter. Also, since the circuit of a non inverting op amp, its DC gain is 2 and thus K dB = 20 log 10 ( 2 ) 6 .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1123
10
10 10 Frequency Hz
10
10
Figure 11.20. Plot for the VCVS lowpass filter of Example 11.6
We have used the MATLAB buttap function earlier to aid us in the design of Butterworth filters with the cutoff frequency normalized to 1 rad s . We can also use the bode function to display both the (asymptotic) magnitude and phase plots. The following script will produce the Bode magnitude and phase plots for a twopole Butterworth low-pass filter.
[z,p,k]= buttap(2); % Specify a twopole filter;... [b,a]=zp2tf(z,p,k); % Display in polynomial rational form;... w=0:0.01:4; [mag,phase]=bode(b,a,w);... b,a % Display b and a coefficients
The Bode plots are shown in Figure 11.21. The frequency is displayed in rad sec and the cutoff frequency normalized to 1 rad s . We can also display the Bode plots with the frequency specified in Hz . This can be done with the MATLAB script below.
h=bodeplot(tf(num,den));... setoptions(h,'FreqUnits', 'Hz'); grid
The Bode plots with the frequency specified in Hz are shown in Figure 11.22.
1124 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Butterworth 2nd Order Low-Pass Filter 0 Magnitude (dB) Phase (deg) -20 -40 -60 -80 0 -45 -90 -135 -180 -2 10
-1 0 1 2
10
10
10
10
Frequency (rad/sec)
Figure 11.21. Bode plots for example 11.6 using MATLABs bode function in rad/sec
Bode Diagram 0 Magnitude (dB) Phase (deg) -20 -40 -60 0 -45 -90 -135 -180 -3 10
-2 -1 0 1
10
10
10
10
Frequency (Hz)
Figure 11.22. Bode plots for example 11.6 using MATLABs bode function in Hz
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1125
( x 1) x >1
(11.43) (11.44)
and
C k ( x ) = cos h ( kcosh x )
1
With k = 1 ,
C 1 ( x ) = cos ( 1cos x ) = x *
1
With k = 2
C 2 ( x ) = cos ( 2cos x ) = 2x 1
1 2
1 = 2x 1
We can also use MATLAB to convert these trigonometric functions to algebraic polynomials. For example,
syms x; expand(cos(2*acos(x)))
ans = 2*x^2-1 Using this iterated procedure we can show that with k = 3, 4, and 5 , we obtain
C 3 ( x ) = 4x 3x
3
C 4 ( x ) = 8x 8x + 1
C 5 ( x ) = 16x 20x + 5x
(11.48)
and so on. We observe that for k = even , C k ( x ) = even , and for k = odd , C k ( x ) = odd . The curves representing these polynomials are shown in Figure 11.23. The Chebyshev Type I lowpass filter magnitudesquare function is defined as
2 A ( ) = -------------------------------------------2 2 1 + Ck ( C )
(11.49)
1126 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Ck(x)
k=1 k=0
In relation (11.49), the quantity is a parameter chosen to provide the desired passband ripple, the parameter is a constant chosen to determine the desired DC gain, the subscript k denotes both the degree of the Chebyshev Type I polynomial and the order of the transfer function, and C is the cutoff frequency. This filter produces a sharp cutoff rate in the transition band.
2
Figure 11.24 shows Chebyshev Type I magnitude frequency responses for k = 3 and k = 4 .
/(1+2)1/2
Amplitude
k=odd (k=3)
k=even (k=4)
1 /c 2
Figure 11.24. Chebyshev Chebyshev Type I lowpass filter for even and odd values of k .
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1127
(11.50)
Stated in other words, the passband is the range over which the ripple oscillates with constant bounds; this is the range from DC to C . From (11.50), we observe that only when = 1 the magnitude at the cutoff frequency is 0.707 i.e., the same as in other types of filters. But when 0 < < 1 , the cutoff frequency is greater than the conventional 3 dB cutoff frequency C . Table 11.4 gives the ratio of the conventional cutoff frequency f 3 dB to the ripple width frequency f C of a Chebyshev Type I lowpass filter.
TABLE 11.4 Ratio of conventional cutoff frequency to ripple width frequency Ratio of Conventional f 3 dB Cutoff Frequency to Ripple Width for LowPass Chebyshev Filters Ripple Width dB 0.1 0.5 1.0 k=2 1.943 1.390 1.218
f3
dB
fc
(11.51)
where A max and A min are the maximum and minimum values respectively of the magnitude A in the passband interval. From (11.49),
2 A ( ) = -----------------------------------------2 2 1 + Ck ( C )
(11.52)
A max =
(11.53)
C k ( C) 1
1128 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
x 1
or
C k ( x ) 1 for 1 x 1
Therefore,
C k ( C ) max = 1
2
and
2 A min = ------------2 1+
(11.54)
= 10log 10 ( 1 + )
(11.55)
or
or
= 10
2
r dB 10
(11.56)
We have seen that when k = odd , there is a maximum at = 0 . At this frequency, (11.49) reduces to
A (0) =
2
(11.57)
2
and for a unity gain, = 1 when k = odd . However, for unity gain when k = even , we must have = 1 + . This is because at = 0 , we must have C k ( 0 ) = 1 in accordance with(11.45). Then, the relation
2 A ( ) = ----------------------------------------2 2 1 + Ck ( C )
reduces to
2 A ( 0 ) = ---------------------------- = ------------- = 1 2 2 2 1 + Ck ( 0 ) 1 +
or
= 1+
2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1129
resulting in
2 2 1+ A ( max ) = ------------- = 1 + 1 2
or
A ( max ) = 1+
2
Example 11.7 Derive the transfer function G ( s ) for the k = 2 , Chebyshev Type I function that has passband ripple r dB = 1 dB , unity DC gain, and normalized cutoff frequency at C = 1 rad s . Solution: From (11.49),
2 A ( ) = ----------------------------------------2 2 1 + Ck ( C ) 2
(11.58)
and since k = even , for unity DC gain, we must have = 1 + . Then, (11.58) becomes
2 1+ A ( ) = ----------------------------------------2 2 1 + C k ( C) 2
For k = 2
C 2 ( x ) = 2x 1
2
and
C k ( C ) = C k ( ) = ( 2 1 ) = 4 4 + 1
2 2 2 2 4
1 = 10
1 10
1 = 1.259 1 = 0.259
Then,
2 1.259 1 + 0.259 A ( ) = ------------------------------------------------------------ = ----------------------------------------------------------------4 4 2 1.036 1.036 + 1.259 1 + 0.259 ( 4 4 + 1 )
1130 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
We find the poles from the roots of the denominator using the MATLAB script below.
d=[1.036 0 1.036 0 1.259]; p=roots(d); fprintf(' \n'); disp('p1 = '); disp(p(1));... disp('p2 = '); disp(p(2)); disp('p3 = '); disp(p(3)); disp('p4 = '); disp(p(4))
p1 = -0.5488 + 0.8951i p2 = -0.5488 - 0.8951i p3 = 0.5488 + 0.8951i p4 = 0.5488 - 0.8951i We now form the transfer function from the left halfplane poles p 1 = 0.5488 + j0.8951 and p 2 = 0.5488 j 0.8951 . Then,
K K G ( s ) = ------------------------------------ = ------------------------------------------------------------------------------------------------------------( s p1 ) ( s p2 ) ( s + 0.5488 j0.8951 ) ( s + 0.5488 + j0.8951 )
We will use MATLAB script below to multiply the factors of the denominator.
syms s; den=(s+0.54880.8951*j)*(s+0.5488+0.8951*j); simple(expand(den))
ans = s^2+686/625*s+22047709/20000000
686/625
ans = 1.0976
22047709/20000000
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1131
and at s = 0 ,
K G ( 0 ) = --------------1.1024
Also, A ( 0 ) = 1 , or A ( 0 ) = 1
2
Then, or
K G ( 0 ) = A ( 0 ) = --------------- = 1 1.1024
K = 1.1024
We can plot the attenuation band for Chebyshev Type I filters, as we did with the Butterworth filters in Figure 11.17, but we need to construct one for each value of dB in the ripple region. Instead, we will develop the following procedure. We begin with the Chebyshev approximation
2 A ( ) = ----------------------------------------2 2 1 + Ck ( C )
(11.59)
and, for convenience, we let = 1 . If we want the magnitude of this to be less than some value
for C , we should choose the value of k in C k ( C) so that
2
1 ---------------------------------------- 2 2 2 1 + C k ( C)
(11.60)
that is, we need to find a suitable value of the integer k so that (11.60) will be satisfied. As we have already seen from (11.56), the value of can be determined from
= 10
2 r dB 10
once the bandpass ripple has been specified. Next, we need to find G ( s ) from
A ( ) = G ( s )G ( s )
2 s = j
1132 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(11.61)
It can be shown that the poles of the lefthalf of the s plane are given by
( 2i + 1 ) ( 2i + 1 ) s i = C b sin ---------------------- + jc cos ---------------------2k 2k
(11.62)
(11.63)
and
c = m+m ------------------2
1
(11.64)
where
m = ( 1+
2
+ )
1 1 k
(11.65)
(11.66)
i=0
Example 11.8 Design a Chebyshev Type I analog low pass filter with 3 dB band pass ripple and C = 5 rad s . The attenuation for 15 rad s must be at least 30 dB decade . Solution: From (11.56),
= 10
2 r dB 10 3 10
1 = 10
1 = 1.9953 1 1
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1133
To find the minimum value of k which satisfies this inequality, we compute the Chebyshev polynomials for k = 0, 1, 2, 3, . From (11.45) through (11.48), we obtain
C0 ( 3 ) = 1 C1 ( 3 ) = 3 = 9 C 2 ( 3 ) = ( 2 3 1 ) = 17 = 289 C 3 ( 3 ) = ( 4 3 3 3 ) = 99 = 9801
2 3 2 2 2 2 2 2 2 2 2
and since C k ( 3 ) must be such that 1 + Ck ( 3 ) 10 , we choose k = 3 . Next, to find the poles of
2 2 3
left half of the s plane we first need to compute m , b , and c . From (11.65),
m = ( 1+
2
+ )
1 1 k
13 13 1 1 = 1 + ---- + -------- = ( 2 + 1) 2 2
or
m = 1.3415
and
m
1
= 0.7454
and the poles for i = 0, 1, and 2 are found from (11.62), that is,
s i = C b sin ( 2i + 1 ) + jc cos ( 2i + 1 ) ------------------------------------------2k 2k
1134 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
ans = 31.2144
syms s; den=(s+1.49)*(s+0.745j*4.516)*(s+0.745+j*4.516); simple(expand(den))
(11.67)
To verify that the derived transfer function G ( s ) of (11.67) satisfies the filter specifications, we use the MATLAB script below to plot G ( j ) .
w=0:0.01:100; s=j*w; Gs=31.214./(s.^3+2.98.*s.^2+23.169.*s+31.214);... magGs=abs(Gs); dB=20.*log10(magGs); semilogx(w,dB);... xlabel('Radian Frequency w rad/s log scale'); ylabel('|G(w)| in dB');... title('Magnitude of G(w) versus Radian Frequency'); grid
We can use the MATLAB cheb1ap function to design a Chebyshev Type I analog lowpass filter. Thus, the [z,p,k] = cheb1ap(N,Rp) statement where N denotes the order of the filter, returns the zeros, poles, and gain of an Nth order normalized prototype Chebyshev Type I analog lowpass filter with ripple Rp decibels in the pass band.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1135
-1
10
Example 11.9 Use the MATLAB cheb1ap function to design a secondorder Chebyshev Type I lowpass filter with 3 dB ripple in the passband. Solution: We use the script
w=0:0.05:400; % Define range to plot;... [z,p,k]=cheb1ap(2,3);... [b,a]=zp2tf(z,p,k); % Convert zeros and poles of G(s) to polynomial form;... [mag,phase]=bode(b,a,w); hold on;... b,a % Display the b and a coefficients
b = 0 a = 1.0000 0.6449 0.7079 Now, with the known values of a and b we use the bode function to produce the magnitude and phase Bode plots as follows:
bode(b,a), title('Bode Plot for Type 1 Chebyshev LowPass Filter'); grid
0.5012
1136 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Bode Plot for Type 1 Chebyshev Low-Pass Filter 0 Magnitude (dB) Phase (deg) -20 -40 -60 -80 0 -45 -90 -135 -180 -2 10
-1 0 1 2
10
10
10
10
Frequency (rad/sec)
On the Bode plots shown in Figure 11.26, the ripple is not so obvious. The reason is that this is a Bode plot with straight line approximations. To see the ripple, we use the MATLAB script below.
w=0:0.01:10; [z,p,k]=cheb1ap(2,3); [b,a]=zp2tf(z,p,k); Gs=freqs(b,a,w);... xlabel('Frequency in rad/s'), ylabel('Magnitude of G(s) (absolute values)');... semilogx(w,abs(Gs)); title('Type 1 Chebyshev LowPass Filter'); grid
0.8
0.6
0.4
0.2
0 -2 10
10
-1
10
10
Figure 11.27. Magnitude characteristics for the Chebyshev Type I filter of Example 11.9
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1137
Chapter 11 Analog and Digital Filters 11.3.3 Chebyshev Type II Analog LowPass Filter Design
The Chebyshev Type II, also known as Inverted Chebyshev filters, are characterized by the following magnitudesquare approximation.
C k ( C ) 2 A ( ) = ----------------------------------------2 2 1 + C k ( C )
2 2
(11.68)
and has the ripple in the stopband as opposed to Type I which has the ripple in the passband as shown in Figure 11.28.
A()
k=4
In relation (11.68), the frequency C defines the beginning of the stop band. We can design Chebyshev Type II lowpass filters with the MATLAB cheb2ap function. Thus, the statement [z,p,k] = cheb2ap(N,Rs) where N denotes the order of the filter, returns the zeros, poles, and gain of an Nth order normalized prototype Chebyshev Type II analog lowpass filter with ripple Rs decibels in the stop band. Example 11.10 Using the MATLAB cheb2ap function, design a third order Chebyshev Type II analog filter with 3 dB ripple in the stop band. Solution: We begin with the MATLAB script below.
w=0:0.01:1000; [z,p,k]=cheb2ap(3,3); [b,a]=zp2tf(z,p,k); Gs=freqs(b,a,w);... semilogx(w,abs(Gs)); xlabel('Frequency in rad/sec log scale');... ylabel('Magnitude of G(s) (absolute values)');... title('Type 2 Chebyshev LowPass Filter, k=3, 3 dB ripple in stop band'); grid
1138 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
0.8
0.6
0.4
0.2
0 -2 10
10
-1
10
10
Figure 11.29. Plot for the Chebyshev Type II filter of Example 11.10
(11.69)
where R k ( x ) represents a rational elliptic function used with elliptic integrals. Elliptic filters have ripple in both the passband and the stopband as shown in Figure 11.30.
5-pole Elliptic Low Pass Filter 1 Magnitude of G(s) (absolute values)
0.8
0.6
0.4
0.2
0 -2 10
10
-1
10
10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1139
Example 11.11 Use MATLAB to design a fourpole elliptic analog lowpass filter with 0.5 dB maximum ripple in the passband and 20 dB minimum attenuation in the stopband with cutoff frequency at 200 rad s . Solution: The solution is obtained with the following MATLAB script:
w=0: 0.05: 500; [z,p,k]=ellip(4, 0.5, 20, 200, 's'); [b,a]=zp2tf(z,p,k);... Gs=freqs(b,a,w); semilogx(w,abs(Gs)); xlabel('Frequency in rad/sec log scale');... ylabel('Magnitude of G(s) (absolute values)'); title('4pole Elliptic Low Pass Filter'); grid
0.8
0.6
0.4
0.2
0 -2 10
10
-1
10
10
Next, suppose that we need to form the transfer function G ( s ) for this example. To do this, we
1140 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
and MATLAB displays a = 1.0e+009 * 0.00000000100000 0.00910982722080 b = 1.0e+009 * 0.00000000009998 -0.00000000000000 -0.00000000000000 1.09388572421614 0.00002534545964 0.00000022702032 1.15870252829421 0.00007532236403
(11.70)
1141
LowPass Filter, 3 dB passband, NonNormalized Frequency LP s C ------- LP HighPass Filter, 3 dB passband from = 2 to = BandPass Filter, 3 dB passband from = LP to = 2 BandElimination Filter, 3 dB passband from = 0 to = LP , and from = 2 to = LP 2 -------------------s s + LP 2 C ------------------------------s ( 2 LP ) s ( 2 LP ) C ------------------------------2 s + LP 2
2
b = 0 a = 1.0000 2.0000 2.0000 1.0000 Thus, the transfer function for the thirdorder Butterworth lowpass filter with normalized cutoff frequency c = 1 rad s is
1 G ( s ) = --------------------------------------3 2 s + 2s + 2s + 1
3
(11.71)
Next, the actual cutoff frequency is given as f C = 1 KHz or C = 2 10 rad s . Accordingly, in accordance with Table 11.5, we replace s with
s C s --------- = -------------------3 LP 2 10
and we obtain
s 1 G -------------------- = G' ( s ) = ------------------------------------------------------------------------------------------------------------------------------------------------3 3 3 3 2 3 2 10 ( s ( 2 10 ) ) + 2 ( s ( 2 10 ) ) + 2 ( s ( 2 10 ) ) + 1
1142 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(11.72)
(11.73)
or
2 2 6 2 8 s + 2 10 3 2 10 s + 12 10 s + 1.844 10 1 -------------------------------------------------------------------- = ------------------------------------------- = -------------------------------------3 3 3 4 s ( 3 2 10 2 10 ) s ( 4 10 ) 1.257 10 s 2 3 3
Then,
2.48 10 G'' ( s ) = --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------3 2 2 8 s 2 + 1.844 10 8 s 2 + 1.844 10 8 11 s + 1.844 10 -------------------------------------- + -------------------------------------- + -------------------------------------- + 2.48 10 4 4 4 1.257 10 s 1.257 10 s 1.257 10 s
11
We see that the computations, using the transformations of Table 11.5 become quite tedious. Fortunately, we can use the MATLAB lp2lp, lp2hp, lp2bp, and lp2bs functions to transform a low pass filter with normalized cutoff frequency, to another lowpass filter with any other specified frequency, or to a highpass filter, or to a bandpass filter, or to a bandelimination filter respectively. Example 11.13 Use the MATLAB buttap and lp2lp functions to derive the transfer function of a thirdorder Butterworth lowpass filter with cutoff frequency f C = 2 KHz . Solution: We will use the buttap command to derive the transfer function G ( s ) of the filter with normalized cutoff frequency at C = 1 rad s . Then, we will use the command lp2lp to transform G ( s ) to G' ( s ) with cutoff frequency at f C = 2 KHz , or C = 2 2 10 rad s .
3
format short e % Will be used to find coefficients for transfer function;... % Design 3 pole Butterworth lowpass filter (wcn=1 rad/s);... [z,p,k]=buttap(3); % To find transfer function with normalized cutoff frequency;... [b,a]=zp2tf(z,p,k); % Compute num, den coefficients of this filter (wcn=1rad/s);... f=100:100:10000; % Define frequency range to plot;... w=2*pi*f; % Convert to rads/sec;... fc=2000; % Define actual cutoff frequency at 2 KHz;...
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1143
The plot for the magnitude of this transfer function is shown in Figure 11.32.
3-pole Butterworth low-pass filter with fc=2 kHz or wc = 12.57 kr/s 0 Magnitude of Transfer Function (dB) -5 -10 -15 -20 -25 -30 -35 -40 -45 2 10
3 4 5
10
Figure 11.32. Magnitude for the transfer function for Example 11.13
The coefficients of the numerator and denominator of the transfer function are as follows:
b, a, bn, an
2.5133e+004
3.1583e+008
1.9844e+012
(11.74)
4
(11.75)
1144 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
10
The coefficients of the numerator and denominator of the transfer function are as follows: Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1145
9.2835e-001
(11.76)
4
(11.77)
Example 11.15 Use the MATLAB functions buttap and lp2bp to derive the transfer function of a 3pole Butterworth analog bandpass filter with the pass band frequency centered at f 0 = 4 KHz , and bandwidth BW = 2 KHz . Solution: We will use the buttap function to derive the transfer function G ( s ) of the lowpass filter with normalized cutoff frequency at C = 1 rad s . We found this transfer function in Example 11.12 as given by (11.71), Page 1142. However, to maintain a similar MATLAB script as in the previous examples, we will include it in the script below. Then, we will use the command lp2bp to transform G ( s ) to another transfer function G' ( s ) with centered frequency at f 0 = 4 KHz or
0 = 2 4 10 rad s , and bandwidth BW = 2 KHz or BW = 2 2 10 rad s
3 3
format short e;... [z,p,k]=buttap(3); [b,a]=zp2tf(z,p,k); f=100:100:100000; f0=4000; W0=2*pi*f0; fbw=2000; Bw=2*pi*fbw;
% Design 3 pole Butterworth low-pass filter with wcn=1 rad/s;... % Compute numerator and denominator coefficients for wcn=1 rad/s;... % Define frequency range to plot;... % Define centered frequency at 4 KHz;... % Convert desired centered frequency to rads/sec;... % Define bandwidth;... % Convert desired bandwidth to rads/sec;...
1146 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
10
Figure 11.34. Plot for the band-pass filter of Example 11.15 bn, an
an = 1.0000e+000 2.5133e+004 2.2108e+009 3.3735e+013 1.3965e+018 1.0028e+022 2.5202e+026 Since the numerator b n and denominator a n coefficients are too large to be written in a one line equation, we have listed them in tabular form as shown below.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1147
Numerator b n
0
Denominator a n
1 2.5133 10 2.2108 10
4 9
0
0 1.9844 10
12
13 18 22 26
5
9
Example 11.16 Use the MATLAB functions buttap and lp2bs to derive the transfer function of a 3pole Butterworth bandelimination (bandstop) filter with the stop band frequency centered at f 0 = 5 KHz , and bandwidth BW = 2 KHz . Solution: We will use the buttap function to derive the transfer function G ( s ) of the lowpass filter with normalized cutoff frequency at C = 1 rad s . We found this transfer function as (11.71) in Example 11.12, Page 1142. However, to maintain a similar MATLAB script as in the previous examples, we will include it in the script which follows. Accordingly, we will use the lp2bs function to transform G ( s ) to another transfer function G' ( s ) with centered frequency at
f 0 = 5 KHz , or radian frequency 0 = 2 5 10 rad s , and bandwidth BW = 2 KHz or
3
BW = 2 2 10 rad s .
3
[z,p,k]=buttap(3); % Design 3pole Butterworth lowpass filter, wcn = 1 r/s;... [b,a]=zp2tf(z,p,k); % Compute num, den coefficients of this filter, wcn=1 r/s;... f=1000:100:10000; % Define frequency range to plot;... f0=5000; % Define centered frequency at 5 kHz;... W0=2*pi*f0; % Convert centered frequency to r/s;... fbw=2000; % Define bandwidth;... Bw=2*pi*fbw; % Convert bandwidth to rad/s;... % Compute numerator and denominator coefficients of desired band stop filter;... [bn,an]=lp2bs(b,a,W0,Bw);... % Compute and plot magnitude of the transfer function of the band stop filter;... Gsn=freqs(bn,an,2*pi*f); semilogx(f,20.*log10(abs(Gsn)));... xlabel('Frequency in Hz log scale'); ylabel('Magnitude of Transfer Function (dB)');... title('3-pole Butterworth band-elimination filter with f0=5 KHz, BW = 2 KHz'); grid
The magnitude response for this bandelimination filter is shown in Figure 11.35.
1148 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
10
Figure 11.35. Magnitude response for the bandelimination filter of Example 11.16
-1.5071e-002
5.1594e+013
As in the previous example, we list the numerator b n and denominator a n coefficients in tabular form as shown below.
Power of s
s6 s5 s4 s3 s2 s Cons tan t
Numerator b n
1 7.6352 10 2.9609 10
12
Denominator a n
1 2.5133 10 3.2767 10 5.1594 10 3.2340 10 2.4482 10 9.6139 10
4 9
6 2
1.5071 10 2.9223 10
13 18 22 26
18 6
7.4374 10 9.6139 10
26
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1149
We can obtain the magnitude and phase characteristics with the following MATLAB script:
num=[0 0 0 1]; den=[1 2 2 1]; bode(num,den),... title('Bode Plot for 3pole Butterworth LowPass Filter'); grid
10
10
10
Frequency (rad/sec)
Figure 11.36. Bode plots for 3pole Butterworth lowpass filter, Example 11.17
We conclude the discussion on analog filters with Table 11.6 listing the advantages and disadvantages of each type.
1150 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
TABLE 11.6 Advantages / Disadvantages of different types of filters Filter Type Butterworth Advantages Simplest design Flat pass band Disadvantages Slow rate of attenuation for order 4 or less
Chebyshev Type 1 Sharp cutoff rate in transition Ripple in pass band (pass to stop) band Bad (nonlinear) phase response Chebyshev Type II Sharp cutoff rate in transition Ripple in stop band (pass to stop) band Bad (nonlinear) phase response Elliptic (Cauer) Sharpest cutoff rate among all other types of filters Ripple in both pass band and stop band Worst (most nonlinear) phase response among the other types of filters.
i=0
ai x [ n i ]
bi y [ n i ]
i=0
(11.78)
ai z
i=0
(11.79)
Therefore, the design of a digital filter to perform a desired function, entails the determination of the coefficients a i and b i . Digital filters are classified in terms of the duration of the impulse response, and in forms of realization. 1. Impulse Response Duration a. An Infinite Impulse Response (IIR) digital filter has infinite number of samples in its impulse
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1151
Figure 11.37 shows thirdorder (3delay element) recursive realization and Figure 11.38 shows a thirdorder nonrecursive realization. The components of either realization are shown in Figure 11.39. Generally, IIR filters are implemented by recursive realization, whereas FIR filters are implemented by nonrecursive realization. Filter design methods have been established, and prototype circuits have been published. Thus, we can choose the appropriate prototype to satisfy the requirements. Transformation methods are also available to map an analog prototype to an equivalent digital filter. Three well known transformation methods are the following: 1. The Impulse Invariant Method which produces a digital filter whose impulse response consists of the sampled values of the impulse response of an analog filter. 2. The Step Invariant Method which produces a digital filter whose step response consists of the sampled values of the step response of an analog filter.
a0 a1 a2 x[n] a3 y[n]
Z b 1 b2
1152 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
a0 a1 a2 x[n] a3 y[n]
y[n] v[n]
x[n]
y[n]
x[n]
y[n]
Constant Multiplier y [ n ] = Ax [ n ]
Adder/Subtractor y [ n ] = x [ n ] v [ n ] Figure 11.39. Components of recursive and nonrecursive digital filter realization
(11.80)
to transform the lefthalf of the s plane into the interior of the unit circle in the z plane. We will discuss only the bilinear transformation. We recall from (9.67) of Chapter 9, Page 922, that
F( z) = G(z) = G(s )
1 s = ----- ln z TS
(11.81)
1 But the relation s = ----- ln z is a multivalued transformation and, as such, cannot be used to TS
(11.82)
* T s is the sampling period, that is, the reciprocal of the sampling frequency f s
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1153
(11.83)
j d TS
, we obtain
2 e d S1 ) = G ----- ------------------------ T S e j d TS + 1
j T
j d TS
(11.84)
Since the z s transformation maps the unit circle into the j axis on the s plane, the quan2- e 1 tity ---- ------------------- and j must be equal to some point = a on the j axis, that is, j Ts e
d
j d
+1
2 e 1 j a = ----- -----------------------T S j d TS e +1
j d TS
or
d S d S d S 1 2- e 1 e 2- 1 ( j 2 ) e 2- sin ( d T S ) 2 a = -- ---- ------------------------ = ----- ---------------- ---------------------------------------------- = ----- --------------------------------j d TS 2 j d TS 2 j T s j d TS TS 1 2 T S cos ( d T S ) 2 +1 +e e e
j T
j T 2
j T 2
or
d TS 2 a = ----- tan -----------TS 2
(11.85)
We see that the analog frequency to digital frequency transformation results in a nonlinear mapping; this condition is known as warping. For instance, the frequency range 0 a in the analog frequency is warped into the frequency range 0 d T s in the digital frequency. To express d in terms of a , we rewrite (11.85) as
d TS a TS tan ------------ = -----------2 2
a TS d T S 2 ------------ a T S 2
(11.86) (11.87)
1154 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
In MATLAB, z is a function of normalized frequency and thus the range of frequencies in G ( z ) is from 0 to . Then (11.86), when used with MATLAB, becomes
a TS d -----------
(11.88)
The effect of warping can be eliminated by prewarping the analog filter prior to application of the bilinear transformation. This is accomplished with the use of (11.85). Example 11.18 Compute the transfer function G ( z ) of a lowpass digital filter with 3 dB cutoff frequency at 20 Hz , and attenuation of at least 10 dB for frequencies greater than 40 Hz . The sampling frequency f s is 200 Hz . Compare the magnitude plot with that obtained by a lowpass analog filter with the same specifications. Solution: We will apply the bilinear transformation, and using the procedure of Example 11.5, Page 1120, we arbitrarily choose a second order Butterworth lowpass filter which, as we see from the curves of Figure 11.17, Page 1119, meets the stopband specification. The transfer function G ( s ) of the analog low pass filter with normalized frequency at C = 1 rad s is found with the MATLAB buttap function as follows:
[z,p,k]=buttap(2); [b,a] = zp2tf(z,p,k)
b = 0 a = 1.0000 1.4142 1.0000 Thus, the transfer function with normalized frequency, denoted as G n ( s ) , is
1 G n ( s ) = ----------------------------------2 s + 1.414s + 1
(11.89)
Now, we must transform this transfer function to another with the actual cutoff frequency at 20 Hz . We denote it as G a ( s ) . We will first prewarp the analog frequency which, by relation (11.85), Page 1154, is related to the digital frequency as
d TS 2 a = ----- tan -----------TS 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1155
or
130 f ac = -------- 20.69 Hz 2
As expected from relation (11.87), Page 1155, this frequency is very close to the the discrete time frequency f dc = 20 Hz , and thus from (11.89),
1 G a ( s ) G n ( s ) = ----------------------------------2 s + 1.414s + 1
(11.90)
Relation (11.90) applies only when the cutoff frequency is normalized to to C = 1 rad s . If
C 1 , we must scale the transfer function in accordance with relation (11.34), Page 1119, that
is,
s G ( s ) actual = G --------------- actual
For this example, actual = 130 rad/s , and thus we replace s with s 130 and we obtain
1 G a ( s ) = -----------------------------------------------------------------2 ( s 130 ) + 1.414s 130 + 1
ans = 845000/(50*s^2+9191*s+845000)
845000/50
ans = 16900
9191/50
ans =
1156 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
183.8200 Then,
845000 16900 G a ( s ) = -------------------------------------------------------- = -------------------------------------------------2 2 50s + 9191s + 845000 s + 183.82s + 16900 z1 2- z 1 and making the substitution of s = ----- ----------- = 400 ----------- , we obtain TS z + 1 z+1 16900 G ( z ) = -------------------------------------------------------------------------------------------------------------2 z1 ) 400 ----------- + 183.82 400 ( z 1 - + 16900 ---------------------------------------------- z + 1 (z + 1)
(11.91)
ans = 4225*(z+1)^2/(62607*z^2-71550*z+25843)
expand(4225*(z+1)^2)
(11.92)
We will use the MATLAB freqz function to plot the magnitude of G ( z ) , but we must first express it in negative powers of z . Dividing each term of (11.92) by 62607z , we obtain
2
(11.93)
The MATLAB script below will generate G ( z ) and will plot the magnitude of this transfer function.
bz=[0.0675 0.1350 0.0675]; az=[1 1.1428 0.4128]; [Gz, wT]=freqz(bz,az,20,200);... semilogx(fs,20.*log10(abs(Gz))); xlabel('Frequency in Hz log scale');... ylabel('Magnitude (dB)'); title('Digital LowPass Filter, Example 11.18'); grid
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1157
10
Figure 11.40. Frequency response for the digital lowpass filter of Example 11.18
Let us now plot the analog equivalent to compare the digital to the analog frequency response. The MATLAB script below produces the desired plot.
[z,p,k]=buttap(2); [b,a]=zp2tf(z,p,k); f=1:1:100; fc=20; [bn,an]=lp2lp(b,a,fc);... Gs=freqs(bn,an,f);... semilogx(f,20.*log10(abs(Gs))); xlabel('Frequency in Hz log scale'), ylabel('Magnitude (dB)');... title('Analog LowPass Filter, Example 11.18'); grid
The frequency response for the analog lowpass equivalent is shown in Figure 11.41.
Analog Low-Pass Filter, Example 11.18 0 -5 -10 -15 -20 -25 -30 0 10
Magnitude (dB)
10
Figure 11.41. Frequency response for analog lowpass filter equivalent, Example 11.18
Comparing the digital filter plot of Figure 11.40 with its equivalent the analog filter of Figure 11.41, we observe that the magnitude is greater than0 3 dB for frequencies less than 20Hz , and is smaller than ( 10 dB) for frequencies larger than 40Hz . Therefore, both the digital and analog lowpass filters meet the specified requirements.
1158 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
An analog filter transfer function can be mapped to a digital filter transfer function directly with the MATLAB bilinear function. The procedure is illustrated with the following example. Example 11.19 Use the MATLAB bilinear function to derive the lowpass digital filter transfer function G ( z ) from a second-order Butterworth analog filter with a 3 dB cutoff frequency at 50 Hz , and sampling rate f S = 500 Hz . Solution: We will use the following MATLAB script to produce the desired digital filter transfer function.
[z,p,k]=buttap(2); [num,den]=zp2tf(z,p,k); wc=2*pi*50;... [num1,den1]=lp2lp(num,den,wc); T=1/500; [numd,dend]=bilinear(num1,den1,1/T)
0.1279 -1.1683
0.0640 0.4241
(11.94)
MATLAB provides us with all the functions that we need to design digital filters using analog prototypes. These are listed below with the indicated notations.
N = order of the filter Wn = normalized cutoff frequency Rp = pass band ripple Rs = stop band ripple B = B(z), i.e., the numerator of the discrete transfer function G ( z ) = B ( z ) A ( z ) A = A(z), i.e., the denominator of the discrete transfer function G ( z )
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1159
BandPass Filters
[B,A] = butter(N,[Wn1,Wn2]) [B,A] = cheb1(N,Rp,[Wn1,Wn2]) [B,A] = cheb2(N,Rs,[Wn1,Wn2]) [B,A] = ellip(N,Rp,Rs,[Wn1,Wn2])
BandElimination Filters
[B,A] = butter(N,[Wn1,Wn2],'stop') [B,A] = cheb1(N,Rp,[Wn1,Wn2],'stop') [B,A] = cheb2(N,Rs,[Wn1,Wn2],'stop') [B,A] = ellip(N,Rp,Rs,[Wn1,Wn2],'stop')
Example 11.20 The transfer functions of (11.95) through (11.98) below, describe different types of digital filters. Use the MATLAB freqz command to plot the magnitude versus radian frequency.
( 2.8982 + 8.6946 z + 8.6946z + 2.8982z ) 10 G 1 ( z ) = -------------------------------------------------------------------------------------------------------------------------------1 2 3 1 2.3741z + 1.9294z 0.5321z 0.5276 1.5828 z + 1.5828z 0.5276 z G 2 ( z ) = -------------------------------------------------------------------------------------------------------1 2 3 1 1.7600z + 1.1829z 0.2781z ( 6.8482 13.6964 z + 6.8482z ) 10 G 3 ( z ) = ---------------------------------------------------------------------------------------------------------------------------1 2 3 4 1 + 3.2033z + 4.5244z + 3.1390z + 0.9603z 0.9270 1.2079 z + 0.9270z G 4 ( z ) = ---------------------------------------------------------------------------1 2 1 1.2079z + 0.8541z
1 2 2 4 4 1 2 3 1 2 3 3
(11.95)
(11.96)
(11.97)
(11.98)
Solution: The MATLAB script to plot each of the transfer functions of (11.95) through (11.98), is given below where N = 512 , i.e., the default value.
b1=[2.8982 8.6946 8.6946 2.8982]*10^(3); a1=[1 2.3741 1.9294 0.5321];... [G1z,w1T]=freqz(b1,a1);... % b2=[0.5276 1.5828 1.5828 0.5276]; a2=[1 1.7600 1.1829 0.2781];... [G2z,w2T]=freqz(b2,a2);...
1160 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
% b3=[6.8482 0 13.6964 0 6.8482]*10^(4); a3=[1 3.2033 4.5244 3.1390 0.9603];... [G3z,w3T]=freqz(b3,a3);... % b4=[0.9270 1.2079 0.9270]; a4=[1 1.2079 0.8541];... [G4z,w4T]=freqz(b4,a4);... clf; % clear current figure;... % subplot(221), semilogx(w1T,abs(G1z)), axis([0.1 1 0 1]), title('Filter for G1(z)');... xlabel(''),ylabel('Magnitude'),grid;... % subplot(222), semilogx(w2T,abs(G2z)), axis([0.1 10 0 1]), title('Filter for G2(z)');... xlabel(''),ylabel('Magnitude'),grid;... % subplot(223), semilogx(w3T,abs(G3z)), axis([1 10 0 1]), title('Filter for G3(z)');... xlabel(''),ylabel('Magnitude'),grid;... % subplot(224), semilogx(w4T,abs(G4z)), axis([0.1 10 0 1]), title('Filter for G4(z)');... xlabel(''),ylabel('Magnitude'),grid
The plots are shown in Figure 11.42. We observe that the given transfer functions are for low pass, highpass, bandpass, and bandelimination digital filters.
Filter for G1(z) 1 Magnitude Magnitude 1 Filter for G2(z)
0.5
0.5
10
0 -1 10 1 Magnitude
10
10
0.5
0.5
0 0 10
10
0 -1 10
10
10
Example 11.21 We are given a 165 KHz total bandwidth, and within this bandwidth we must accommodate four different signals. Each of these signals requires 25 KHz bandwidth. We are asked to define the types of filters and cutoff frequencies to avoid interference among these signals. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1161
The plot of Figure 11.43 shows the frequency separations for these four signals.
1162 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
Four signals separated by four digital filters 1
0.8
Magnitude
0.6
0.4
0.2
8 Hz
10
12
14
16 x 10
4
In the following example, we will demonstrate the MATLAB filter function that is being used to remove unwanted frequency components from a function. But before we use the filter function, we must design a filter that is capable of removing those unwanted components. Example 11.22 In Chapter 7, Subsection 7.4.4, Page 720, we found that the halfwave rectifier with no symmetry can be represented by the trigonometric Fourier series
A cos 2t cos 4t cos 6t cos 8t A A f ( t ) = --- + --- sin t --- ------------- + ------------- + ------------- + ------------- + 63 35 15 3 2
In this example, we want to filter out just the first 2 terms, in other words, to remove all cosine terms. To simplify this expression, we let A = 3 and we truncate it by eliminating all cosine terms except the cos 2t term. Then,
g ( t ) = 3 + 1.5 sin t cos 2t
(11.99)
The problem now reduces to design a lowpass digital filter, and use the filter command to remove the cosine term in (11.99). Solution: We will use a 6 pole digital lowpass Butterworth filter because we must have a sharp transition between the 1 and 2 rad s frequency range. Also, since the highest frequency component is 2 rad s , to avoid aliasing, we must specify a sampling frequency of S = 4 rad s . Thus, the
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1163
quency of the filter to be C = 1.5 rad s in order to attenuate the cosine terms. The MATLAB script below will perform the following steps: 1. Will compute coefficients of the numerator and denominator of the transfer function with normalized cutoff frequency. 2. Will recompute the coefficients for the desired frequency. 3. Use the bilinear function to map the analog transfer function to a digital transfer function, and will plot the frequency response of the digital filter. 4. Will recompute the digital filter transfer function to account for the warping effect. 5. Will use the filter function to remove the cosine terms
% Step 1;... % [z,p,k]=buttap(6);... [b,a]=zp2tf(z,p,k);... % % Step 2;... % wc=1.5; % Chosen cutoff frequency;... [b1,a1]=lp2lp(b,a,wc); % Convert to actual cutoff frequency;... % % Step 3;... % T=0.5; % Define sampling period;... [Nz,Dz]=bilinear(b1,a1,1/T); % Map to digital filter using the bilinear transformation;... w=0:2*pi/300:pi; % Define range for plot;... Gz=freqz(Nz,Dz,w); % The digital filter transfer function;... % clf;... % plot(w,abs(Gz)); axis([0 2 0 1]); grid; hold on;... % We must remember that when z is used as a function of;... % normalized frequency, the range of frequencies of G(z) are;... % from zero to pi and the normalized cutoff frequency on the;... % plot is wc*T=1.5*0.5=0.75 r/s;... % xlabel('Radian Frequency w in rads/sec'),... ylabel('Magnitude of G(z)'),... title('Digital Filter Response in Normalized Frequency, Example 11.22');... % fprintf('Press any key to continue \n');...
1164 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
% pause;... % % Step 4;... % p=6; T=0.5; % Number of poles and Sampling period;... wc=1.5; % Analog cutoff frequency in rad/sec;... wd=wc*T/pi; % Normalized digital filter cutoff frequency by (11.88), Page 1155;... [Nzp,Dzp]=butter(p,wd);... fprintf('Summary: \n\n');... fprintf('WITHOUT PREWARPING: \n\n');... % fprintf('The num N(z) coefficients in descending order of z are: \n\n');... fprintf('%8.4f \t',[Nz]);... fprintf('\n\n');... fprintf('The den D(z) coefficients in descending order of z are: \n\n');... fprintf('%8.4f \t',[Dz]);... fprintf('\n\n');... fprintf('WITH PREWARPING: \n\n');... % fprintf('The num N(z) coefficients in descending order of z are: \n\n');... fprintf('%8.4f \t',[Nzp]);... fprintf('\n\n');... fprintf('The den D(z) coefficients in descending order of z are: \n\n');... fprintf('%8.4f \t',[Dzp]);... fprintf('\n\n');...
The plot of the lowpass filter that will remove the cosine terms is shown in Figure 11.44.
Digital Filter Response in Normalized Frequency, Example 11.22 1 Magnitude of G(z), absolute values
0.8
0.6
0.4
0.2
0.2
0.4 0.6 0.8 1 1.2 1.4 1.6 Radian Frequency w in rads/sec, linear scale
1.8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1165
WITHOUT PREWARPING: The num N(z) coefficients in descending order of z are: 0.0007 0.0040 0.0100 0.0134 0.0100 0.0040 0.0007 The den D(z) coefficients in descending order of z are: 1.0000 -3.2379 4.7566 -3.9273 1.8999 -0.5064 0.0578 WITH PREWARPING: The num N(z) coefficients in descending order of z are: 0.0008 0.0050 0.0125 0.0167 0.0125 0.0050 0.0008 The den D(z) coefficients in descending order of z are: 1.0000 -3.1138 4.4528 -3.5957 1.7075
% Step 5;... % Nzp=[0.0008 0.0050 0.0125 0.0167 0.0125 0.0050 0.0008];... Dzp=[1.0000 3.1138 4.4528 3.5957 1.7075 0.4479 0.0504];... n=0:150;... T=0.5;... gt=3+1.5*sin(n*T)cos(2*n*T);... yt=filter(Nzp,Dzp,gt);... % % We will plot the unfiltered analog signal gta;... % t=0:0.1:12;... gta=3+1.5*sin(t)cos(2*t);... subplot(211), plot(t,gta), axis([0,12, 0, 6]); hold on;... xlabel('Continuous Time t'); ylabel('Function g(t)');... % % We will plot the filtered analog signal y(t);... % subplot(212), plot(n*T,yt), axis([0,12, 0, 6]); hold on;... xlabel('Continuous Time t'); ylabel('Filtered Output y(t)');... % fprintf('Press any key to continue \n'); pause;... % % We will plot the unfiltered discrete time signal g(n*T);... % subplot(211), stem(n*T,gt), axis([0,12, 0, 6]); hold on;... xlabel('Discrete Time nT'); ylabel('Discrete Function g(n*T)');... % % We will plot the filtered discrete time signal y(n*T);... subplot(212), stem(n*T,yt), axis([0,12, 0, 6]); hold on;... xlabel('Discrete Time nT'); ylabel('Filtered Output y(n*T)')
1166 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
The analog and digital inputs and outputs are shown in Figures 11.45 and 11.46 respectively.
6 Function g(t) 4 2 0
6 Continuous Time t
10
12
6 4 2 0
6 Continuous Time t
10
12
Figure 11.45. Continuous time input and output waveforms for Example 11.22
Discrete Function g(n*T) 6 4 2 0
6 Discrete Time nT
10
12
6 4 2 0
6 Discrete Time nT
10
12
Figure 11.46. Discrete time input and output waveforms for Example 11.22
We conclude this section with one more example to illustrate the use of the MATLAB find function. This function displays the subscripts of an array of numbers where a relational expression is true. For example,
x=2:5; % Display the integers in the range -2 <= x < =5
x = -2 -1 0 1 2 3 4 5
k=find(x>0.8); % Find the subscripts of the numbers for which x > 0.8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1167
y = 1 Example 11.23 Given the function f ( t ) = 5 sin 2t 10 cos 5t , use the MATLAB randn function to add random (Gaussian) noise to f ( t ) and plot this signal plus noise waveform which we denote as
x ( t ) = f ( t ) + randn ( N ) = 5 sin 2t 10 cos 5t + randn ( size ( t ) )
(11.100)
where 0 t 512 . Next, use the fft function to compute the frequency components of the 512 point FFT and plot the spectrum of this noisy signal. Finally, use the find function to restrict the frequency range of the spectrum to identify the frequency components of the signal f ( t ) . Solution: The MATLAB script is shown below.
t=linspace(0, 10, 512); x=10*sin(2*t)5*cos(5*t)+15*randn(size(t));... % We plot the signal to see what it looks like;... % subplot(221); plot(t,x),title('x(t)=Signal plus Noise');... % % The input signal x is shown in the upper left corner of the graph;... % % Next, we will compute the frequency domain of the signal x;... % X=fft(x);... % % The sampling period of x is found by the time difference of two samples;... % Ts=t(2)t(1);... % % and the sampling frequency is;... % Ws=2*pi/Ts;... % % As we know, the Nyquist frequency Wn is half the sampling frequency;... % Wn=Ws/2;... % % Now, we will define the frequency domain axis;... %
1168 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filters
w=linspace(0,Wn,length(t)/2);... % % The magnitude of the positive frequency components Xp are found from:;... % Xp=abs(X(1:length(t)/2));... % We want now to plot Xp versus radian frequency w;... % subplot(222); plot(w,Xp),title('Spectrum of Signal & Noise in Wide Range');... % % We will select the frequencies of interest with the "find" function:;... % k=find(w<=20);... % % Now we will plot this restricted range;... % subplot(212); plot(w(k), Xp(k)),title('Spectrum of Signal & Noise in Narrow Range');... % % The last plot will have grid, labels and title;... % xlabel('Frequency, rads/sec'); ylabel('Frequency Components');... title('Spectrum of Signal & Noise in Narrow Range'); grid
10
50
100
150
200
8 10 12 Frequency, rads/sec
14
16
18
20
We observe the appearance of the sinusoids at 2 and 5 rad s in the lower plot. They were undistinguished in the timedomain of the upper left plot. The upper right plot indicates that the signal f ( t ) has frequency components in the lower range of frequencies, but these cannot be identified precisely.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1169
Chapter 11 Analog and Digital Filters 11.6 Digital Filter Design with Simulink
As stated earlier in this chapter, a digital filter, in general, is a computational process, or algorithm that converts one sequence of numbers representing the input signal into another sequence representing the output signal. Accordingly, a digital filter can perform functions as differentiation, integration, estimation, and, of course, like an analog filter, it can filter out unwanted bands of frequency. In this section we provide several applications using Simulink models. A given transfer function H ( z ) of a digital filter can be realized in several forms, the most common being the Direct Form I, Direct Form II, Cascade (Series), and Parallel. These are described in Subsections 11.6.1 through 11.6.4 below. Subsection 11.6.5 describes the Simulink Digital Filter Design block.
a2 a1 a0
y[n]
+ a2 z ) = Y ( z ) ( 1 + b1 z
+ b2 z )
and thus the transfer function of the Direct Form I Realization of the second-order digital filter of Figure 11.48 is
a0 + a1 z + a2 z H ( z ) = Y ( z ) = ---------------------------------------------------1 2 X(z) 1 + b1 z + b2 z
1 2
(11.101)
A disadvantage of a Direct Form I Realization digital filter is that it requires 2k registers where k represents the order of the filter. We observe that the secondorder ( k = 2 ) digital filter of Fig-
1170 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
b0 a1
z
1
y[n]
b1
a2
b2
The transfer function for the Direct FormII secondorder digital filter of Figure 11.49 is the same as for a Direct FormI secondorder digital filter of Figure 11.48, that is,
a0 + a1 z + a2 z H ( z ) = -----------------------------------------1 2 1 + b1 z + b2 z
1 2
(11.102)
A comparison of Figures 11.48 and 11.49 shows that whereas a Direct FormI secondorder digital filter is requires 2k registers, where k represents the order of the filter, a Direct FormII secondorder digital filter requires only k register elements denoted as z . This is because the reg1
ister ( z ) elements in a Direct FormII realization are shared between the zeros section and the poles section.
1
Example 11.24 Figure 11.50 shows a Direct FormII secondorder digital filter whose transfer function is
1 + 1.5z + 1.02z H ( z ) = --------------------------------------------------1 2 1 0.25z + 0.75z
1 2
(11.103)
* For a detailed discussion on overflow conditions please refer to Digital Circuit Analysis and Design with an Introduction to CPLDs and FPGAs, ISBN 0974423963, Section 10.5, Chapter 10, Page 106. The Direct FormII is also known as the Canonical Form.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1171
Figure 11.51. Input and output waveforms for the model of Figure 11.50
in MATLABs Command prompt. This demo is an implementation of the thirdorder transfer function
1 + 2.2z + 1.85z + 0.5z H ( z ) = ---------------------------------------------------------------------1 2 3 1 0.5 z + 0.84z + 0.09z
1 2 3
1172 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Digital Filter Design with Simulink 11.6.3 The Series Form Realization of a Digital Filter
For the Series* Form Realization, the transfer function is expressed as a product of firstorder and secondorder transfer functions as shown in relation (11.104) below.
H ( z ) = H 1 ( z ) H 2 ( ( z )H R ( z ) )
(11.104)
Y(z)
Figure 11.53 shows the Series Form Realization of a secondorder digital filter.
a1
x[n]
+
b1
a2
y[n]
The transfer function for the Series Form secondorder digital filter of Figure 11.53 is
1 + a1 z + a2 z H ( z ) = ----------------------------------------1 2 1 + b1 z + b2 z
1 2
(11.105)
Example 11.25 The transfer function of the Series Form Realization of a certain secondorder digital filter is
0.5 ( 1 0.36 z ) H ( z ) = --------------------------------------------1 2 1 + 0.1z 0.72 z
2
* The Series Form Realization is also known as the Cascade Form Realization
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1173
(11.106)
The model is shown in Figure 11.54, and the input and output waveforms are shown in Figure 11.55.
Figure 11.55. Input and output waveforms for the model of Figure 11.54
* The combination of the of factors in parentheses is immaterial. For instance, we can group the factors as
( 1 + 0.6z ) ----------------------------1 ( 1 + 0.9z )
1 1 1 1 ( 1 0.6z ) -------------------------------------------------------and ( 1 0.6z1 ) or as ( 1 + 0.6z1 ) and ----------------------------1
( 1 0.8z )
( 1 0.8z )
( 1 + 0.9z )
1174 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(11.107)
H1 ( z )
X(z)
H2 ( z )
Y(z)
HR ( z )
As with the Series Form Realization, the ordering of the individual filters in Figure 11.56 is immaterial. But because of the presence of the constant K , we can simplify the transfer function expression by performing partial fraction expansion after we express the transfer function in the form H ( z ) z . Figure 11.57 shows the Parallel Form Realization of a secondorder digital filter. The transfer function for the Parallel Form secondorder digital filter of Figure 11.57 is
a1 + a2 z H ( z ) = ----------------------------------------1 2 1 + b1 z + b2 z
2
(11.108)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1175
x[n]
+
b1
y[n]
Example 11.26 The transfer function of the Parallel Form Realization of a certain secondorder digital filter is
0.5 ( 1 0.36 z ) H ( z ) = --------------------------------------------1 2 1 + 0.1z 0.72 z
2
= 0.147
z = 0.9
= 0.103
z = 0.8
Therefore,
0.103 0.147 H ( z ) = 0.25 + --------------- + --------------------------------z + 0.9 z 0.8 z z 0.147z 0.103z H ( z ) = 0.25 + --------------- + --------------z + 0.9 z 0.8
1176 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
(11.109)
The model is shown in Figure 11.58, and the input and output waveforms are shown in Figure 11.59.
Figure 11.59. Input and output waveforms for the model of Figure 11.58
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1177
in MATLABs Command prompt. This demo is an implementation of the thirdorder transfer function
3.4639 1.0916 + 3.0086z H ( z ) = 5.5556 ---------------------------- + -------------------------------------------------1 1 2 1 0.6z + 0.9z ( 1 + 0.1z )
1
The Digital Filter Design block is included in the Simulink Signal Processing Blockset* and requires the installation of the Simulink program to create models related to digital filter design applications. The functionality of this block can be observed by dragging this block into a model and double-clicking it. When this is done, the Block Parameters dialog box appears as shown in Figure 11.60. As indicated on the left lower part of this box, we can choose the Response Type (Low Pass, High Pass, BandPass, or Band Elimination), the Design Method (IIR or FIR) where an IIR filter can be Butterworth, Chebyshev Type I, Chebyshev Type II, or Elliptic, and FIR can be Window, Maximally Flat, etc., and the Window can be Kaiser, Hamming, etc. We must click on the Design Filter button at the bottom of the Block Parameters dialog box to update the specifications. Example 11.27 below is very similar to that of Example 11.23, Page 11 68. Example 11.27 The signal represented by the waveform of Figure 11.61 is the summation of the sinusoidal signals x , y , and z defined in the MATLAB script below.
t=0:pi/32:16*pi; x=sin(0.25.*t); y=2.*sin(0.75.*t+pi/6); z=5.*sin(1.5.*t+pi/3); plot(t,x+y+z); grid
During transmission of this signal from its source to its destination, this signal is corrupted by the addition of unwanted Gaussian random noise. In this example, we will create a Simulink model that includes a digital filter to remove the Gaussian random noise.
* Blocksets are built-in blocks in Simulink that provide a comprehensive block library for different system components. FDA stands for Filter Design and Analysis. This blockset can be obtained from The MathWorks, Inc., 3 Apple Hill Drive, Natick, MA 01760-2098, Phone: 508-647-7000, www.mathworks.com. A window function multiplies the infinite length impulse response (IIR) by a finite width function, referred to as window function, so that the infinite length series will be terminated after a finite number of terms in the series. The most common window functions are described in the Signal Processing Toolbox Users Guide The MathWorks, Inc.
1178 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Figure 11.60. The Digital Filter Design Block Parameters dialog box
8 6 4 2 0 -2 -4 -6 -8
10
15
20
25
30
35
40
45
50
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1179
The DSP Sine Wave blocks are configured as follows: DSP Sine Wave 1:
Amplitude: 1, Freq (Hz): 0.25, Phase: 0, Sample Time: 0.05, All other parameters in their
default state
All other parameters in their default state All other parameters in their default state
Source type: Gaussian, Method: Ziggurat, Initial seed: [23341], Sample Time: 0.05
When the simulation command is executed, the Scope 1 block in the model of Figure 11.62, dis* For a detailed discussion on configuration of the Scope block, please refer to Introduction to Simulink with Engineering Applications, ISBN 0974423971.
1180 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Figure 11.63. Input and output waveforms displayed in Scope 1 block of Figure 11.62
Figure 11.64. Input and output waveforms displayed in Scope 2 block of Figure 11.62
Next, we add an FDA Tool Digital Filter Design block as shown in Figure 11.65 to remove the unwanted noise created by the Random Source block. The Block Parameters dialog box for the FDA Tool Digital Filter Design block is configured as follows:
Response Type: Lowpass, Design Method: FIR, Window, Window: Rectangular, and all
other unlisted parameters in their default state. Of course, we can choose any other design options. With those specifications, the Scope 2 block displays the waveforms shown in Figure
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1181
Figure 11.65. The model of Figure 11.62 with the addition of an FDA Tool Digital Filter Design block.
Figure 11.66. Input and output waveforms displayed in Scope 2 block of Figure 11.65
Figure 11.66 reveals that with the addition of the FDA Tool Digital Filter Design block, most of the unwanted noise has been removed. However, we can remove the remaining noise with the addition of an adaptive filter.* The Signal Processing Blockset contains blocks that implement the LeastMeanSquare (LMS) block, the Fast Block LMS, and Recursive Least Squares (RLS)
* An adaptive filter is a digital filter that performs digital signal processing and can adapt its performance based on the input signal. All filters weve considered thus far are nonadaptive filter and their characteristics are defined by their transfer function.
1182 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Figure 11.67. Model for Example 11.27 with LMS Filter block
Figure 11.68. Waveforms displayed by Scope 3 block in the model of Figure 11.67
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1183
Figure 11.69. Model for Example 11.27 with Vector Scope block
The Block Parameters dialog box for the Vector Scope block contains four tabs, and for the model of Figure 11.69 these are configured as follows: Scope Properties tab: Input domain: Time, Time display span (number of frames): 1 Display Properties tab: Select the following check boxes: Show grid, Frame Number, Compact Display, and Open scope at start of simulation Axis Properties tab: Minimum Ylimit: 0.1, Maximum Ylimit: 0.5, Yaxis title: Filter Weights Line Properties tab: Line visibilities: on, Line style: , Line markers: o, Line colors: [1 0 0] Before execution of the simulation command, the configuration parameters are specified as follows: From the Simulation drop menu, in the Solver pane, for the Stop time parameter, we enter inf. From the Type list, we choose Fixedstep, and from the Solver list we choose discrete (no continuous states). We close the configuration parameters dialog box by clicking OK. When the simulation command is issued, we observe that the Vector Scope window opens automatically, and the filter coefficients change with time and eventually approach their steadystate
1184 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Figure 11.70. The filter coefficients displayed in the Vector Scope Window in the model of Figure 11.69
Next, we doubleclick on the Scope 3 block in the model of Figure 11.69, and after some time we observe that the error decreases to zero as shown in Figure 11.71, and the output of the adaptive LMS filter is practically the same as the original input signal.
Figure 11.71. Waveforms displayed in the Scope 3 in the model of Figure 11.69
Since for the Stop time parameter we have specified inf, the simulation time goes on forever, and we observe that the waveforms in Figure 11.71 are updated continuously. To stop the simulation, we must click on the Stop simulation icon which is indicated by a small black square immediately to the left of the Stop time field in the window of our model. The Stop simulation is active only when the Stop time is specified as inf and the simulation command has been issued. To Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1185
1186 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
An allpass or phase shift filter has a constant magnitude response but is phase varies with fre A digital filter, in general, is a computational process, or algorithm that converts one sequence
of numbers representing the input signal into another sequence representing the output signal. ferentiation, integration, and estimation. ters.
A digital filter, besides filtering out unwanted bands of frequency, can perform functions of dif Analog filter functions have been used extensively as prototype models for designing digital fil An analog filter can also be classified as passive or active. Passive filters consist of passive
devices such as resistors, capacitors and inductors. Active filters are, generally, operational amplifiers with resistors and capacitors connected to them externally. rated by one octave, and if 2 = 10 1 , they are separated by one decade.
If two frequencies 1 and 2 are such that 2 = 2 1 , we say that these frequencies are sepa The analog lowpass filter is used as a basis. Using transformations, we can derive highpass
In this chapter we discussed the Butterworth, Chebyshev Type I & II, and Cauer (elliptic) fil-
ters.
The first step in the design of an analog lowpass filter is to derive a suitable magnitudesquared
A ( ) = G ( s ) G ( s )
s = j 2
where C is the DC gain, a and b are constant coefficients, and k is a positive integer denoting the order of the filter.
The magnitudesquared function of a Butterworth analog lowpass filter is
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1187
where k is a positive integer indicating the order of the filter, and C is the cutoff ( 3 dB ) frequency.
All Butterworth filters have the property that all poles of the transfer functions that describes them, lie on a circumference of a circle of radius C , and they are 2 2k radians apart. Thus,
if k = odd , the poles start at zero radians, and if k = even , they start at 2 2k . But regardless whether k is odd or even, the poles are distributed in symmetry with respect to the j axis. For stability, we choose the poles of the left half of the s plane to form G ( s ) .
The general form of any analog lowpass (Butterworth, Chebyshev, Elliptic, etc.) filter is G(s)
lp
b0 = --------------------------------------------------------------k 2 ak s + + a2 s + a1 s + a0
The MATLAB buttap and zp2tf functions are very useful functions in the design of Butterworth filters. The first returns the zeros, poles, and gain for an N th order normalized prototype Butterworth analog lowpass filter. The resulting filter has N poles around the unit circle
in the left half plane, and no zeros. The second performs the zeropole to transfer function conversion.
The Chebyshev Type I filters are based on approximations derived from the Chebyshev polynomials C k ( x ) that constitute a set of orthogonal functions. The coefficients of these polynomials
C k ( C ) 2 A ( ) = ----------------------------------------2 2 1 + C k ( C )
and has the ripple in the stopband as opposed to Chebyshev Type I which has the ripple in the passband. The frequency C defines the beginning of the stop band.
The elliptic (Cauer) filters are characterized by the lowpass magnitudesquared function
1188 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Summary
2 1 A ( ) = ----------------------------------2 1 + Rk ( C )
where R k ( x ) represents a rational elliptic function used with elliptic integrals. Elliptic filters have ripple in both the passband and the stopband.
We can design elliptic lowpass filters with the MATLAB ellip function. The statement [b,a] = ellip(N,Rp,Rs,Wn,s) where N is the order of the filter, designs an N th order lowpass filter with ripple Rp decibels in the pass band, a stop band with ripple Rs decibels, Wn is the cutoff frequency, and s is used to specify analog elliptic filters. If s is not included in the above
Transformation methods have been developed where a lowpass filter can be converted to another type of filter simply by transforming the complex variable s . These transformations are listed in Table 11.5 where C is the cutoff frequency of a lowpass filter. We can use the MATLAB lp2lp, lp2hp, lp2bp, and lp2bs functions to transform a lowpass
filter with normalized cutoff frequency, to another lowpass filter with any other specified frequency, or to a highpass filter, or to a bandpass filter, or to a bandelimination filter respectively
We can use the MATLAB function bode(num,den) to generate both the magnitude and
phase responses of any transfer function describing the filter type. realization.
Digital filters are classified in terms of the duration of the impulse response, and in forms of An Infinite Impulse Response (IIR) digital filter has infinite number of samples in its impulse response h [ n ] A Finite Impulse Response (FIR) digital filter has a finite number of samples in its impulse response h [ n ] In a Recursive Realization digital filter the output is dependent on the input and the previous values of the output. In a recursive digital filter, both the coefficients a i and b i are present. In a NonRecursive Realization digital filter the output depends on present and past values of the input only. In a nonrecursive digital filter, only the coefficients a i are present, that is, bi = 0 . Generally, IIR filters are implemented by recursive realization, whereas FIR filters are imple-
Transformation methods are also available to map an analog prototype to an equivalent digital
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1189
The effect of warping can be eliminated by prewarping the analog filter prior to application of We can use the MATLAB freqz(b,a,N) function to plot the magnitude of G ( z ) An analog filter transfer function can be mapped to a digital filter transfer function directly with the MATLAB bilinear(b,a,Fs) function. The MATLAB filter(b,a,X) function can be used to remove unwanted frequency components
from a function.
We can use the MATLAB find(X) function to restrict the frequency range of the spectrum in order to identify the frequency components of the signal f ( t ) . The Digital Filter Design block is included in the Simulink Signal Processing Blockset and
requires the installation of the Simulink program to create models related to digital filter design applications.
1190 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
and for given values of a , b , and desired cutoff frequency C , we can calculate the values of
C 1, C 2, R 1, R 2, R 3, and R 4 to achieve the desired cutoff frequency C .
R4
R3
vout
R2
vin
C1
C2 R1
Using these relations, compute the appropriate values of the resistors to achieve the cutoff frequency f C = 1 KHz . Choose the capacitors as C 1 = 10 f C F and C 2 = C 1 . Plot G ( s ) versus frequency. Solution using MATLAB is highly recommended.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1191
R4
R5
vout
R1 R3 C2 C1 R2
vin
Let 0 = center frequency , 2 = upper cutoff frequency , 1 = lower cutoff frequency , Bandwidth BW = 2 1 , and Quality Factor Q = 0 BW We can calculate the values of C 1, C 2, R 1, R 2, R 3, and R 4 to achieve the desired centered frequency 0 and bandwidth BW . For this circuit,
2Q R 1 = ---------------C1 0 K 2Q R 2 = ------------------------------------------------------------------------- 2 2 C 1 0 1 + ( K 1 ) + 8Q 1 - 1- 1R 3 = ------------ ----- + ----- 2 2R C1 0 1 R2 R 4 = R 5 = 2R 3
Using these relations, compute the appropriate values of the resistors to achieve center frequency f 0 = 1 KHz , Gain K = 10 , and Q = 10 . Choose the capacitors as C 1 = C 2 = 0.1 F . Plot G ( s ) versus frequency. Solution using MATLAB is highly recommended.
1192 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Exercises
3. The op amp circuit below is a VCVS secondorder bandelimination filter whose transfer function is
2 V out ( s ) K ( s 2 + 0 ) G ( s ) = ----------------- = ---------------------------------------2 2 V in ( s ) s + [ BW ]s + 0
R3 C1 C2 C3 R2
vin
R1
vout
Let 0 = center frequency , 2 = upper cutoff frequency , 1 = lower cutoff frequency , Bandwidth BW = 2 1 , Quality Factor Q = 0 BW , and gain K = 1 We can calculate the values of C 1, C 2, R 1, R 2, R 3, and R 4 to achieve the desired centered frequency 0 and bandwidth BW . For this circuit,
1 R 1 = ------------------2 0 QC 1 2Q R 2 = ----------0 C1 2Q R 3 = -----------------------------------2 C 1 0 ( 4Q + 1 )
The gain K must be unity, but Q can be up to 10. Using these relations, compute the appropriate values of the resistors to achieve center frequency f 0 = 1 KHz , Gain K = 1 and Q = 10 . Choose the capacitors as C 1 = C 2 = 0.1 F and C 3 = 2C 1 . Plot G ( s ) versus frequency. Solution using MATLAB is highly recommended.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1193
where the gain K = cons tan t , ( 0 < K < 1 ) , and the phase is given by
a 0 1 ( ) = 2tan --------------------- 2 2 b 0
C2 R1 C1 R2
vin
R3 R4
vout
1194 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Exercises
4K 1K 2 a = -------------------------------- 1 1 + ------------ tan ( 0 2 ) 1K 2K tan ( 0 2 )
Using these relations, compute the appropriate values of the resistors to achieve a phase shift 0 = 90 at f 0 = 1 KHz with K = 0.75 . Choose the capacitors as C 1 = C 2 = 0.01 F and plot phase versus frequency. Solution using MATLAB is highly recommended. 5. The op amp circuit below is also known as Bessel filter and has the same configuration as the lowpass filter presented in Figure 4.20, Chapter 4, Page 415. This circuit achieves a relatively constant time delay over a range 0 < < 0 . The second-order transfer function of this filter is
2 V out ( s ) 3K 0 G ( s ) = ----------------- = -------------------------------------2 2 V in ( s ) s + 3 0 s + 3 0
R2 R1 R3
C2
vin
C1
vout
We recognize the transfer function G ( s ) above as that of a lowpass filter where a = b = 3 and the substitution of 0 = C . Therefore, we can use a lowpass filter circuit such as that above to achieve a constant delay T 0 by specifying the resistor and capacitor values of the circuit. The resistor values are computed from
2(K + 1) R 2 = ----------------------------------------------------------------------------------2 2 ( aC 1 + a C 1 4 bC 1 C 2 ( K 1 ) ) 0 R2 R 1 = ----K 1 R 3 = ---------------------------2 bC 1 C 2 R 2 0
Using these relations, compute the appropriate values of the resistors to achieve a time delay
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1195
sus frequency. Solution using MATLAB is highly recommended. 6. Derive the transfer function of a fourthorder Butterworth filter with C = 1 rad s . 7. Derive the magnitudesquared function for a thirdorder Chebyshev Type I lowpass filter with 1.5 dB pass band ripple and cutoff frequency C = 1 rad s . 8. In Chapter 4, Exercise 5, Page 430, for the RC lowpass filter we derived the transfer function
1 RC G ( s ) = ----------------------s + 1 RC
Derive the equivalent digital filter transfer function by application of the bilinear transformation. Assume that RC = 1 9. Use MATLAB to derive the transfer function G ( z ) and plot G ( z ) versus for a twopole, Chebyshev Type I highpass digital filter with sampling period T S = 0.25 s . The equivalent analog filter cutoff frequency is C = 4 rad s and has 3 dB pass band ripple. Compute the coefficients of the numerator and denominator and plot G ( z ) with and without prewarping.
1196 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
R1=12582 Ohms
R2=20132 Ohms
R3=40263 Ohms
R4=40263 Ohms
We choose standard resistors as close as possible to those found above. These are shown in the MATLAB script below.
% PART II Plot with standard resistors R1=12.7 K, R2=20.0 K, R3=40.2 K, R4= R3 % f=10:10:20000; w=2*pi*f; R1=12700; R2=20000; R3=40200; R4=R3; K=1+R4/R3;... wc=(4*b)/(C1*sqrt(a^2+8*b*(K1))*R2); s=w*j; Gw=(K.*s.^2)./(s.^2+a.*wc.*s./b+wc.^2./b);... semilogx(f,abs(Gw)); xlabel('Frequency, Hz log scale), ylabel('|Vout/Vin| absolute values');... title('2nd Order Butterworth HighPass Filter Response'); grid
2nd Order Butterworth High-Pass Filter Response 2
1.5
0.5
0 1 10
10
10
10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1197
We choose standard resistors as close as possible to those found above. These are shown in the MATLAB script below.
% % PART II Plot with standard resistors R1=3.16 K, R2=1.1 K, R3=3.09 K, R4= 6.19 K, % R5=R4 % K=10; Q=10; f=10:10:10000; w=2*pi*f; R1=3160; R2=1100; R3=3090; R4=6190; R5=R4;... w0=(2*Q)/(C1*R1*K); B=w0/Q; s=w*j; Gw=(K.*B.*s)./(s.^2+B.*s+w0.^2);... semilogx(f,abs(Gw)); axis([100 10000 0 10]); xlabel('Frequency, Hz log scale'),... ylabel('|Vout/Vin| absolute values');... title('2nd Order Butterworth BandPass Filter Response'); grid
2nd Order Butterworth Band-Pass Filter Response 10
0 2 10
10
1198 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
R1=80 Ohms
R2=31831 Ohms
R3=79 Ohms
We choose standard resistors as close as possible to those found above. These are shown in the MATLAB script below.
% % PART II Plot with standard resistors R1=80.6, R2=3.16 K, R3=78.7 % K=1; Q=10; f=10:10:10000; w=2*pi*f; R1=80.6; R2=31600; R3=78.7;... w0=1/(2*R1*Q*C1); B=w0/Q; s=w*j; Gw=(K.*(s.^2+w0.^2))./(s.^2+B.*s+w0.^2);... semilogx(f,abs(Gw)); axis([100 10000 0 1]); xlabel('Frequency, Hz log scale ');... ylabel('|Vout/Vin| absolute values');... title('2nd Order Butterworth BandElimination Filter Response'); grid
2nd Order Butterworth Band-Elimination Filter Response 1
0.8
0.6
0.4
0.2
0 2 10
10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1199
for b in terms of 0 and a so that we can derive its value from the MATLAB script below. We rewrite the above relation as
0 a 1 tan ----------- = ---b 1 2
then,
0 a tan ---- = ---------- 2 b1 0 0 btan ---- = a + tan ---- 2 2 a + tan ( 0 2 ) b = -----------------------------------tan ( 0 2 ) % MFB 2nd order allpass filter, f0=1 KHz % phase shift phi=pi/2 and gain K=3/4. Gain must be 0<K<1 % % PART I Find Resistor, a and b values % phi0=pi/2; K=0.75; C1=10^(8); C2=C1; f0=1000; w0=2*pi*f0;... a=((1K)/(2*K*tan(phi0/2)))*(1sqrt((1+4*K/(1K))*(tan(phi0/2))^2));... b=(a+tan(phi0/2))/tan(phi0/2); R2=2/(a*w0*C1); R1=(1K)*R2/(4*K);... R3=R2/K; R4=R2/(1K); fprintf(' \n'); fprintf('R1 = %6.0f Ohms \t',R1);... fprintf('R2 = %6.0f Ohms \t',R2); fprintf('R3 = %6.0f Ohms \t',R3);... fprintf('R4 = %6.0f Ohms \t',R4); fprintf(' \n');... fprintf('a = %5.3f \t', a); fprintf('b = %5.3f \t', b)
R3=55292 Ohms
R4=165875 Ohms
We choose standard resistors as close as possible to those found above. These are shown in the MATLAB script below.
% % PART II Plot with standard resistors R1=3.48 K, R2=41.2 K, R3=54.9 K, R4=165 K % K=3/4; a=0.768; b=1.768; C1=10^(8); C2=C1; f=10:10:100000; w=2*pi*f;... R1=3480; R2=41200; R3=54900; R4=165000; w0=2/(a*R2*C1); s=w*j; Gw=(K.*(s.^2a.*w0.*s+b.*w0.^2))./(s.^2+a.*w0.*s+b.*w0.^2);... semilogx(f,angle(Gw).*180./pi); xlabel('Frequency, Hz log scale');... ylabel('Phase Angle in degrees'); title('2nd Order AllPass Filter Phase Response'); grid
11100 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
10
10
10
R1 = 7486 Ohms
R2 = 14971 Ohms
R3 = 13065 Ohms
We choose standard resistors as close as possible to those found above. These are shown in the MATLAB script below. Part II of the script is as follows:
% % PART II Plot with standard resistors R1=7.5 K, R2=15.0 K, R3=13.0 K % K=2; a=3; b=3; C1=10^(8); C2=2*10^(9); f=1:10:100000; w=2*pi*f; R1=7500;... R2=15000; R3=13000; w0=(2*(K+1))/((a*C1+sqrt(a^2*C1^24*b*C1*C2*(K+1)))*R2);... s=w*j; Gw=(3.*K.*w0.^2)./(s.^2+a.*w0.*s+b.*w0.^2);... semilogx(f,angle(Gw).*180./pi); xlabel('Frequency, Hz');... ylabel('Phase Angle in degrees'); title('2nd Order Bessel Filter Response'); grid
The plot shown below is the phase (not magnitude) response. This filter has very good phase response but poor magnitude response. The group delay (the slope at a particular frequency) is practically flat at frequencies near DC.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition 11101 Copyright Orchard Publications
10
10 10 Frequency, Hz
10
10
Then,
1 G ( s ) G ( s ) = ------------8 s +1
We can use DeMoivres theorem to find the roots of s + 1 but we will use MATLAB instead.
8
syms s; y=solve('s^8+1=0'); fprintf(' \n'); disp('s1 = '); disp(simple(y(1)));... disp('s2 = '); disp(simple(y(2))); disp('s3 = '); disp(simple(y(3)));... disp('s4 = '); disp(simple(y(4))); disp('s5 = '); disp(simple(y(5)));... disp('s6 = '); disp(simple(y(6))); disp('s7 = '); disp(simple(y(7)));... disp('s8 = '); disp(simple(y(8)))
s1 = ( 1 2 ) 4 2 1 + j s2 = ( 1 2 ) 4 2 1 + j s 3 = ( 1 2 )j 4 2 1 + j s 4 = ( 1 2 )j 4 2 1 + j s 5 = ( 1 2 )j 4 2 1 + j
3 3 3 3
11102 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Since we are only interested in the poles of the left half of the s plane, we choose the roots s 2 ,
s 4 , s 6 , and s 8 . To express the denominator in polynomial form we use the following MATLAB
script:
denGs=(ss2)*(ss4)*(ss6)*(ss8); r=vpa(denGs,4) r = (s+.9240+.3827*i)*(s+.3827.9240*i)*(s+.9240.3827*i)*(s+.3827+.9240*i) expand(r)
( 1.5 10 )
1 = 0.4125
To express the denominator in polynomial form, we use the following MATLAB script.
syms w; denA=1+0.4125*expand((4*w^33*w)^2);... denA = 1+33/5*w^699/10*w^4+297/80*w^2
and thus Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition 11103 Copyright Orchard Publications
8.
1 RC G ( s ) = ----------------------s + 1 RC
and with RC = 1 ,
1 G ( s ) = ---------s+1 G(z) = G(s)
2 z1 s = ----- ----------TS z + 1
9. The approximation of (11.86), Page 1154, with C = a yields C = a T S = 4 0.25 = 1 . However, using the exact relation of (11.85), Page 1154, and solving for d we find that
d = 2 tan
1
( a T S ) 2 = 0.9273
and this value is not very close to unity. Therefore we will compute G 1 ( z ) with prewarping using the following MATLAB script.
% This script designs a 2pole Chebyshev Type 1 highpass digital filter with % analog cutoff frequency wc=4 rads/sec, sampling period Ts=0.25 sec., with % pass band % ripple of 3 dB. % N=2; % # of poles Rp=3; % Passband ripple in dB Ts=0.25; % Sampling period wc=4; % Analog cutoff frequency % Let wd be the discrete time radian frequency. This frequency is related to % the continuous time radian frequency wc by wd=Ts*wc with no prewarping. % With prewarping it is related to wc by wdp=2*arctan(wc*Ts/2). % We divide by pi to normalize the digital cutoff frequency. wdp=2*atan(wc*Ts/2)/pi; % To obtain the digital cutoff frequency without prewarping we use the relation % wd=(wc*Ts)/pi; [Nz,Dz]=cheby1(N,Rp,wdp,'high'); % fprintf('The numerator N(z) coefficients in descending powers of z are: \n\n'); fprintf('%8.4f \t',[Nz]); fprintf(' \n');
11104 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
The numerator N(z) coefficients in descending powers of z are: 0.3914 -0.7829 0.3914 The denominator D(z) coefficients in descending powers of z are: 1.0000 -0.7153 0.4963 and thus the transfer function and the plot with prewarping are as shown below.
0.3914z 0.7829z + 0.3914 G 1 ( z ) = --------------------------------------------------------------------2 z 0.7153z + 0.4963
High--Pass Digital Filter with prewarping 1
0.8
0.5
2.5
3.5
Next, we will compute G 2 ( z ) without prewarping using the following MATLAB script:
N=2; % # of poles Rp=3; % Pass band ripple in dB Ts=0.25; % Sampling period wc=4; % Analog cutoff frequency wd=(wc*Ts)/pi; [Nz,Dz]=cheby1(N,Rp,wd,'high'); %
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition 11105 Copyright Orchard Publications
The numerator N(z) coefficients in descending powers of z are: 0.3689 -0.7377 0.3689
The denominator D(z) coefficients in descending powers of z are: 1.0000 -0.6028 0.4814 and thus the transfer function and the plot without pre-warping are as shown below.
0.3689z 0.7377z + 0.3689 G 2 ( z ) = --------------------------------------------------------------------2 z 0.6028z + 0.4814
High-Pass Digital Filter without prewarping 1
0.8
0.5
2.5
3.5
11106 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition
Copyright Orchard Publications
Appendix A
Introduction to MATLAB
his appendix serves as an introduction to the basic MATLAB commands and functions, procedures for naming and saving the user generated files, comment lines, access to MATLABs Editor / Debugger, finding the roots of a polynomial, and making plots. Several examples are provided with detailed explanations.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A1
A2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Roots of Polynomials
One of the most powerful features of MATLAB is the ability to do computations involving complex numbers. We can use either i , or j to denote the imaginary part of a complex number, such as 3-4i or 3-4j. For example, the statement z=34j displays z = 3.00004.0000i In the above example, a multiplication (*) sign between 4 and j was not necessary because the complex number consists of numerical constants. However, if the imaginary part is a function, or variable such as cos ( x ) , we must use the multiplication sign, that is, we must type cos(x)*j or j*cos(x) for the imaginary part of the complex number.
Solution: The roots are found with the following two statements where we have denoted the polynomial as p1, and the roots as roots_ p1.
p1=[1 10 35 50 24] % Specify and display the coefficients of p1(x) -50
p1 = 1
-10
35
24
roots_ p1=roots(p1)
roots_p1 = 4.0000 3.0000 2.0000 1.0000 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A3
Solution: There is no cube term; therefore, we must enter zero as its coefficient. The roots are found with the statements below, where we have defined the polynomial as p2, and the roots of this polynomial as roots_ p2. The result indicates that this polynomial has three real roots, and two complex roots. Of course, complex roots always occur in complex conjugate* pairs.
p2=[1 7 0 16 25 52]
p2 = 1 -7 0 16 25 52
roots_ p2=roots(p2)
A4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
r3 = 1 2 3 4
poly_r3=poly(r3) % Find the polynomial coefficients
poly_r3 = 1 -10
35
-50
24
We observe that these are the coefficients of the polynomial p 1 ( x ) of Example A.1. Example A.4 It is known that the roots of a polynomial are 1, 2, 3, 4 + j5, and 4 j5 . Find the coefficients of this polynomial. Solution: We form a row vector, say r4 , with the given roots, and we find the polynomial coefficients with the poly(r) function as shown below.
r4=[ 1 2 3 4+5j 45j ]
-4.0000+ 5.0000i
poly_r4 = 1 14
100
340
499
246
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A5
(A.1)
at x = 3 . Solution:
p5=[1 3 0 5 4 3 2]; % These are the coefficients of the given polynomial % The semicolon (;) after the right bracket suppresses the % display of the row vector that contains the coefficients of p5. % val_minus3=polyval(p5, 3) % Evaluate p5 at x=3; no semicolon is used here % because we want the answer to be displayed
val_minus3 = 1280 Other MATLAB functions used with polynomials are the following:
conv(a,b) multiplies two polynomials a and b [q,r]=deconv(c,d) divides polynomial c by polynomial d and displays the quotient q and remainder r. polyder(p) produces the coefficients of the derivative of a polynomial p.
and
p 2 = 2x 8x + 4x + 10x + 12
6 4 2
A6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
p1p2 = 2 -6 Therefore,
-8
34
18
-24
11
-74
10
-88
9
78
8
166
7
174
6
108
p 1 p 2 = 2x
6x
5
and
p 4 = 2x 8x + 4x + 10x + 12
6 5 2
q = 0.5000 r = 0 Therefore,
q = 0.5 r = 4x 3x + 3x + 2x + 3
5 4 2
-3
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A7
der_p5 = 12 Therefore,
-32
10
(A.2)
where some of the terms in the numerator and/or denominator may be zero. We can find the roots of the numerator and denominator with the roots(p) function as before. As noted in the comment line of Example A.7, we can write MATLAB statements in one line, if we separate them by commas or semicolons. Commas will display the results whereas semicolons will suppress the display. Example A.9 Let
5 4 2 p num x 3x + 5x + 7x + 9 R ( x ) = ----------- = -------------------------------------------------------6 4 2 p den x 4x + 2x + 5x + 6
Express the numerator and denominator in factored form, using the roots(p) function. Solution:
num=[1 3 0 5 7 9]; den=[1 0 4 0 2 5 6]; roots_num=roots(num), roots_den=roots(den) % Do not display num and den coefficients % Display num and den roots
-1.1633
A8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Rational Polynomials
roots_den = 1.6760 + 0.4922i -0.2108 + 0.9870i 1.6760 - 0.4922i -0.2108 - 0.9870i -1.9304 -1.0000
As expected, the complex roots occur in complex conjugate pairs. For the numerator, we have the factored form
p num = ( x 2.4186 j1.0712 ) ( x 2.4186 + j1.0712 ) ( x + 1.1633 ) ( x + 0.3370 j0.9961 ) ( x + 0.3370 + j0.9961 )
We can also express the numerator and denominator of this rational function as a combination of linear and quadratic factors. We recall that, in a quadratic equation of the form x 2 + bx + c = 0 whose roots are x 1 and x 2 , the negative sum of the roots is equal to the coefficient b of the x term, that is, ( x 1 + x 2 ) = b , while the product of the roots is equal to the constant term c , that is, x 1 x 2 = c . Accordingly, we form the coefficient b by addition of the complex conjugate roots and this is done by inspection; then we multiply the complex conjugate roots to obtain the constant term c using MATLAB as follows:
(2.4186 + 1.0712i)*(2.4186 1.0712i)
ans = 6.9971
(0.3370+ 0.9961i)*(0.33700.9961i)
ans = 1.1058
(1.6760+ 0.4922i)*(1.67600.4922i)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A9
ans = x^5-29999/10000*x^4-1323/3125000*x^3+7813277909/ 1562500000*x^2+1750276323053/250000000000*x+4500454743147/ 500000000000 and if we simplify this, we find that is the same as the numerator of the given rational expression in polynomial form. We can use the same procedure to verify the denominator.
R1
R2 C V L
A10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Plot the magnitude of the impedance, that is, |Z| versus radian frequency . Solution: We cannot type (omega) in the MATLAB Command prompt, so we will use the English letter w instead. If a statement, or a row vector is too long to fit in one line, it can be continued to the next line by typing three or more periods, then pressing <enter> to start a new line, and continue to enter data. This is illustrated below for the data of w and z. Also, as mentioned before, we use the semicolon (;) to suppress the display of numbers that we do not care to see on the screen. The data are entered as follows:
w=[300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900.... 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000]; % z=[39.339 52.789 71.104 97.665 140.437 222.182 436.056.... 1014.938 469.830 266.032 187.052 145.751 120.353 103.111.... 90.603 81.088 73.588 67.513 62.481 58.240 54.611 51.468.... 48.717 46.286 44.122 42.182 40.432 38.845];
Of course, if we want to see the values of w or z or both, we simply type w or z, and we press Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A11
800 600
400 200
500
1000
1500
2000
2500
3000
This plot is referred to as the magnitude frequency response of the circuit. To return to the command window, we press any key, or from the Window pulldown menu, we select MATLAB Command Window. To see the graph again, we click on the Window pulldown menu, and we choose Figure 1. We can make the above, or any plot, more presentable with the following commands:
grid on: This command adds grid lines to the plot. The grid off command removes the grid. The
command grid toggles them, that is, changes from off to on or vice versa. The default* is off.
box off: This command removes the box (the solid lines which enclose the plot), and box on restores the box. The command box toggles them. The default is on. title(string): This command adds a line of the text string (label) at the top of the plot. xlabel(string) and ylabel(string) are used to label the x and yaxis respectively.
The magnitude frequency response is usually represented with the xaxis in a logarithmic scale. We can use the semilogx(x,y) command which is similar to the plot(x,y) command, except that the xaxis is represented as a log scale, and the yaxis as a linear scale. Likewise, the semilogy(x,y) command is similar to the plot(x,y) command, except that the yaxis is represented as a
* A default is a particular value for a variable that is assigned automatically by an operating system and remains in effect unless canceled or overridden by the operator.
A12
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
After execution of these commands, the plot is as shown in Figure A.3. If the yaxis represents power, voltage or current, the xaxis of the frequency response is more often shown in a logarithmic scale, and the yaxis in dB (decibels).
Magnitude of Impedance vs. Radian Frequency 1200 1000 800 |Z| in Ohms 600 400 200 0 2 10
10 w in rads/sec
10
To display the voltage v in a dB scale on the yaxis, we add the relation dB=20*log10(v), and we replace the semilogx(w,z) command with semilogx(w,dB). The command gtext(string)* switches to the current Figure Window, and displays a crosshair that can be moved around with the mouse. For instance, we can use the command gtext(Impedance |Z| versus Frequency), and this will place a crosshair in the Figure window. Then, using
* With the latest MATLAB Versions 6 and 7 (Student Editions 13 and 14), we can add text, lines and arrows directly into the graph using the tools provided on the Figure Window. For advanced MATLAB graphics, please refer to The MathWorks Using MATLAB Graphics documentation.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A13
This function specifies the number of data points but not the increments between data points. An alternate function is
x=first: increment: last
and this specifies the increments between points but not the number of data points. The script for the 3phase plot is as follows:
x=linspace(0, 2*pi, 60); % pi is a builtin function in MATLAB; % we could have used x=0:0.02*pi:2*pi or x = (0: 0.02: 2)*pi instead; y=sin(x); u=sin(x+2*pi/3); v=sin(x+4*pi/3); plot(x,y,x,u,x,v); % The xaxis must be specified for each function grid on, box on, % turn grid and axes box on text(0.75, 0.65, 'sin(x)'); text(2.85, 0.65, 'sin(x+2*pi/3)'); text(4.95, 0.65, 'sin(x+4*pi/3)')
These three waveforms are shown on the same plot of Figure A.4.
1
sin(x) 0.5
sin(x+2*pi/3)
sin(x+4*pi/3)
-0.5
-1
A14
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
.
o x + * s d
: .
< >
p h
For example, plot(x,y,'m*:') plots a magenta dotted line with a star at each data point, and plot(x,y,'rs') plots a red square at each data point, but does not draw any line because no line was selected. If we want to connect the data points with a solid line, we must type plot(x,y,'rs'). For additional information we can type help plot in MATLABs command screen. The plots we have discussed thus far are twodimensional, that is, they are drawn on two axes. MATLAB has also a threedimensional (threeaxes) capability and this is discussed next. The plot3(x,y,z) command plots a line in 3space through the points whose coordinates are the elements of x, y and z, where x, y and z are three vectors of the same length. The general format is plot3(x1,y1,z1,s1,x2,y2,z2,s2,x3,y3,z3,s3,...) where xn, yn and zn are vectors or matrices, and sn are strings specifying color, marker symbol, or line style. These strings are the same as those of the twodimensional plots.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A15
(A.3)
In a twodimensional plot, we can set the limits of the x and yaxes with the axis([xmin xmax ymin ymax]) command. Likewise, in a threedimensional plot we can set the limits of all three axes with the axis([xmin xmax ymin ymax zmin zmax]) command. It must be placed after the plot(x,y) or plot3(x,y,z) commands, or on the same line without first executing the plot command. This must be done for each plot. The threedimensional text(x,y,z,string) command will place string beginning at the coordinate (x,y,z) on the plot. For threedimensional plots, grid on and box off are the default states.
* This statement uses the so called dot multiplication, dot division, and dot exponentiation where the multiplication, division,
and exponential operators are preceded by a dot. These important operations will be explained in Section A.9.
A16
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(A.4)
Plot the volume of the cone as r and h vary on the intervals 0 r 4 and 0 h 6 meters. Solution: The volume of the cone is a function of both the radius r and the height h, that is,
V = f ( r, h )
The threedimensional plot is created with the following MATLAB script where, as in the previous example, in the second line we have used the dot multiplication, dot division, and dot exponentiation. This will be explained in Section A.9.
[R,H]=meshgrid(0: 4, 0: 6); % Creates R and H matrices from vectors r and h;... V=(pi .* R .^ 2 .* H) ./ 3; mesh(R, H, V);... xlabel('xaxis, radius r (meters)'); ylabel('yaxis, altitude h (meters)');... zlabel('zaxis, volume (cubic meters)'); title('Volume of Right Circular Cone'); box on
The threedimensional plot of Figure A.6 shows how the volume of the cone increases as the radius and height are increased. The plots of Figure A.5 and A.6 are rudimentary; MATLAB can generate very sophisticated threedimensional plots. The MATLAB Users Manual and the Using MATLAB Graphics Manual contain numerous examples.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A17
150
100
50
A.8 Subplots
MATLAB can display up to four windows of different plots on the Figure window using the command subplot(m,n,p). This command divides the window into an m n matrix of plotting areas and chooses the pth area to be active. No spaces or commas are required between the three integers m, n and p. The possible combinations are shown in Figure A.7. We will illustrate the use of the subplot(m,n,p) command following the discussion on multiplication, division and exponentiation that follows.
111 Full Screen 211 212 221 222 212 221 223 211 223 224 222 224 221 223 122 Default
121
121
A18
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
or as b=[1 3 6 11]' As shown below, MATLAB produces the same display with either format.
b=[1; 3; 6; 11]
b = -1 3 6 11 b=[1 3 6 11]' b = -1 3 6 11 We will now define Matrix Multiplication and ElementbyElement multiplication. 1. Matrix Multiplication (multiplication of row by column vectors) Let
A = [ a1 a2 a3 an ] % Observe the single quotation character ()
and
B = [ b 1 b 2 b 3 b n ]'
be two vectors. We observe that A is defined as a row vector whereas B is defined as a column vector, as indicated by the transpose operator (). Here, multiplication of the row vector A by the column vector B , is performed with the matrix multiplication operator (*). Then,
A*B = [ a 1 b 1 + a 2 b 2 + a 3 b 3 + + a n b n ] = sin gle value
(A.5)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A19
and
B = [ 2 6 3 8 7 ]'
the matrix multiplication A*B produces the single value 68, that is,
A B = 1 ( 2 ) + 2 6 + 3 ( 3 ) + 4 8 + 5 7 = 68
ans = 68 Now, let us suppose that both A and B are row vectors, and we attempt to perform a rowby row multiplication with the following MATLAB statements.
A=[1 2 3 4 5]; B=[2 6 3 8 7]; A*B % No transpose operator () here
When these statements are executed, MATLAB displays the following message: ??? Error using ==> * Inner matrix dimensions must agree. Here, because we have used the matrix multiplication operator (*) in A*B, MATLAB expects vector B to be a column vector, not a row vector. It recognizes that B is a row vector, and warns us that we cannot perform this multiplication using the matrix multiplication operator (*). Accordingly, we must perform this type of multiplication with a different operator. This operator is defined below. 2. ElementbyElement Multiplication (multiplication of a row vector by another row vector) Let
C = [ c1 c2 c3 cn ]
and
D = [ d1 d2 d3 dn ]
be two row vectors. Here, multiplication of the row vector C by the row vector D is performed with the dot multiplication operator (.*). There is no space between the dot and the multiplication symbol. Thus,
C. D = [ c 1 d 1 c2 d2 c3 d3 cn dn ]
(A.6)
A20
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and
D = [ 2 6 3 8 7 ]
Dot multiplication of these two row vectors produce the following result.
C. D = 1 ( 2 ) 2 6 3 ( 3 ) 4 8 5 7 = 2 12 9 32 35
ans = -2
12
-9
32
35
Similarly, the division (/) and exponentiation (^) operators, are used for matrix division and exponentiation, whereas dot division (./) and dot exponentiation (.^) are used for element byelement division and exponentiation, as illustrated in Examples A.11 and A.12 above. We must remember that no space is allowed between the dot (.) and the multiplication, division, and exponentiation operators. Note: A dot (.) is never required with the plus (+) and minus () operators. Example A.13 Write the MATLAB script that produces a simple plot for the waveform defined as
y = f ( t ) = 3e
4 t
cos 5t 2e
3 t
t sin 2t + ---------t+1
(A.7)
in the 0 t 5 seconds interval. Solution: The MATLAB script for this example is as follows:
t=0: 0.01: 5; % Define taxis in 0.01 increments y=3 .* exp(4 .* t) .* cos(5 .* t)2 .* exp(3 .* t) .* sin(2 .* t) + t .^2 ./ (t+1); plot(t,y); grid; xlabel('t'); ylabel('y=f(t)'); title('Plot for Example A.13')
The plot for this example is shown in Figure A.8. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A21
2 1 0
-1
0.5
1.5
2.5 t
3.5
4.5
Had we, in this example, defined the time interval starting with a negative value equal to or less than 1 , say as 3 t 3 , MATLAB would have displayed the following message: Warning: Divide by zero. This is because the last term (the rational fraction) of the given expression, is divided by zero when t = 1 . To avoid division by zero, we use the special MATLAB function eps, which is a number approximately equal to 2.2 10
16
The command axis([xmin xmax ymin ymax]) scales the current plot to the values specified by the arguments xmin, xmax, ymin and ymax. There are no commas between these four arguments. This command must be placed after the plot command and must be repeated for each plot. The following example illustrates the use of the dot multiplication, division, and exponentiation, the eps number, the axis([xmin xmax ymin ymax]) command, and also MATLABs capability of displaying up to four windows of different plots. Example A.14 Plot the functions
y = sin 2x, z = cos 2x, w = sin 2x cos 2x, v = sin 2x cos 2x
in the interval 0 x 2 using 100 data points. Use the subplot command to display these functions on four windows on the same graph.
A22
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
w=y.* z; v=y./ (z+eps);% add eps to avoid division by zero subplot(221);% upper left of four subplots
plot(x,y); axis([0 2*pi 0 1]);
title('y=(sinx)^2');
title('z=(cosx)^2');
title('w=(sinx)^2*(cosx)^2');
subplot(224); plot(x,v); axis([0 2*pi 0 400]); % lower right of four subplots
0.5
0.5
2
2
4
2
2
2
4
2
w=(sinx) *(cosx)
The next example illustrates MATLABs capabilities with imaginary numbers. We will introduce the real(z) and imag(z) functions that display the real and imaginary parts of the complex quantity z = x + iy, the abs(z), and the angle(z) functions that compute the absolute value (magnitude) and phase angle of the complex quantity z = x + iy = r . We will also use the polar(theta,r) function that produces a plot in polar coordinates, where r is the magnitude, theta Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A23
With the given values of resistance, inductance, and capacitance, the impedance Z ab as a function of the radian frequency can be computed from the following expression:
10 j ( 10 ) Z ab = Z = 10 + ------------------------------------------------------5 10 + j ( 0.1 10 )
4 6
(A.8)
a. Plot Re { Z } (the real part of the impedance Z) versus frequency . b. Plot Im { Z } (the imaginary part of the impedance Z) versus frequency . c. Plot the impedance Z versus frequency in polar coordinates. Solution: The MATLAB script below computes the real and imaginary parts of Z ab which, for simplicity, are denoted as z , and plots these as two separate graphs (parts a & b). It also produces a polar plot (part c).
w=0: 1: 2000; % Define interval with one radian interval;... z=(10+(10 .^ 4 j .* 10 .^ 6 ./ (w+eps)) ./ (10 + j .* (0.1 .* w 10.^5./ (w+eps))));... % % The first five statements (next two lines) compute and plot Re{z} real_part=real(z); plot(w,real_part);... xlabel('radian frequency w'); ylabel('Real part of Z'); grid
A24
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
200
400
600
1400
1600
1800
2000
Figure A.11. Plot for the real part of the impedance in Example A.15 % The next five statements (next two lines) compute and plot Im{z} imag_part=imag(z); plot(w,imag_part);... xlabel('radian frequency w'); ylabel('Imaginary part of Z'); grid
600 400 Imaginary part of Z 200
0 -200 -400
-600
200
400
600
1400
1600
1800
2000
Figure A.12. Plot for the imaginary part of the impedance in Example A.15 % The last six statements (next five lines) below produce the polar plot of z mag=abs(z); % Computes |Z|;... rndz=round(abs(z)); % Rounds |Z| to read polar plot easier;... theta=angle(z); % Computes the phase angle of impedance Z;... polar(theta,rndz); % Angle is the first argument ylabel('Polar Plot of Z'); grid
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A25
90 120
1500 60 1000
30
180
210
330
240 270
300
Example A.15 clearly illustrates how powerful, fast, accurate, and flexible MATLAB is.
is a function file and must be saved as myfunction.m For the next example, we will use the following MATLAB functions:
fzero(f,x) attempts to find a zero of a function of one variable, where f is a string containing the name of a realvalued function of a single real variable. MATLAB searches for a value near a point where the function f changes sign, and returns that value, or returns NaN if the search fails.
A26
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Example A.16 Find the zeros, the minimum, and the maximum values of the function
1 1 f ( x ) = --------------------------------------- --------------------------------------- 10 2 2 ( x 0.1 ) + 0.01 ( x 1.2 ) + 0.04
(A.9)
in the interval 1.5 x 1.5 Solution: We first plot this function to observe the approximate zeros, maxima, and minima using the following script.
x=1.5: 0.01: 1.5; y=1./ ((x0.1).^ 2 + 0.01) 1./ ((x1.2).^ 2 + 0.04) 10; plot(x,y); grid
-1
-0.5
0.5
1.5
Figure A.14. Plot for Example A.16 using the plot command
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A27
To save this file, from the File drop menu on the Command Window, we choose New, and when the Editor Window appears, we type the script above and we save it as funczero01. MATLAB appends the extension .m to it. Now, we can use the fplot(fcn,lims) command to plot f ( x ) as follows:
fplot('funczero01', [1.5 1.5]); grid
This plot is shown in Figure A.15. As expected, this plot is identical to the plot of Figure A.14 which was obtained with the plot(x,y) command as shown in Figure A.14.
100 80 60 40 20 0 -20 -40 -1.5
-1
-0.5
0.5
1.5
Figure A.15. Plot for Example A.16 using the fplot command
We will use the fzero(f,x) function to compute the roots of f ( x ) in Equation (A.9) more precisely. The MATLAB script below will accomplish this.
x1= fzero('funczero01', 0.2); x2= fzero('funczero01', 0.3); fprintf('The roots (zeros) of this function are r1= %3.4f', x1); fprintf(' and r2= %3.4f \n', x2)
A28
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
is executed, MATLAB displays a very long expression which when copied at the command prompt and executed, produces the following: ans = 0.6585 + 0.3437i ans = 0.6585 - 0.3437i ans = 1.2012 The real value 1.2012 above is the value of x at which the function y has its minimum value as we observe also in the plot of Figure A.15. To find the value of y corresponding to this value of x, we substitute it into f ( x ) , that is,
x=1.2012; ymin=1 / ((x0.1) ^ 2 + 0.01) 1 / ((x1.2) ^ 2 + 0.04) 10
ymin = -34.1812 We can find the maximum value from f ( x ) whose plot is produced with the script x=1.5:0.01:1.5; ymax=1./((x0.1).^2+0.01)+1./((x1.2).^2+0.04)+10; plot(x,ymax); grid and the plot is shown in Figure A.16. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A29
-1
-0.5
0.5
1.5
Next we compute the first derivative of f ( x ) and we solve for x to find the value where the maximum of ymax occurs. This is accomplished with the MATLAB script below.
syms x ymax zmax; ymax=(1/((x0.1)^2+0.01)1/((x1.2)^2+0.04)10); zmax=diff(ymax)
zmax = 1/((x-1/10)^2+1/100)^2*(2*x-1/5)-1/((x-6/5)^2+1/25)^2*(2*x-12/5)
solve(zmax)
is executed, MATLAB displays a very long expression which when copied at the command prompt and executed, produces the following: ans = 0.6585 + 0.3437i ans = 0.6585 - 0.3437i ans = 1.2012 ans = 0.0999 From the values above we choose x = 0.0999 which is consistent with the plots of Figures A.15 and A.16. Accordingly, we execute the following script to obtain the value of ymin .
A30
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Display Formats
x=0.0999; % Using this value find the corresponding value of ymax ymax=1 / ((x0.1) ^ 2 + 0.01) 1 / ((x1.2) ^ 2 + 0.04) 10
ymax = 89.2000
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A31
The disp(X) command displays the array X without printing the array name. If X is a string, the text is displayed. The fprintf(format,array) command displays and prints both text and arrays. It uses specifiers to indicate where and in which format the values would be displayed and printed. Thus, if %f is used, the values will be displayed and printed in fixed decimal format, and if %e is used, the values will be displayed and printed in scientific notation format. With this command only the real part of each parameter is processed. This appendix is just an introduction to MATLAB.* This outstanding software package consists of many applications known as Toolboxes. The MATLAB Student Version contains just a few of these Toolboxes. Others can be bought directly from The MathWorks, Inc., as addons.
* For more MATLAB applications, please refer to Numerical Analysis Using MATLAB and Spreadsheets, ISBN 0970951116.
A32
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Appendix B
Introduction to Simulink
his appendix is a brief introduction to Simulink. This author feels that we can best introduce Simulink with a few examples. Some familiarity with MATLAB is essential in understanding Simulink, and for this purpose, Appendix A is included as an introduction to MATLAB.
+
vC ( t )
+
i(t) vs ( t ) = u0 ( t )
43 F
(B.1)
(B.2)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B1
Introduction to Simulink
d vC dv C RC -------- + LC ---------- + v C = u 0 ( t ) 2 dt dt
2
(B.3)
(B.4)
t>0
(B.5)
To appreciate Simulinks capabilities, for comparison, three different methods of obtaining the solution are presented, and the solution using Simulink follows. First Method Assumed Solution Equation (B.5) is a secondorder, nonhomogeneous differential equation with constant coefficients, and thus the complete solution will consist of the sum of the forced response and the natural response. It is obvious that the solution of this equation cannot be a constant since the derivatives of a constant are zero and thus the equation is not satisfied. Also, the solution cannot contain sinusoidal functions (sine and cosine) since the derivatives of these are also sinusoids. However, decaying exponentials of the form ke where k and a are constants, are possible candidates since their derivatives have the same form but alternate in sign.
at
It can be shown* that if k 1 e 1 and k 2 e 2 where k 1 and k 2 are constants and s 1 and s 2 are the roots of the characteristic equation of the homogeneous part of the given differential equation,
s t s t
s1 t
and k 2 e
s2 t
+ k2 e
+ v cf ( t )
(B.6)
* Please refer to Circuit Analysis II with MATLAB Applications, ISBN 0970951159, Appendix B for a thorough discussion.
B2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(B.7)
Solution of (B.7) yields of s 1 = 1 and s 2 = 3 and with these values (B.6) is written as
vc ( t ) = k1 e + k2 e
t 3 t
+ v cf ( t )
(B.8)
t>0
(B.9)
Since the right side of (B.9) is a constant, the forced response will also be a constant and we denote it as v Cf = k 3 . By substitution into (B.9) we obtain
0 + 0 + 3k 3 = 3
or
v Cf = k 3 = 1
(B.10)
+1
(B.11)
The constants k 1 and k 2 will be evaluated from the initial conditions. First, using v C ( 0 ) = 0.5 V and evaluating (B.11) at t = 0 , we obtain
v C ( 0 ) = k 1 e + k 2 e + 1 = 0.5 k 1 + k 2 = 0.5
0 0
(B.12)
Also, and
(B.13)
t=0
(B.14)
By equating the right sides of (B.13) and (B.14) we obtain Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B3
Introduction to Simulink
k 1 3k 2 = 0
(B.15)
Simultaneous solution of (B.12) and (B.15), gives k 1 = 0.75 and k 2 = 0.25 . By substitution into (B.8), we obtain the total solution as
v C ( t ) = ( 0.75 e + 0.25e
t 3 t
+ 1 )u 0 ( t )
(B.16)
y1 = 3/4*exp(-t)-3/4*exp(-3*t)
y2=diff(y0,2) % The second derivative of y(t)
y2 = -3/4*exp(-t)+9/4*exp(-3*t)
y=y2+4*y1+3*y0 % Summation of y and its derivatives
y = 3 Thus, the solution has been verified by MATLAB. Using the expression for v C ( t ) in (B.16), we find the expression for the current as
dv C 4 3 t 3t t 3t - - i = i L = i C = C --------- = -- -- e 3 e = e e A - dt 3 4 4
(B.17)
Second Method Using the Laplace Transformation The transformed circuit is shown in Figure B.2.
R 1 L
0.25s C 3 4s
Vs ( s ) = 1 s
VC ( s )
I(s) 0.5 s
+ V (0) C
B4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(B.18)
= 1
s=0
= 0.75
s = 1
= 0.25
s = 3
* For derivation of the voltage division and current division expressions, please refer to Circuit Analysis I with MATLAB Applications, ISBN 0970951124. Partial fraction expansion is discussed in Chapter 3, this text. For an introduction to Laplace Transform and Inverse Laplace Transform, please refer Chapters 2 and 3, this text. ** Usually, in StateSpace and State Variables Analysis, u ( t ) denotes any input. For distinction, we will denote the Unit Step Function as u0 ( t ) . For a detailed discussion on StateSpace and State Variables Analysis, please refer to Chapter 5, this text.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B5
Introduction to Simulink
By substitution of given values and rearranging, we obtain
1 di L -- ------ = ( 1 )i L v C + 1 - 4 dt
or
di L ------ = 4i L 4v C + 4 dt
(B.19)
(B.20)
and
dv C x 2 = -------dt
(B.21)
dv C i L = C -------dt dv C 4 x 1 = i L = C -------- = Cx 2 = -- x 2 3 dt 3 x 2 = -- x 1 4
(B.22)
Therefore, from (B.19), (B.20), and (B.22), we obtain the state equations
x 1 = 4x 1 4x 2 + 4 3 x 2 = -- x 1 4
(B.23)
* The notation x (x dot) is often used to denote the first derivative of the function x , that is, x = dx dt .
The detailed solution of (B.23) is given in Chapter 5, Example 5.10, Page 523, this text.
B6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1 0.75 e + 0.25e
t 3t
Then,
x1 = iL = e e
(B.24)
3t
and
x 2 = v C = 1 0.75e + 0.25e
t
(B.25)
Modeling the Differential Equation of Example B.1 with Simulink To run Simulink, we must first invoke MATLAB. Make sure that Simulink is installed in your system. In the MATLAB Command prompt, we type:
simulink
Alternately, we can click on the Simulink icon shown in Figure B.3. It appears on the top bar on MATLABs Command prompt.
Upon execution of the Simulink command, the Commonly Used Blocks appear as shown in Figure B.4. In Figure B.4, the left side is referred to as the Tree Pane and displays all Simulink libraries installed. The right side is referred to as the Contents Pane and displays the blocks that reside in the library currently selected in the Tree Pane. Let us express the differential equation of Example B.1 as
2 dv C d vC ---------- = 4 -------- 3v C + 3u 0 ( t ) 2 dt dt
(B.26)
A block diagram representing relation (B.26) above is shown in Figure B.5. We will use Simulink to draw a similar block diagram.*
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B7
Introduction to Simulink
u0 ( t )
dt
4
dv C -------dt
dt
vC
To model the differential equation (B.26) using Simulink, we perform the following steps: 1. On the Simulink Library Browser, we click on the leftmost icon shown as a blank page on the top title bar. A new model window named untitled will appear as shown in Figure B.6.
B8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
The window of Figure B.6 is the model window where we enter our blocks to form a block diagram. We save this as model file name Equation_1_26. This is done from the File drop menu of Figure B.6 where we choose Save as and name the file as Equation_1_26. Simulink will add the extension .mdl. The new model window will now be shown as Equation_1_26, and all saved files will have this appearance. See Figure B.7.
2. With the Equation_1_26 model window and the Simulink Library Browser both visible, we click on the Sources appearing on the left side list, and on the right side we scroll down until we see the unit step function shown as Step. See Figure B.8. We select it, and we drag it into the Equation_1_26 model window which now appears as shown in Figure B.8. We save file Equation_1_26 using the File drop menu on the Equation_1_26 model window (right side of Figure B.8). 3. With reference to block diagram of Figure B.5, we observe that we need to connect an amplifier with Gain 3 to the unit step function block. The gain block in Simulink is under Commonly Used Blocks (first item under Simulink on the Simulink Library Browser). See Figure B.8. If the Equation_1_26 model window is no longer visible, it can be recalled by clicking on the white page icon on the top bar of the Simulink Library Browser. 4. We choose the gain block and we drag it to the right of the unit step function. The triangle on the right side of the unit step function block and the > symbols on the left and right sides of the gain block are connection points. We point the mouse close to the connection point of the unit step function until is shows as a cross hair, and draw a straight line to connect the two Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B9
Introduction to Simulink
blocks.* We doubleclick on the gain block and on the Function Block Parameters, we change the gain from 1 to 3. See Figure B.9.
Figure B.8. Dragging the unit step function into File Equation_1_26
Figure B.9. File Equation_1_26 with added Step and Gain blocks * An easy method to interconnect two Simulink blocks by clicking on the source block to select it, then hold down the Ctrl key and leftclick on the destination block.
B10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
6. From the Commonly Used Blocks of the Simulink Library Browser, we choose the Integrator block, we drag it into the Equation_1_26 model window, and we connect it to the output of the Add block. We repeat this step and to add a second Integrator block. We click on the text Integrator under the first integrator block, and we change it to Integrator 1. Then, we change the text Integrator 1 under the second Integrator to Integrator 2 as shown in Figure B.11.
7. To complete the block diagram, we add the Scope block which is found in the Commonly Used Blocks on the Simulink Library Browser, we click on the Gain block, and we copy and paste it twice. We flip the pasted Gain blocks by using the Flip Block command from the Format drop menu, and we label these as Gain 2 and Gain 3. Finally, we doubleclick on these gain blocks and on the Function Block Parameters window, we change the gains from to 4 and 3 as shown in Figure B.12.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B11
Introduction to Simulink
8. The initial conditions i L ( 0 ) = C ( dv C dt )
t=0
ble clicking the Integrator blocks and entering the values 0 for the first integrator, and 0.5 for the second integrator. We also need to specify the simulation time. This is done by specifying the simulation time to be 10 seconds on the Configuration Parameters from the Simulation drop menu. We can start the simulation on Start from the Simulation drop menu or by clicking on the icon.
9. To see the output waveform, we double click on the Scope block, and then clicking on the Autoscale icon, we obtain the waveform shown in Figure B.13.
Figure B.13. The waveform for the function v C ( t ) for Example B.1
Another easier method to obtain and display the output v C ( t ) for Example B.1, is to use State Space block from Continuous in the Simulink Library Browser, as shown in Figure B.14.
Figure B.14. Obtaining the function v C ( t ) for Example B.1 with the StateSpace block.
B12
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
y = Cx + du y = [0 1] x1 x2 + [ 0 ]u
We doubleclick on the StateSpace block, and in the Functions Block Parameters window we enter the constants shown in Figure B.15.
Figure B.15. The Function block parameters for the StateSpace block.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B13
Introduction to Simulink
The initials conditions [ x1 x2 ]' are specified in MATLABs Command prompt as
x1=0; x2=0.5;
form, we double click on the Scope block, and then clicking on the Autoscale obtain the waveform shown in Figure B.16.
Figure B.16. The waveform for the function v C ( t ) for Example B.1 with the StateSpace block.
The statespace block is the best choice when we need to display the output waveform of three or more variables as illustrated by the following example. Example B.2 A fourthorder network is described by the differential equation
4 d y + a d y + a d y + a dy + a y ( t ) = u ( t ) --------3 -------2 ------1 ----0 3 2 4 dt dt dt dt 3 2
(B.27)
where y ( t ) is the output representing the voltage or current of the network, and u ( t ) is any input, and the initial conditions are y ( 0 ) = y' ( 0 ) = y'' ( 0 ) = y''' ( 0 ) = 0 . a. We will express (B.27) as a set of state equations
B14
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(B.28)
subject to the initial conditions y ( 0 ) = y' ( 0 ) = y'' ( 0 ) = y''' ( 0 ) = 0 , has the solution
y ( t ) = 0.125 [ ( 3 t ) 3t cos t ]
2
(B.29)
In our set of state equations, we will select appropriate values for the coefficients a 3, a 2, a 1, and a 0 so that the new set of the state equations will represent the differential equation of (B.28), and using Simulink, we will display the waveform of the output y ( t ) . 1. The differential equation of (B.28) is of fourthorder; therefore, we must define four state variables that will be used with the four firstorder state equations. We denote the state variables as x 1, x 2, x 3 , and x 4 , and we relate them to the terms of the given differential equation as
x1 = y ( t ) dy x 2 = ----dt d y x 3 = -------2 dt
2
d y x 4 = -------3 dt
(B.30)
We observe that
x1 = x2 x2 = x3 x3 = x4 d y --------- = x 4 = a 0 x 1 a 1 x 2 a 2 x 3 a 3 x 4 + u ( t ) 4 dt
4
(B.31)
(B.32)
(B.33) (B.34)
y = Cx + du
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B15
Introduction to Simulink
x1 x2 x3 x4 0 0 A= 0 a0 1 0 0 a1 0 1 0 a2 0 0 , 1 a3 x1 x= x2 x3 x4 y ( t ) = x1 , 0 b= 0, 0 1
x=
and u = u ( t )
(B.35)
(B.36)
2. By inspection, the differential equation of (B.27) will be reduced to the differential equation of (B.28) if we let
a3 = 0 a2 = 2 a1 = 0 a0 = 1 u ( t ) = sin t
and thus the differential equation of (B.28) can be expressed in statespace form as
x1 x2 x3 x4 0 0 = 0 a0 1 0 0 0 0 1 0 2 0 0 1 0 0 + 0 sin t 0 x3 1 x4 x2 x1
(B.37)
where
x1 x2 x3 x4 0 0 A= 0 a0 1 0 0 0 0 1 0 2 0 0 , 1 0 x1 x= x2 x3 x4 y ( t ) = x1 , 0 b= 0, 0 1
x=
and u = sin t
(B.38)
B16
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(B.39)
We invoke MATLAB, we start Simulink by clicking on the Simulink icon, on the Simulink Library Browser we click on the Create a new model (blank page icon on the left of the top bar), and we save this model as Example_1_2. On the Simulink Library Browser we select Sources, we drag the Signal Generator block on the Example_1_2 model window, we click and drag the StateSpace block from the Continuous on Simulink Library Browser, and we click and drag the Scope block from the Commonly Used Blocks on the Simulink Library Browser. We also add the Display block found under Sinks on the Simulink Library Browser. We connect these four blocks and the complete block diagram is as shown in Figure B.17.
We now doubleclick on the Signal Generator block and we enter the following in the Function Block Parameters: Wave form: sine Time (t): Use simulation time Amplitude: 1 Frequency: 2 Units: Hertz Next, we doubleclick on the statespace block and we enter the following parameter values in the Function Block Parameters:
A: [0 1 0 0; 0 0 1 0; 0 0 0 1; a0 a1 a2 a3] B: [0 0 0 1] C: [1 0 0 0] D: [0]
Initial conditions: x0 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B17
Introduction to Simulink
Absolute tolerance: auto Now, we switch to the MATLAB Command prompt and we type the following: >> a0=1; a1=0; a2=2; a3=0; x0=[0 0 0 0]; We change the Simulation Stop time to 25 , and we start the simulation by clicking on the icon. To see the output waveform, we double click on the Scope block, then clicking on the Autoscale icon, we obtain the waveform shown in Figure B.18.
The Display block in Figure B.17 shows the value at the end of the simulation stop time. Examples B.1 and B.2 have clearly illustrated that the StateSpace is indeed a powerful block. We could have obtained the solution of Example B.2 using four Integrator blocks by this approach would have been more time consuming. Example B.3 Using Algebraic Constraint blocks found in the Math Operations library, Display blocks found in the Sinks library, and Gain blocks found in the Commonly Used Blocks library, we will create a model that will produce the simultaneous solution of three equations with three unknowns. The model will display the values for the unknowns z 1 , z 2 , and z 3 in the system of the equations
a1 z1 + a2 z2 + a3 z3 + k1 = 0 a4 z1 + a5 z2 + a6 z3 + k2 = 0 a7 z1 + a8 z2 + a9 z3 + k3 = 0
(B.40)
B18
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
After clicking on the simulation icon, we observe the values of the unknowns as z 1 = 2 ,
z 2 = 3 , and z 3 = 5 .These values are shown in the Display blocks of Figure B.19.
The Algebraic Constraint block constrains the input signal f ( z ) to zero and outputs an algebraic state z . The block outputs the value necessary to produce a zero at the input. The output must affect the input through some feedback path. This enables us to specify algebraic equations for index 1 differential/algebraic systems (DAEs). By default, the Initial guess parameter is zero. We can improve the efficiency of the algebraic loop solver by providing an Initial guess for the algebraic state z that is close to the solution value.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
B19
Introduction to Simulink
An outstanding feature in Simulink is the representation of a large model consisting of many blocks and lines, to be shown as a single Subsystem block.* For instance, we can group all blocks and lines in the model of Figure B.19 except the display blocks, we choose Create Subsystem from the Edit menu, and this model will be shown as in Figure B.20 where in MATLABs Command prompt we have entered:
a1=5; a2=1; a3=4; a4=11; a5=6; a6=9; a7=8; a8=4; a9=15;... k1=14; k2=6; k3=9;
The Display blocks in Figure B.20 show the values of z 1 , z 2 , and z 3 for the values specified in MATLABs Command prompt.
* The Subsystem block is described in detail in Chapter 2, Section 2.1, Page 22, Introduction to Simulink with Engineering Applications, ISBN 0974423971. The contents of the Subsystem block are not lost. We can doubleclick on the Subsystem block to see its contents. The Subsystem block replaces the inputs and outputs of the model with Inport and Outport blocks. These blocks are described in Section 2.1, Chapter 2, Page 22, Introduction to Simulink with Engineering Applications, ISBN 0974423971.
B20
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Appendix C
A Review of Complex Numbers
his appendix is a review of the algebra of complex numbers. The basic operations are defined and illustrated with several examples. Applications using Eulers identities are presented, and the exponential and polar forms are discussed and illustrated with examples.
x j ( j A ) = j A = A
2
j ( A ) = j 3 A = j A
Figure C.1. The j operator
Note: In our subsequent discussion, we will designate the xaxis (abscissa) as the real axis, and the yaxis (ordinate) as the imaginary axis with the understanding that the imaginary axis is
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
C 1
then
A + B = (a + c) + j(b + d )
and
A B = (a c) + j(b d)
and
A B = (3 + j4) (4 j2) = (3 4) + j(4 + 2 ) = 1 + j6
We may think the real axis as the cosine axis and the imaginary axis as the sine axis.
C2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
then
A B = ( a + jb ) ( c + jd ) = ac + jad + jbc + j 2 bd
(C.1)
The conjugate of a complex number, denoted as A , is another complex number with the same real component, and with an imaginary component of opposite sign. Thus, if A = a + jb , then A = a j b . Example C.3 It is given that A = 3 + j 5 . Find A Solution: The conjugate of the complex number A has the same real component, but the imaginary component has opposite sign. Then, A = 3 j 5
If a complex number A is multiplied by its conjugate, the result is a real number. Thus, if
A = a + jb , then A A = ( a + jb ) ( a jb ) = a 2 jab + jab j 2 b 2 = a + b
2 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
C 3
( ac + bd ) ( bc ad ) = ---------------------- + j ---------------------2 2 2 2 c +d c +d
(C.2)
In (C.2), we multiplied both the numerator and denominator by the conjugate of the denominator to eliminate the j operator from the denominator of the quotient. Using this procedure, we see that the quotient is easily separated into a real and an imaginary part. Example C.5 It is given that A = 3 + j 4 , and B = 4 + j 3 . Find A B Solution: Using the procedure of (C.2), we obtain
73 + j 4 ( 3 + j 4 ) ( 4 j 3 ) 12 j 9 + j 16 + 12 24 + j 7 24 A --- = ------------- = -------------------------------------- = ------------------------------------------- = ---------------- = ----- + j ----- = 0.96 + j 0.28 2 2 25 25 25 B 4 + j3 (4 + j3)(4 j3) 4 +3
= cos + j sin
(C.3)
C4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
= cos j sin
(C.4)
= C cos + j C sin
(C.5)
= a + jb
(C.6)
where the left side of (C.6) is the exponential form, and the right side is the rectangular form. Equating real and imaginary parts in (C.5) and (C.6), we obtain a = C cos and b = C sin Squaring and adding the expressions in (C.7), we obtain a + b = ( C cos ) + ( C sin ) = C ( cos + sin ) = C
2 2 2 2 2 2 2 2
(C.7)
Then,
C
2
= a +b
2 2
or
C =
a +b
(C.8)
(C.9)
To convert a complex number from rectangular to exponential form, we use the expression
j tan
1
a + jb =
a +b e
b -a
(C.10)
To convert a complex number from exponential to rectangular form, we use the expressions
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
C 5
The polar form is essentially the same as the exponential form but the notation is different, that is,
Ce
j
= C
(C.12)
where the left side of (C.12) is the exponential form, and the right side is the polar form. We must remember that the phase angle is always measured with respect to the positive real
Example C.6 Convert the following complex numbers to exponential and polar forms: a. 3 + j 4 b. 1 + j 2 c. 2 j d. 4 j 3 Solution: a. The real and imaginary components of this complex number are shown in Figure C.2.
4 Im 5 53.1 3
Re
Then,
3 + j4 = j tan 3 +4 e
2 2 1
4 -3 = 5e j53.1 = 5 53.1
C6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
5 53.1301 Check with the Simulink Complex to MagnitudeAngle block* shown in the Simulink model of Figure C.3.
b. The real and imaginary components of this complex number are shown in Figure C.4.
Im 5 63.4 1 116.6 Re 2
Then,
1 + j2 =
1 2 j tan ----- 2 2 1 = 1 +2 e
5e
j116.6
5 116.6
2.2361 116.5651 c. The real and imaginary components of this complex number are shown in Figure C.5.
* For a detailed description and examples with this and other related transformation blocks, please refer to Introduction to Simulink with Engineering Applications, ISBN 0974423971, Section 8.3, Chapter 8, Page 8 24, and Section 19.8, Chapter 19, Page 1927.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
C 7
Then,
j tan 2 2 2 +1 e
1
2 j 1 =
1 ----2
5e
j206.6
5 206.6 =
5e
j ( 153.4 )
5 153.4
2.2361 -153.4349 d. The real and imaginary components of this complex number are shown in Figure C.5.
Im 323.1 4 Re
36.9 3
5
Then,
4 j 3 = j tan 4 +3 e
2 2 1
5 -36.8699
C8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
1.73 30 2
Re 150(Measured Clockwise) 1
Then,
2 150 = 2e
j 150
Note: The rectangular form is most useful when we add or subtract complex numbers; however, the exponential and polar forms are most convenient when we multiply or divide complex numbers. To multiply two complex numbers in exponential (or polar) form, we multiply the magnitudes and we add the phase angles, that is, if
A = M and B = N
then,
AB = MN ( + ) = M e
j
Ne
= MN e
j( + )
(C.13)
Example C.8 Multiply A = 10 53.1 by B = 5 36.9 Solution: Multiplication in polar form yields Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
C 9
) ( 5e
j 36.9
) = 50 e
j ( 53.1 36.9 )
= 50 e
j16.2
To divide one complex number by another when both are expressed in exponential or polar form, we divide the magnitude of the dividend by the magnitude of the divisor, and we subtract the phase angle of the divisor from the phase angle of the dividend, that is, if
A = M and B = N
then,
M j( ) M Me A --- = ---- ( ) = ------------ = ---- e N N j B Ne
j
(C.14)
Example C.9 Divide A = 10 53.1 by B = 5 36.9 Solution: Division in polar form yields
10 53.1 A --- = ----------------------- = 2 [ 53.1 ( 36.9 ) ] = 2 90 5 36.9 B
C10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Appendix D
Matrices and Determinants
his appendix is an introduction to matrices and matrix operations. Determinants, Cramers rule, and Gausss elimination method are reviewed. Some definitions and examples are not applicable to the material presented in this text, but are included for subject continuity, and academic interest. They are discussed in detail in matrix theory textbooks. These are denoted with a dagger () and may be skipped.
2 3 7 1 1 5
or
(D.1)
The numbers a ij are the elements of the matrix where the index i indicates the row, and j indicates the column in which each element is positioned. For instance, a 43 indicates the element positioned in the fourth row and third column. A matrix of m rows and n columns is said to be of m n order matrix. If m = n , the matrix is said to be a square matrix of order m (or n ). Thus, if a matrix has five rows and five columns, it is said to be a square matrix of order 5.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D1
diagonal.
The sum of the diagonal elements of a square matrix A is called the trace* of A . A matrix in which every element is zero, is called a zero matrix.
(D.2)
Two matrices are said to be conformable for addition (subtraction), if they are of the same order m n. If A = a ij and B = b ij are conformable for addition (subtraction), their sum (difference) will be another matrix C with the same order as A and B , where each element of C is the sum (difference) of the corresponding elements of A and B , that is,
C = A B = [ a ij b ij ]
(D.3)
Solution:
A+B = 1+2 01 2+3 1+2 3+0 = 3 5 4+5 1 3 3 9
and
* Henceforth, all paragraphs and topics preceded by a dagger ( ) may be skipped. These are discussed in matrix theory textbooks.
D2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Matrix Operations
AB = 12 0+1 2 3 3 0 = 1 1 3 12 45 1 1 1
ans = 3 -1 ans = -1 1
5 3 -1 -1
3 9 3 -1
A Constant 1 B Constant 2 -1 1 Sum 2 -1 -1 Display 2 (A-B) 3 -1 3 -1 Sum 1 5 3 Display 1 (A+B) 3 9 Note: The elements of matrices A and B are specified in MATLAB's Command prompt
If k is any scalar (a positive or negative number), and not [ k ] which is a 1 1 matrix, then multiplication of a matrix A by the scalar k is the multiplication of every element of A by k . Example D.2 Multiply the matrix
A = 1 2 2 3
by a. k 1 = 5 b. k 2 = 3 + j2 Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D3
b.
k 2 A = ( 3 + j2 ) 1 2 = ( 3 + j2 ) 1 ( 3 + j2 ) ( 2 ) = 3 + j2 2 3 ( 3 + j2 ) 2 ( 3 + j2 ) 3 6 + j4 6 j4 9 + j6
ans = 5 10
-10
Two matrices A and B are said to be conformable for multiplication A B in that order, only when the number of columns of matrix A is equal to the number of rows of matrix B . That is, the product A B (but not B A ) is conformable for multiplication only if A is an m p matrix and matrix B is an p n matrix. The product A B will then be an m n matrix. A convenient way to determine if two matrices are conformable for multiplication is to write the dimensions of the two matrices sidebyside as shown below.
Shows that A and B are conformable for multiplication A mp B pn
D4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Matrix Operations
Here, B and A are not conformable for multiplication B pn A mp
For matrix multiplication, the operation is row by column. Thus, to obtain the product A B , we multiply each element of a row of A by the corresponding element of a column of B ; then, we add these products. Example D.3 Matrices C and D are defined as
1 C = 2 3 4 and D = 1 2 Compute the products C D and D C
Solution: The dimensions of matrices C and D are respectively 1 3 3 1 ; therefore the product C D is feasible, and will result in a 1 1 , that is,
1 C D = 2 3 4 1 = ( 2 ) ( 1 ) + ( 3 ) ( 1 ) + ( 4 ) ( 2 ) = 7 2
The dimensions for D and C are respectively 3 1 1 3 and therefore, the product D C is also feasible. Multiplication of these will produce a 3 3 matrix as follows:
1 (1) (2) (1) (3) (1) (4) 2 3 4 D C = 1 2 3 4 = ( 1 ) ( 2 ) ( 1 ) ( 3 ) ( 1 ) ( 4 ) = 2 3 4 2 (2) (2) (2) (3) (2) (4) 4 6 8
ans = 7
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D5
Division of one matrix by another, is not defined. However, an analogous operation exists, and it will become apparent later in this chapter when we discuss the inverse of a matrix.
(D.4)
A square matrix is said to be lower triangular, when all the elements above the diagonal are zero. The matrix B of (D.5) is a lower triangular matrix. In a lower triangular matrix, not all elements below the diagonal need to be nonzero.
a 11 B = am 1 0 am2 0 0 0 0 0 0 0 a m 3 a mn
a 21 a 22
(D.5)
A square matrix is said to be diagonal, if all elements are zero, except those in the diagonal. The matrix C of (D.6) is a diagonal matrix.
D6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0 a 22 0 0 0 0 0 0 0 0 0 0 a mn
(D.6)
A diagonal matrix is called a scalar matrix, if a 11 = a 22 = a 33 = = a nn = k where k is a scalar. The matrix D of (D.7) is a scalar matrix with k = 4 .
4 D = 0 0 0 0 4 0 0 0 0 4 0 0 0 0 4
(D.7)
A scalar matrix with k = 1 , is called an identity matrix I . Shown below are 2 2 , 3 3 , and 4 4 identity matrices.
1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
(D.8)
ans = 1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Likewise, the eye(size(A)) function, produces an identity matrix whose size is the same as matrix A . For example, let matrix A be defined as
A=[1 3 1; 2 1 5; 4 7 6] % Define matrix A
A = 1 -2 4 Then, Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications 3 1 -7 1 -5 6
D7
displays ans = 1 0 0 0 1 0 0 0 1
The transpose of a matrix A , denoted as A T , is the matrix that is obtained when the rows and columns of matrix A are interchanged. For example, if 1 1 2 3 then A T = 2 4 5 6 3 4 5 6
A=
(D.9)
In MATLAB, we use the apostrophe () symbol to denote and obtain the transpose of a matrix. Thus, for the above example,
A=[1 2 3; 4 5 6] % Define matrix A
A = 1 4
A'
2 5
3 6
% Display the transpose of A
ans = 1 2 3
4 5 6
A symmetric matrix A is a matrix such that A T = A , that is, the transpose of a matrix A is the same as A . An example of a symmetric matrix is shown below. 1 2 3 2 4 5 3 5 6
T
A =
A =
1 2 3 2 4 5 = A 3 5 6
(D.10)
If a matrix A has complex numbers as elements, the matrix obtained from A by replacing each element by its conjugate, is called the conjugate of A , and it is denoted as A , for example,
A = 1 + j2 3
j
2 j3
A = 1 j 2 3
j
2 + j3
D8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
A =
0 2 2 0 3 4
3 4 = A 0
Therefore, matrix A above is skew symmetric. A square matrix A such that A T = A is called Hermitian. For example,
1 A = 1+j 2 1j 3 j 1 2 T j A = 1j 2 0 1+j 3 j 2 1 T* j A = 1 j 0 2 1+j 3 j 2 j = A 0
Therefore, matrix A above is Hermitian. A square matrix A such that A T = A is called skewHermitian. For example,
j A = 1j 2 1j 3j j j 2 T A = 1j j 2 0 1j 3j j 2 j T* A = 1+j j 0 2 1+j 3j j 2 j = A 0
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D9
(D.11)
then, the determinant of A , denoted as detA , is defined as detA = a 11 a 22 a 33 a nn + a 12 a 23 a 34 a n 1 + a 13 a 24 a 35 a n 2 + a n 1 a 22 a 13 a n 2 a 23 a 14 a n 3 a 24 a 15 The determinant of a square matrix of order n is referred to as determinant of order n. Let A be a determinant of order 2 , that is,
A = a 11 a 12 a 21 a 22
(D.12)
(D.13)
Then,
detA = a 11 a 22 a 21 a 12
(D.14)
D10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Determinants
ans = -2 ans = 2 Let A be a matrix of order 3 , that is,
a 11 a 12 a 13 A = a 21 a 22 a 23 a 31 a 32 a 33
(D.15)
(D.16)
A convenient method to evaluate the determinant of order 3 , is to write the first two columns to the right of the 3 3 matrix, and add the products formed by the diagonals from upper left to lower right; then subtract the products formed by the diagonals from lower left to upper right as shown on the diagram of the next page. When this is done properly, we obtain (D.16) above.
a 11 a 12 a 13 a 11 a 12 a 21 a 22 a 23 a 21 a 22 a 31 a 32 a 33 a 31 a 32
This method works only with second and third order determinants. To evaluate higher order determinants, we must first compute the cofactors; these will be defined shortly. Example D.5 Compute detA and detB if matrices A and B are defined as
2 A = 1 2 3 5 0 1 1 0 2 3 4 and B = 1 0 2 0 5 6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D11
or
detA = ( 2 0 0 ) + ( 3 1 1 ) + ( 5 1 1 ) ( 2 0 5 ) ( 1 1 2 ) ( 0 1 3 ) = 11 2 = 9
Likewise,
2 3 4 2 3 detB = 1 0 2 1 2 0 5 6 2 6
or
detB = [ 2 0 ( 6 ) ] + [ ( 3 ) ( 2 ) 0 ] + [ ( 4 ) 1 ( 5 ) ] [ 0 0 ( 4 ) ] [ ( 5 ) ( 2 ) 2 ] [ ( 6 ) 1 ( 3 ) ] = 20 38 = 18
ans = 9
B=[2 3 4; 1 0 2; 0 5 6];det(B) % Define matrix B and compute detB
ans = -18
(D.17)
D12
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(D.18)
M 12 ,
M 12 =
a 21 a 23 a 31 a 33
M 11 =
a 21 a 22 a 31 a 32
and
11 = ( 1 )
1+1
M 11 = M 11
12 = ( 1 )
1+2
M 12 = M 12
13 = M 13 = ( 1 )
1+3
M 13
and cofactors
21, 22, 23, 31, 32, and 33
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D13
(D.19)
Solution:
11 = ( 1 )
1+1
4 2 = 20 2 6
1+3
12 = ( 1 )
1+2
2 2 = 10 1 6
2+1
(D.20)
13 = ( 1 )
2 4 = 0 1 2 1 3 = 9 1 6
21 = ( 1 )
2 3 = 6 2 6 1 2 = 4 1 2
(D.21)
22 = ( 1 )
2+2
23 = ( 1 )
2+3
(D.22)
31 = ( 1 )
3+1
2 3 = 8, 4 2
32 = ( 1 )
3+2
1 3 = 8 2 2
(D.23)
33 = ( 1 )
3+3
1 2 = 8 2 4
(D.24)
It is useful to remember that the signs of the cofactors follow the pattern below + + + + + + + + + + +
that is, the cofactors on the diagonals have the same sign as their minors. Let A be a square matrix of any size; the value of the determinant of A is the sum of the products obtained by multiplying each element of any row or any column by its cofactor.
D14
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(D.25)
Compute the determinant of A using the elements of the first row. Solution:
detA = 1 4 2 2 2 2 3 2 4 = 1 20 2 ( 10 ) 3 0 = 40 2 6 1 6 1 2
ans = 40 We must use the above procedure to find the determinant of a matrix A of order 4 or higher. Thus, a fourth-order determinant can first be expressed as the sum of the products of the elements of its first row by its cofactor as shown below.
a 11 a 12 a 13 a 14 A = a 21 a 22 a 23 a 24 a 31 a 32 a 33 a 34 a 41 a 42 a 43 a 44 a 22 a 23 a 24 a 42 a 43 a 44 a 12 a 13 a 14 a 42 a 43 a 44
= a 11 a 32 a 33 a 34 a 21 a 32 a 33 a 34
(D.26)
a 12 a 13 a 14 a 42 a 43 a 44
a 12 a 13 a 14 a 32 a 33 a 34
+a 31 a 22 a 23 a 24 a 41 a 22 a 23 a 24
Determinants of order five or higher can be evaluated similarly. Example D.9 Compute the value of the determinant of the matrix A defined as
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D15
(D.27)
Solution: Using the above procedure, we will multiply each element of the first column by its cofactor. Then,
1 0 1 A=2 0 3 2 0 0 1 [a] 1 0 3 ( 1 ) 0 3 2 0 0 1 [b] 1 0 3 +4 1 0 1 0 0 1 [c] 1 0 3 ( 3 ) 1 0 1 0 3 2 [d]
and thus
detA = [ a ] + [ b ] + [ c ] + [ d ] = 6 3 + 0 36 = 33
delta = -33 Some useful properties of determinants are given below. Property 1: If all elements of one row or one column are zero, the determinant is zero. An example of this is the determinant of the cofactor [ c ] above. Property 2: If all the elements of one row or column are m times the corresponding elements of another row or column, the determinant is zero. For example, if
2 A = 3 1 4 6 2 1 1 1
(D.28)
then,
D16
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Cramers Rule
2 3 1 4 6 2 1 1 1 2 3 1 4 6 = 12 + 4 + 6 6 4 12 = 0 2
detA =
(D.29)
Here, detA is zero because the second column in A is 2 times the first column. Check with MATLAB:
A=[2 4 1; 3 6 1; 1 2 1]; det(A)
ans = 0 Property 3: If two rows or two columns of a matrix are identical, the determinant is zero. This follows from Property 2 with m = 1 .
(D.30)
and let
a 11 a 12 a 13 = a 21 a 22 a 23 a 31 a 32 a 33 D1 =
A a 11 a 13 B a 21 a 23 C a 31 a 33 D2 =
a 11 A a 13 a 21 B a 23 a 31 C a 33 D3 =
a 11 a 12 A a 21 a 22 B a 31 a 32 C
Cramers rule states that the unknowns x, y, and z can be found from the relations
D1 x = -----
D2 y = -----
D3 z = -----
(D.31)
provided that the determinant (delta) is not zero. We observe that the numerators of (D.31) are determinants that are formed from by the substitution of the known values A , B , and C , for the coefficients of the desired unknown. Cramers rule applies to systems of two or more equations. If (D.30) is a homogeneous set of equations, that is, if A = B = C = 0 , then, D 1, D 2, and D 3 are all zero as we found in Property 1 above. Then, x = y = z = 0 also.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D17
(D.32)
and verify your answers with MATLAB. Solution: Rearranging the unknowns v , and transferring known values to the right side, we obtain
2v 1 v 2 + 3v 3 = 5 4v 1 3v 2 2v 3 = 8 3v 1 + v 2 v 3 = 4
(D.33)
By Cramers rule,
2 1 3 4 3 2 3 1 1
2 1 4 3 = 6 + 6 12 + 27 + 4 + 4 = 35 3 1
D1 =
5 1 3 8 3 2 4 1 1
5 1 8 3 = 15 + 8 + 24 + 36 + 10 8 = 85 4 1
D2 =
2 4 3
5 3 8 2 4 1
2 4 3
5 8 = 16 30 48 72 + 16 20 = 170 4
D3 =
2 1 4 3 3 1
5 8 4
2 1 4 3 = 24 24 20 + 45 16 16 = 55 3 1
(D.34)
D18
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
v1= 17/7 v2= -34/7 v3= -11/7 These are the same values as in (D.34)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D19
(D.35)
Solution: As a first step, we add the first equation of (D.35) with the third to eliminate the unknown v2 and we obtain the equation 5v 1 + 2v 3 = 9 (D.36) Next, we multiply the third equation of (D.35) by 3, and we add it with the second to eliminate v 2 , and we obtain the equation
5v 1 5v 3 = 20
(D.37)
(D.38)
Now, we can find the unknown v 1 from either (D.36) or (D.37). By substitution of (D.38) into (D.36) we obtain
11 17 5v 1 + 2 ----- = 9 or v 1 = ---- 7 7
(D.39)
Finally, we can find the last unknown v 2 from any of the three equations of (D.35). By substitution into the first equation we obtain
34 34 33 35 v 2 = 2v 1 + 3v 3 5 = ----- ----- ----- = ----7 7 7 7
(D.40)
These are the same values as those we found in Example D.10. The Gaussian elimination method works well if the coefficients of the unknowns are small integers, as in Example D.11. However, it becomes impractical if the coefficients are large or fractional numbers.
D20
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(D.41)
We observe that the cofactors of the elements of the ith row (column) of A are the elements of the ith column (row) of adjA . Example D.12 Compute adjA if Matrix A is defined as
1 2 3 A = 1 3 4 1 4 3
(D.42)
Solution:
3 4 adjA = 1 1 1 1 4 3 4 3 3 4 2 4 1 1 3 3 3 3 2 3 3 4 2 3 3 4 = 7 6 1 1 0 1 1 2 1
1 2 1 4
1 2 1 3
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D21
(D.43)
detA =
(D.44)
(D.45)
D22
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Then,
1
7 6 1 3.5 3 0.5 1 1 = ----------- adjA = ----- 1 0 1 = 0.5 0 0.5 2 detA 1 2 1 0.5 1 0.5
(D.46)
0 1.0000
Multiplication of a matrix A by its inverse A 1 produces the identity matrix I , that is,
AA
1
= I or A A = I
(D.47)
Example D.15 Prove the validity of (D.47) for the Matrix A defined as
A = 4 2 3 2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D23
Then,
A
1
and
AA
1
= 4 2
6+6 = 1 3+4 0
0 = I 1
(D.48)
where A and B are matrices whose elements are known, and X is a matrix (a column vector) whose elements are the unknowns. We assume that A and X are conformable for multiplication. Multiplication of both sides of (D.48) by A 1 yields:
A AX = A B = IX = A B
1 1 1
(D.49) (D.50)
or
X=A B
1
Therefore, we can use (D.50) to solve any set of simultaneous equations that have solutions. We will refer to this method as the inverse matrix method of solution of simultaneous equations. Example D.16 For the system of the equations
2x 1 + 3x 2 + x 3 = 9 x 1 + 2x 2 + 3x 3 = 6 3x 1 + x 2 + 2x 3 = 8
(D.51)
D24
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(D.52)
Then, (D.53)
1
or
x1 x2 x3 2 = 1 3 3 1 2 3 1 2 9 6 8
(D.54)
Therefore,
A
1
(D.55)
To verify our results, we could use the MATLABs inv(A) function, and then multiply A 1 by B . However, it is easier to use the matrix left division operation X = A \ B ; this is MATLABs solution of A 1 B for the matrix equation A X = B , where matrix X is the same size as matrix B . For this example,
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D25
X = 1.9444 1.6111 0.2778 Example D.17 For the electric circuit of Figure D.1,
1 2 9 2 9 4
V = 100 v
I1
I2
I3
(D.56)
Use the inverse matrix method to compute the values of the currents I 1 , I 2 , and I 3 Solution: For this example, the matrix equation is RI = V or I = R 1 V , where
100 10 9 0 R = 9 20 9 , V = 0 0 0 9 15 I1 and I = I 2 I3
(D.57)
Therefore, we must find the determinant and the adjoint of R . For this example, we find that
D26
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(D.58)
Then,
R
1
219 135 81 1 1 ----------- adjR = -------- 135 150 90 = detR 975 81 90 119
and
22.46 219 219 135 81 100 100 1 = -------- 135 = 13.85 I = I 2 = -------- 135 150 90 0 975 975 8.31 81 0 81 90 119 I3 I1
I1 = 22.46
I2 = 13.85
I3 = 8.31
We can also use subscripts to address the individual elements of the matrix. Accordingly, the MATLAB script above could also have been written as:
R(1,1)=10; R(1,2)=9; % No need to make entry for A(1,3) since it is zero. R(2,1)=9; R(2,2)=20; R(2,3)=9; R(3,2)=9; R(3,3)=15; V=[100 0 0]'; I=R\V; fprintf(' \n');... fprintf('I1 = %4.2f \t', I(1)); fprintf('I2 = %4.2f \t', I(2)); fprintf('I3 = %4.2f \t', I(3)); fprintf(' \n')
I1 = 22.46
I2 = 13.85
I3 = 8.31
Spreadsheets also have the capability of solving simultaneous equations with real coefficients using the inverse matrix method. For instance, we can use Microsoft Excels MINVERSE (Matrix Inversion) and MMULT (Matrix Multiplication) functions, to obtain the values of the three currents in Example D.17. The procedure is as follows: 1. We begin with a blank spreadsheet and in a block of cells, say B3:D5, we enter the elements of matrix R as shown in Figure D.2. Then, we enter the elements of matrix V in G3:G5. 2. Next, we compute and display the inverse of R , that is, R 1 . We choose B7:D9 for the elements of this inverted matrix. We format this block for number display with three decimal
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D27
and we press the Crtl-Shift-Enter keys simultaneously. We observe that R 1 appears in these cells. 3. Now, we choose the block of cells G7:G9 for the values of the current I . As before, we highlight them, and with the cell marker positioned in G7, we type the formula
=MMULT(B7:D9,G3:G5)
and we press the Crtl-Shift-Enter keys simultaneously. The values of I then appear in G7:G9.
A B C D E F G H 1 Spreadsheet for Matrix Inversion and Matrix Multiplication 2 10 -9 0 100 3 R= -9 20 -9 V= 0 4 0 -9 15 0 5 6 0.225 0.138 0.083 22.462 7 -1 R = 0.138 0.154 0.092 8 I= 13.846 9 0.083 0.092 0.122 8.3077 10
1700
85 V1
R1
C IX
j100 V2 50
VS
R3 = 100 L R2
j200
D28
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(D.59)
and the voltages V 1 and V 2 can be computed from the nodal equations
V 1 170 0 V 1 V 2 V 1 0 ------------------------------- + ------------------ + -------------- = 0 85 100 j200
(D.60)
and
V 2 170 0 V 2 V 1 V 2 0 ------------------------------- + ------------------ + -------------- = 0 j100 100 50
(D.61)
Compute, and express the current I x in both rectangular and polar forms by first simplifying like terms, collecting, and then writing the above relations in matrix form as YV = I , where Y = Admit tan ce , V = Voltage , and I = Current Solution: The Y matrix elements are the coefficients of V 1 and V 2 . Simplifying and rearranging the nodal equations of (D.60) and (D.61), we obtain
( 0.0218 j0.005 )V 1 0.01V 2 = 2 0.01 V 1 + ( 0.03 + j0.01 )V 2 = j1.7
(D.62)
(D.63)
where the matrices Y , V , and I are as indicated. We will use MATLAB to compute the voltages V 1 and V 2 , and to do all other computations. The script is shown below.
Y=[0.02180.005j 0.01; 0.01 0.03+0.01j]; I=[2; 1.7j]; V=Y\I; % Define Y, I, and find V fprintf('\n'); % Insert a line disp('V1 = '); disp(V(1)); disp('V2 = '); disp(V(2)); % Display values of V1 and V2
V1 = 1.0490e+002 + 4.9448e+001i
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
D29
IX = 0.5149 - 0.0590i This is the rectangular form of I X . For the polar form we use the MATLAB script
magIX=abs(IX), thetaIX=angle(IX)*180/pi % Compute the magnitude and the angle in degrees
Spreadsheets have limited capabilities with complex numbers, and thus we cannot use them to compute matrices that include complex numbers in their elements as in Example D.18.
D30
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Appendix E
Window Functions
his appendix is an introduction to window functions. We discuss the rectangular, triangular, Hanning, Hamming, Blackman, and Kaiser windows. An example using each is provided for illustration of their uses.
(a)
(b)
Next, let us assume that the impulse response h [ n ] is terminated abruptly without changing any of its coefficients, as shown in Figure E.2(a). In this case, the resulting amplitude response A' ( f ) will be subject to undesired oscillations and poor convergence as shown in Figure E.2(b). Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E1
(a)
(b)
Figure E.2. Resultant amplitude response when the impulse response is abruptly truncated
Therefore, we are seeking a suitable window function that will result in an amplitude response with a lower ripple in the stop band such as the one shown in Figure E.3.
A(f)
Although an impulse response may converge uniformly, when it is multiplied* by a rectangular window function it results in an undesirable amplitude response. However, the rectangular window function is the basis in studying window functions, so we begin with the description of the rectangular window function.
(E.1)
Figure E.4. Rectangular window function in timedomain * We recall that multiplication in the time domain corresponds to convolution in the frequency domain.
E2
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(E.2)
(E.3)
and relation (F.3) is normalized with respect to the DC value F ( 0 ) . A typical amplitude response of the rectangular window function is shown in Figure E.5, and it was created with the MATLAB script below. fplot('20.*log10(abs(sin(pi.*x)./(pi.*x)))',[0 5 5 50])
Main lobe Side lobes
Figure E.5. Typical amplitude response for the rectangular window function
The amplitude response in Figure E.5 consists of a main lobe at the middle* of the spectrum and side lobes located on either side (positive and negative) of the main lobe. It is desired that a window function should have a narrow main lobe and the maximum side lobe level should be very small in relation to the main lobe. Unfortunately, both of these requirements cannot be optimized simultaneously, and thus we must decide on a suitable compromise between these two requirements. Figure E.6 shows the normalized frequency domain plot for the rectangular window function created with the rectwin MATLAB function, and the script below.
n=50; w=rectwin(n); [W,f]=freqz(w/sum(w),1,512,2); plot(f,20*log10(abs(W)));grid
* Generally, only the positive half of the response is shown in all window functions.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E3
Figure E.6. Normalized frequency domain plot for the rectangular window function created with MATLAB
We can also use the MATLAB Window Visualization Tool. The script below generates the plot shown in Figure E.7.
L=50; wvtool(rectwin(L))
Time domain 40 1 0.8 Magnitude (dB) Amplitude 0.6 0.4 0.2 0 30 20 10 0 -10 -20 -30 -40 10 20 30 Samples 40 50 -50 0
Frequency domain
Figure E.7. Rectangular window function generated with the MATLAB Window Visualization Tool
E4
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(E.4)
= 0 otherwise
(E.5)
A typical amplitude response of the triangular window function is shown in Figure E.9 and it was created with the MATLAB script below. fplot('20.*log10(abs(sin(0.5.*pi.*x)./(0.5.*pi.*x)).^2)',[0 5 5 50])
Figure E.9. Typical amplitude response for the triangular window function
We observe that the width of the main lobe of the triangular window function is about twice as wide as that of the rectangular window function, but the first side lobe is much lower. Figure E.10 shows the normalized frequency domain plot for the triangular window function created with the triang MATLAB function, and the script below. Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E5
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Figure E.10. Normalized frequency domain plot for the triangular window function created with MATLAB
We can also use the MATLAB Window Visualization Tool. The script below generates the plot shown in Figure E.11.
L=50; wvtool(triang(L))
Time domain 40 1 20 0 Magnitude (dB) -20 -40 -60 -80 0.2 -100 0 -120 Frequency domain
0.8 Amplitude
0.6
0.4
10
20 30 Samples
40
50
Figure E.11. Triangular window function generated with the MATLAB Window Visualization Tool
E6
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(E.6)
0.8
0.6
0.4
0.2
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
(E.7)
A typical amplitude response of the Hanning window function is shown in Figure E.13 and it was created with the MATLAB script below. fplot('20.*log10(abs(sin(pi.*x)./(pi.*x)).*(1./(1(x+eps).^2)))',[0 5 50 0])
* This window function is also known as Hann window function or cosinesquared window function.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E7
-10
-20
-30
-40
-50 0
Figure E.13. Typical amplitude response for the Hanning window function
Figure E.14 shows the normalized frequency domain plot for the Hanning window function created with the hann MATLAB function, and the script below.
n=50; w=hann(n); [W,f]=freqz(w/sum(w),1,512,2); plot(f,20*log10(abs(W)));grid
0 -20 -40 -60 -80 -100 -120 -140
0.2
0.4
0.6
0.8
Figure E.14. Normalized frequency domain plot for the Hanning window function created with MATLAB
We can also use the MATLAB Window Visualization Tool. The script below generates the plot shown in Figure E.15.
L=50; wvtool(hann(L))
E8
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0.8 Amplitude
0.6
0.4
10
20 30 Samples
40
50
Figure E.15. Hanning window function generated with the MATLAB Window Visualization Tool
(E.8)
0.8
0.6
0.4
0.2
0.1
0.2
0.3
0.4
0.5
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E9
(E.9)
A typical amplitude response of the Hamming window function is shown in Figure E.17 and it was created with the MATLAB script below.
fplot('20.*log10(abs(sin(pi.*x)./(pi.*x+eps)).*((0.540.08.*x.^2)./(1x.^2)))',[0 5 60 0])
0 -10 -20 -30 -40 -50 -60
Figure E.17. Typical amplitude response for the Hamming window function
Figure E.18 shows the normalized frequency domain plot for the Hamming window function created with the hamming MATLAB function, and the script below.
n=50; w=hamming(n); [W,f]=freqz(w/sum(w),1,512,2); plot(f,20*log10(abs(W)));grid
E10
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0.2
0.4
0.6
0.8
Figure E.18. Normalized frequency domain plot for the Hamming window function created with MATLAB
We can also use the MATLAB Window Visualization Tool. The script below generates the plot shown in Figure E.19.
L=50; wvtool(hamming(L))
Time domain 40 1 20 0.8 Magnitude (dB) 0 Amplitude Frequency domain
0.6
-20
0.4
-40
0.2
-60
10
20 30 Samples
40
50
-80
Figure E.19. Hamming window function generated with the MATLAB Window Visualization Tool
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E11
(E.10)
0.8
0.6
0.4
0.2
0.1
0.2
0.3
0.4
0.5
(E.11)
A typical amplitude response of the Blackman window function is shown in Figure E.21 and it was created with the MATLAB script below.
fplot('20.*log10(abs(sin(pi.*x)./(pi.*x)).*((0.54+0.5.*x.^2)./(1x.^2)0.08.*x.^2./(4x.^2)))',[0 5 50 0])
E12
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
-10
-20
-30
-40
-50
Figure E.21. Typical amplitude response for the Blackman window function
Figure E.22 shows the normalized frequency domain plot for the Blackman window function created with the blackman MATLAB function, and the script below.
n=50; w=blackman(n); [W,f]=freqz(w/sum(w),1,512,2); plot(f,20*log10(abs(W)));grid
0 -20 -40 -60 -80 -100 -120 -140 -160 0 0.2 0.4 0.6 0.8 1
Figure E.22. Normalized frequency domain plot for the Hamming window function created with MATLAB
We can also use the MATLAB Window Visualization Tool. The script below generates the plot shown in Figure E.23.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E13
Figure E.23. Blackman window function generated with the MATLAB Window Visualization Tool
for n=0,1,...,L-1
(E.12)
where I 0 is the modified Bessel function* of the first kind and order zero, and it is given as
I0 ( ) =
k=0
0.5 ------------ k!
k 2
(E.13)
The series in (E.13) converges after about 20 terms in the summation, and since I 0 ( 0 ) = 1 , the Kaiser window has the value 1 I 0 ( ) at the end points n = 0 and n = L 1 , and it is symmetric about its middle point n = L . In (E. 12), the variable is a parameter that can be varied to provide a trade-off between the main lobe width and the side lobe level. Large values of result in wider main lobe widths and
* Certain differential equations with variable coefficients resemble the Bessel equation and thus their solutions are referred to as modified Bessel functions. For a discussion on the Bessel equation and Bessel functions, please refer to Numerical Analysis Using MATLAB and Excel, ISBN 9781934404034.
E14
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
and this returns an Lpoint Kaiser window* in the column vector w. Figure E. 24 shows the Kaiser functions for L = 50 with = 1 , = 4 , and = 9 . These functions were plotted with the MATLAB script below.
plot([kaiser(50, 1), kaiser(50,4), kaiser(50,9)]);
1
0.8
=1 =4
0.6
0.4
0.2
=9
10
20
30
40
50
Figure E.25 shows the corresponding frequency domain plots for the Kaiser window functions in Figure E.24. These plots were created with the MATLAB script below.
n=50; w1 =kaiser(n, 1); w2=kaiser(n,4); w3=kaiser(n,9); [W1,f]=freqz(w1/sum(w1),1,512,2); [W2,f]=freqz(w2/sum(w2),1,512,2); [W3,f]=freqz(w3/sum(w3),1,512,2); plot(f,20*log10(abs([W1 W2 W3])));grid;
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E15
=1
=4
-100 -120 -140 -160 -180 0 0.2 0.4 0.6 0.8
=9
Figure E.25. Frequency domain plots for the Kaiser functions with L=50 and = 1 , = 4 , and = 9 TABLE E.1 MATLAB Window Functions Window Function MATLAB Function Bartlett bartlett BartlettHann (modified) barthannwin Blackman blackman BlackmanHarris blackmanharris Bohman bohmanwin Chebyshev chebwin Flat Top flattopwin Gaussian gausswin Hamming hamming Hann or Hanning hann Kaiser kaiser Nuttalls BlackmanHarris nuttallwin Parzen (de la VallePoussin) parzenwin Rectangular rectwin Tukey tukeywin Triangular triang
E16
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Fourier Series Method for Approximating an FIR Amplitude Response E.4 Fourier Series Method for Approximating an FIR Amplitude Response
The Fourier series method for approximating an FIR amplitude response is relatively straightforward, and is best used in conjunction with window functions. This is because the amplitude response A ( ) corresponding to a Discrete Time Linear Time Invariant (DTLTI) impulse response h ( n ) is a periodic function of frequency and thus it can be expanded in a Fourier series in the frequency dornain.* The coefficients obtained from the Fourier series can then be related to the impulse response, and the desired coefficients of the FIR transfer function can then be obtained. An advantage of FIR filter functions is the capability of obtaining linear phase (or constant time delay). To obtain time constant delay easily, it is necessary that the Fourier series in the frequency domain have either cosine terms only or sine terms only, but not both. Let us consider the case of a cosine series representation and let the coefficients be expressed in normalized frequency = f f 0 where f 0 = f S 2 is the folding frequency, and f S is the sampling frequency, i.e., f S = 1 T . Also, let A d ( ) be the desired amplitude response, and let A ( ) represent the approximation. Then, with this arrangement the period must always be selected as 2 units on the scale. For the cosine series, the expression for A ( ) in exponential form is
A() =
cm e
jm
(E.14)
= M
where M is a finite positive integer representing the terms after which the series is terminated, and c m is the coefficient in exponential form that is computed from the integral
cm =
1 0
A d ( ) cos ( m ) d
(E.15)
with c m = c m Relation (E.14) can be considered as the evaluation of some unknown discrete transfer function on the unit circle in the zplane. We can perform this evaluation by letting z = e jT = e Thus, if we denote this discrete transfer function as H 1 ( z ) and e obtain
jm jm
is substituted for z , we
* In Chapter 7 we studied the application of Fourier series by expanding a periodic time function in the time domain. The folding frequency, also known as Nyquist frequency, is the highest frequency that can be represented in a digital signal of a specified sampling frequency. It is equal to onehalf of the sampling frequency.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E17
cm z
(E.16)
= M
Relation (E.16) represents an FIR transfer function but it is noncausal because it includes positive powers of z, and this implies that the filter would produce an output advanced in time with respect to the input, and this is, of course, impossible. We can be overcome this problem by introducing a delay of M samples. Accordingly, we define the transfer function
H(z) = z
M
H1 ( z ) = z
cm z
= M
m
i
cm z
mM
(E.17)
=M
i=0
2M
cm i z
ai z
i=0
2M
(E.18)
Let w m denote the coefficients of a particular window function and let c' m denote the coefficients of the modified function, i.e., the given function multiplied by some window function. The modified coefficients are then computed from
c' m = w m c m
(E.19)
Example E.1 A lowpass FIR digital filter is to be designed using the Fourier series method. The desired amplitude response is
A ( f ) = 1 for 0 f 125 Hz 0 elsewhere in the range 0 < f < f0
(E.20)
The sampling frequency is 1 KHz and the impulse response is to be limited to 20 delays. Derive the transfer function using the Fourier series method. Solution: To make this lowpass filter an even function of frequency, we represent it as shown in Figure E.26 (a) in terms of the actual frequency. Let us express it in terms of the normalized frequency scale. We do this by considering the sampling frequency which is given as f S = 1 KHz . Accordingly, the folding frequency* is f 0 = f S 2 = 1000 2 = 500 Hz , and in terms of the normalized
* We recall that the folding frequency is the highest frequency that can be processed by a given discretetime system with sampling frequency f S
E18
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
(E.21)
and the lowpass filter in normalized frequency scale is as shown in Figure E.26(b).
1 A(f) f
125
(a)
1 Ad ( )
0.25
(b)
Figure E.26. Lowpass filter for Example E.1
The coefficients c m are computed from the integral of (E.15),* that is,
cm =
1 0
0.25 0
(E.22)
with c m = c m . For this example, it is stated that the impulse response should be limited to 20 delays and this implies that the transfer function should contain 21 terms since one component needs not to be delayed. The coefficients c m are computed from (E.22) for m = 0 through m = 10 , and for the computations we use the MATLAB script below.
disp('m cm'); disp('================'); m=0:10; cm=zeros(11,2); % There are 11 terms from m=0 to m=10 cm(:,1)=m'; m=m+(m==0).*eps; % This statement avoids division by 0 cm(:,2)=sin(0.25.*m.*pi)./(m.*pi); fprintf('%2.0f\t %12.5f\n', cm')
* We recall from Chapter 7 that the Fourier series of even functions consist only of cosine terms.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E19
The window coefficients are applied to the noncausal form of the transfer function centered at the origin, and thus the 10th coefficient a 10 is considered as the origin. These coefficients represent the unmodified transfer function and thus they correspond to the coefficients of the rectangular window.
E20
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
i=0
2M
ai z
i=0
ai z
20
= a 0 + a 1 z + a 2 z + + a 20 z
1 2
20
(E.23)
0.1
0.2
0.9
0.1
0.2
0.9
Figure E.27. The magnitude and phase response for the lowpass filter in Example E.1
Check with the fvtool MATLAB function: Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E21
and MATLAB outputs the normalized magnitude response shown in Figure E.28.
Magnitude Response (dB) 0 -5 -10 Magnitude (dB) -15 -20 -25 -30 -35 -40 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Normalized Frequency ( rad/sample) 0.8 0.9
Figure E.28. Normalized frequency plot created with the MATLAB function fvtool
The MATLAB function fir1 uses the Fourier series approach in designing lowpass, highpass, bandpass, and band elimination (bandstop) FIR digital filters. The syntax is
b=fir1(n,Wn,ftype, window)
where n is the filter order, Wn is the cutoff frequency and must be between 0 < Wn < 1 , with 1.0 corresponding to half the sample (Nyquist) rate, ftype is the filter type specified as low, high, bandpass, or stop, and window is the window type, e.g., hann, blackman, and must be n+1 elements long. If no window is specified, the function fir1 uses a Hamming window. The filter b is real and has linear phase. The normalized gain of the filter at Wn is 6 dB . We can obtain the normalized frequency plot in Figure E.27 or E.28 using the fir1 function as follows:
b=fir1(20,0.25,'low', rectwin(21)); freqz(b)
and MATLAB outputs the magnitude and phase response shown in Figure E.29.*
* The magnitude response is the same as that in Figure E.27 because the filter in this example is a brickwall digital lowpass filter.
E22
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0.1
0.2
0.9
0.1
0.2
0.9
Figure E.29. Normalized frequency plots for the rectwin window created with the MATLAB function fir1
Example E.2 Compare the frequency response in Example E.1, Figure E.27, when it is multiplied by the following window functions: a. triangular b. Hanning c. Hamming Solution: a. triangular We recall from (E.4) that the triangular window function is defined as
2t f ( t ) triang = 1 ------ for |t| < -2
(E.24)
= 0 otherwise
(E.25)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E23
MATLAB outputs the values shown below. m wm =============== 0 1.00000 1 0.90000 2 0.80000 3 0.70000 4 0.60000 5 0.50000 6 0.40000 7 0.30000 8 0.20000 9 0.10000 10 0.00000 From (E.19)
c' m = w m c m
(E.26)
E24
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Next, we enter the a i values at the MATLAB command prompt as shown below.
a0=wm(11,2)*cm(11,2); a20=a0; a1=wm(10,2)*cm(10,2); a19=a1; a2=wm(9,2)*cm(9,2); a18=a2; a3=wm(8,2)*cm(8,2); a17=a3; a4=wm(7,2)*cm(7,2); a16=a4; a5=wm(6,2)*cm(6,2); a15=a5; a6=wm(5,2)*cm(5,2); a14=a6; a7=wm(4,2)*cm(4,2); a13=a7; a8=wm(3,2)*cm(3,2); a12=a8; a9=wm(2,2)*cm(2,2); a11=a9; a10=wm(1,2)*cm(1,2);
and with
AT=[a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20]; freqz(AT)
we obtain the magnitude and phase response of the lowpass filter in Example E.1 modified with the triangular window function shown in Figure E.30.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E25
0 Magnitude (dB) -10 -20 -30 -40 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
0 Phase (degrees) -500 -1000 -1500 -2000 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
Figure E.30. Magnitude and phase response of the lowpass filter modified with the triangular window function
In comparison with the amplitude response with the rectangular window function in Figure E.29, the amplitude response with the triangular window function in Figure F.30 shows that the cutoff is worse than that in Figure E.29 but the sidelobes are reduced significantly. We can obtain the normalized frequency plot in Figure E.30 using the fir1 function as follows:
b=fir1(20,0.25,'low', triang(21)); freqz(b)
and MATLAB outputs the magnitude and phase response shown in Figure E.31. Check with the fvtool MATLAB function:
b=0.25*sinc(0.25*(10:10)); b=b.*triang(21); fvtool(b,1)
E26
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Magnitude (dB)
0 -20 -40
0.1
0.2
0.9
Phase (degrees)
-500 -1000 -1500 -2000 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
Figure E.31. Normalized frequency plots for the triang window created with the MATLAB function fir1
Magnitude Response (dB) 0 -5 -10 Magnitude (dB) -15 -20 -25 -30 -35 -40 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Normalized Frequency ( rad/sample) 0.8 0.9
Figure E.32. Magnitude response for the triang window created with the MATLAB function fvtool
b. Hanning We recall from (E.6) that the Hanning window function is defined as
1 2 f ( t ) Hann = cos ( t ) = -- 1 + cos 2t ------2 = 0 otherwise for |t| < -2
(E.27)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E27
(E.28)
As before, the window coefficients are applied to the noncausal form of the transfer function centered at the origin, and thus the 10th coefficient is considered as the origin. For the computations we use the MATLAB script below.
disp('m wm') disp('=================') m=0:10; wm=zeros(11,2); wm(:,1)=m'; m=m+(m==0).*eps; wm(:,2)=0.5.*(1 +cos(pi.*m./10)); fprintf('%2.0f\t %12.5f\n',wm')
and MATLAB outputs m wm ================= 0 1.00000 1 0.97553 2 0.90451 3 0.79389 4 0.65451 5 0.50000 6 0.34549 7 0.20611 8 0.09549 9 0.02447 10 0.00000 From (E.19)
c' m = w m c m
(E.29)
Then,
Cm=[0.2500 0.2251 0.1592 0.0750 0.0000 0.0450 0.0531 0.0322 0.0000 0.0250 0.0318]; Wm=[1.00000 0.97553 0.90451 0.79389 0.65451 0.50000 0.34549 0.20611 0.09549 0.02447 0.00000];
Next,
C=Cm.*Wm
E28
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Next, we enter the a i values at the MATLAB command prompt as shown below.
a0=wm(11,2)*cm(11,2); a20=a0; a1=wm(10,2)*cm(10,2); a19=a1; a2=wm(9,2)*cm(9,2); a18=a2; a3=wm(8,2)*cm(8,2); a17=a3; a4=wm(7,2)*cm(7,2); a16=a4; a5=wm(6,2)*cm(6,2); a15=a5; a6=wm(5,2)*cm(5,2); a14=a6; a7=wm(4,2)*cm(4,2); a13=a7; a8=wm(3,2)*cm(3,2); a12=a8; a9=wm(2,2)*cm(2,2); a11=a9; a10=wm(1,2)*cm(1,2);
and with
AHn=[a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20]; freqz(AHn)
we obtain the magnitude and phase response of the lowpass filter in Example E.1 modified with the Hanning window function shown in Figure E.33.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E29
50 Magnitude (dB) 0 -50 -100 -150 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
0 Phase (degrees) -200 -400 -600 -800 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
Figure E.33. Magnitude and phase response of the lowpass filter modified with the Hanning window function
We can obtain the normalized frequency plot in Figure E.30 using the fir1 function as follows:
b=fir1(20,0.25,'low', hann(21)); freqz(b)
and MATLAB outputs the magnitude and phase response shown in Figure E.34. Check with the fvtool MATLAB function:
b=0.25*sinc(0.25*(10:10)); b=b.*hann(21); fvtool(b,1)
E30
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
0 Phase (degrees) -200 -400 -600 -800 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
Figure E.34. Normalized frequency plots for the hann window created with the MATLAB function fir1
Magnitude Response (dB) 0 -10 -20 Magnitude (dB) -30 -40 -50 -60 -70 -80 -90 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Normalized Frequency ( rad/sample) 0.8 0.9
Figure E.35. Magnitude response for the hunn window created with the MATLAB function fvtool
c. Hamming We recall from (E.8) that the Hamming window function is defined as
2t f ( t ) Hamm = 0.54 + 0.46 cos ------ = 0 otherwise for |t| < -2
(E.30)
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E31
(E.31)
As before, the window coefficients are applied to the noncausal form of the transfer function centered at the origin, and thus the 10th coefficient is considered as the origin. For the computations we use the MATLAB script below.
disp('m wm') disp('=================') m=0:10; wm=zeros(11,2); wm(:,1)=m'; m=m+(m==0).*eps; wm(:,2)=0.54+0.46.*(cos(pi.*m./10)); fprintf('%2.0f\t %12.5f\n',wm')
and MATLAB outputs m wm ============== 0 1.00000 1 0.97749 2 0.91215 3 0.81038 4 0.68215 5 0.54000 6 0.39785 7 0.26962 8 0.16785 9 0.10251 10 0.08000 From (E.19)
c' m = w m c m
(E.32)
Then,
Cm=[0.2500 0.2251 0.1592 0.0750 0.0000 0.0450 0.0531 0.0322 0.0000 0.0250 0.0318]; Wm=[1.00000 0.97749 0.91215 0.81038 0.68215 0.54000 0.39785 0.26962 0.16785 0.10251 0.08000];
Next,
D=Cm.*Wm
E32
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Next, we enter the a i values at the MATLAB command prompt as shown below.
a0=wm(11,2)*cm(11,2); a20=a0; a1=wm(10,2)*cm(10,2); a19=a1; a2=wm(9,2)*cm(9,2); a18=a2; a3=wm(8,2)*cm(8,2); a17=a3; a4=wm(7,2)*cm(7,2); a16=a4; a5=wm(6,2)*cm(6,2); a15=a5; a6=wm(5,2)*cm(5,2); a14=a6; a7=wm(4,2)*cm(4,2); a13=a7; a8=wm(3,2)*cm(3,2); a12=a8; a9=wm(2,2)*cm(2,2); a11=a9; a10=wm(1,2)*cm(1,2);
and with
AHm=[a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20]; freqz(AHm)
we obtain the magnitude and phase response of the lowpass filter in Example E.1 modified with the Hanning window function shown in Figure E.36.
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
E33
50
Magnitude (dB)
0 -50 -100
0.1
0.2
0.9
Phase (degrees)
-500
-1000
0.1
0.2
0.9
Figure E.36. Magnitude and phase response of the lowpass filter modified with the Hamming window function
We can obtain the normalized frequency plot in Figure E.36 using the fir1 function* as follows:
b=fir1(20,0.25,'low'); freqz(b)
and MATLAB outputs the magnitude and phase response shown in Figure E.37. Check with the fvtool MATLAB function:
b=0.25*sinc(0.25*(10:10)); b=b.*hamming(21); fvtool(b,1)
E34
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Magnitude (dB)
-50
-100
0.1
0.2
0.9
Phase (degrees)
-500
-1000
0.1
0.2
0.9
Figure E.37. Normalized frequency plots for the hamming window created with the MATLAB function fir1
Magnitude Response (dB) 0 -10 -20 -30 -40 -50 -60 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Normalized Frequency ( rad/sample) 0.8 0.9
Figure E.38. Magnitude response for the hamming window created with the MATLAB function fvtool
Example E.3 Obtain the magnitude response for the lowpass filter in Example E.1 with Kaiser = 2 using: a. the fir1 MATLAB function b. the fvtool MATLAB function Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
Magnitude (dB)
E35
Magnitude (dB)
0 -50 -100 -150 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1
Phase (degrees)
-500
-1000
0.1
0.2
0.9
Figure E.39. Normalized frequency plots for the kaiser window created with the MATLAB function fir1
b.
b=0.25*sinc(0.25*(10:10)); b=b.*kaiser(21,2.*pi); fvtool(b,1)
Magnitude Response (dB) 0 -10 -20 Magnitude (dB) -30 -40 -50 -60 -70 -80 -90 -100 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Normalized Frequency ( rad/sample) 0.8 0.9
Figure E.40. Magnitude response for the kaiser window created with the MATLAB function fvtool
E36
Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition Copyright Orchard Publications
R1
8. Introduction to Stateflow with Applications, ISBN 9781934404072 9. Reference Data for Radio Engineers, ISBN 0672212188, Howard W. Sams & Co. 10.Electronic Engineers Handbook, ISBN 0070209812, McGrawHill 11. Network Analysis and Synthesis, L. Weinberg, McGrawHill 12. Elecrronic Filter Design Handbook, Williams and Taylor, McGrawHill
R2
Signals and Systems with MATLAB Computing and Simulink Modeling, Third Edition Copyright Orchard Publications
Index
Symbols % (percent) symbol in MATLAB A-2 A abs(z) in MATLAB A-23 active analog filter - see filter adjoint of a matrix - see matrix admittance capacitive 4-2 inductive 4-2 complex input 4-11 algebraic constrain block in Simulink B-18 aliasing 10-14 all-pass filter - see filter all-pole approximation 11-21 all-pole low-pass filter see filter - low-pass alternate form of the trigonometric Fourier series - see Fourier series alternate method of partial fraction expansion - see partial fraction expansion angle(z) MATLAB function A-23 argument 11-2 attenuation rate 11-12 autoscale icon in Simulink B-12 axis MATLAB command A-16 B band-elimination filter - see filter band-elimination filter design see filter design band-limited signal 10-13 band-pass filter - see filter band-pass filter design see filter design band-stop filter - see filter Bessel filter - see filter bilinear MATLAB function 11-59 bilinear transformation - see transformation methods for mapping analog prototype filters to digital filters bode MATLAB function 11-24 box MATLAB command A-12 buttap MATLAB function 11-17 buttefly operation 10-23 Butterworth analog low-pass filter design - see filter design C c2d MATLAB function 9-46 capacitive admittance - see admittance capacitive impedance - see impedance cascade form realization - see digital filter Category I FFT algorithm - see FFT algorithm Category II FFT algorithm - see FFT algorithm Cauchys residue theorem see residue theorem Cauer filter - see elliptic filter Cayley-Hamilton theorem 5-11 characteristic equation 5-19 cheb1ap MATLAB function 11-35 cheb2ap MATLAB function 11-38 Chebyshev filters - see filter Chebyshev Type I analog low-pass filter design - see filter design Chebyshev Type I filters - see filter Chebyshev Type I low-pass filter magnitude-square function 11-26 - see filter Chebyshev Type II analog low-pass filter design - see filter design Chebyshev Type II filters - see filter circuit analysis with Laplace transforms 4-1 circuit analysis with state variables 5-22 circuit transformation from time to complex frequency 4-1 clc MATLAB command A-2 clear MATLAB command A-2 cofactor of a matrix - see matrix collect(s) MATLAB symbolic function 3-12 column vector in MATLAB A-19 command screen in MATLAB A-1 Command Window in MATLAB A-1 commas in MATLAB A-8 comment line in MATLAB A-2 Commonly Used Blocks in Simulink B-7 complex admittance - see admittance complex conjugate in MATLAB A-4 complex conjugate pairs 3-5 complex impedance - see impedance complex number C-2 complex numbers in MATLAB A-3 complex poles 3-5 Complex to Magnitude-Angle block in Simulink C-7 computation of the state transition matrix 5-11 computation of the Z Transform with contour integration - see Z transform Configuration Parameters in Simulink B-12 congugate of a matrix - see matrix conj(A) MATLAB function D-9 conjugate of a complex number C-3 conjugate time and frequency functions of the Fourier transform - see Fourier transform - properties of constant function - Fourier transform of see Fourier transform - properties of Contents Pane in Simulink B-7 contour integral 9-20 conv MATLAB function A-7 convolution in the complex frequency domain - see Laplace transform properties of convolution in the discrete-frequency domain - see Z transform - properties of convolution in the discrete-time domain - see Z transform - properties of convolution in the time domain property of the Laplace transform - see Laplace transform - properties of convolution integral defined 6-8 graphical evaluation of 6-8 convolution property of the Fourier transform - see Fourier transform properties of Cooley and Tukey 10-18 cosine function - Fourier transform of see Fourier transform of common functions cos0t u0(t) function - Fourier transform of see Fourier transform of common functions Cramers rule D-17 D d2c MATLAB function 9-47 data points in MATLAB A-14 decade - definition of 11-12 decimation in frequency - see FFT algorithm decimation in time - see FFT algorithm deconv MATLAB function A-6 default color in MATLAB A-15 default line in MATLAB A-15 default marker in MATLAB A-15 default values in MATLAB A-12 delta (impulse) function definition of 1-11 doublet 1-14 Fourier transform of - see Fourier transform of common functions higher order 1-14 nth-order 1-14 sampling property of 1-12 sifting property of 1-13 triplet 1-14 demo in MATLAB A-2 DeMoivres theorem 11-15 derivation of the Fourier transform from the Laplace Transform 8-25 determinant of a matrix - see matrix determinant of order 2 - see matrix DFT - common properties of even time function 10-9 even frequency function 10-9 frequency convolution 10-13 frequency shift 10-12 linearity 10-10 odd time function 10-9 odd frequency function 10-9 time convolution 10-12 time shift 10-11 DFT - definition of 10-1 N-point 10-2, 10-16 diagonal elements of a matrix - see matrix diagonal matrix - see matrix
IN-1
differentiation in complex frequency domain property of the Laplace transform - see Laplace transform - properties of differentiation in time domain property of the Laplace transform - see Laplace transform - properties of differentiation property of the Fourier transform 8-12 - see Fourier transform - properties of digital filter 11-1, 11-51, 11-70 Finite Impulse Response (FIR) 11-52 FIR 11-52 IIR 11-51 Infinite Impulse Response (IIR) 11-51 realization of Direct Form I 11-70 Direct Form II 11-71 cascade (series) form 11-73 non-recursive 11-52 parallel form 11-70 recursive 11-52 series (cascade) form 11-73 Digital Filter Design Simulink block 11-78 digital filter design with Simulink 11-70 dimpulse MATLAB function 9-29 Dirac MATLAB function 1-20 Direct Form I realization - see digital filter realization of Direct Form II realization - see digital filter realization of direct term in MATLAB 3-4 discontinuous function - definition of 1-2 Discrete Fourier Transform (DFT) 10-1 discrete impulse response 9-40 discrete-time system transfer function 9-40 discrete unit step function 9-3 discrete-time exponential sequence 9-16 discrete-time systems 9-1 discrete-time unit ramp function 9-18 discrete-time unit step function 9-14 Display block in Simulink B-18 display formats in MATLAB A-31 distinct eigenvalues - see eigenvalues distinct poles - see poles division of complex numbers C-4 dot operator in MATLAB division with A-21 exponentiation with A-21 multiplication with A-20 double-memory technique see FFT Algorithm doublet - see delta function E Editor Window in MATLAB A-1 Editor/Debugger in MATLAB A-1 eig(x) MATLAB function 5-17 eigenvalues distinct 15-1 multiple (repeated) 5-15 eigenvector 5-19 e-jt u0(t) Fourier transform of - see Fourier
transform of common functions element-by-element operation in MATLAB division A-21 exponentiation A-21 multiplication A-20 elements of the matrix - see matrix ellip MATLAB function 11-40 elliptic filter - see filter elliptic filter design - see filter design eps in MATLAB A-22 Eulers identities C-5 even functions 6-4, 7-33 even symmetry - see Fourier series - symmetry Excel's Analysis ToolPak 10-5 exit MATLAB command A-2 expand MATLAB symbolic function 3-10 exponential form of complex numbers C-5 exponential form of the Fourier series see Fourier series exponential order function definition of 2-2 eye(n) MATLAB function D-7 eye(size(A)) MATLAB function D-7 F factor(s) MATLAB symbolic function 3-4 Fast Fourier Transform (FFT) 10-1, 10-17 FDA Tool Digital Filter Design Simulink block 11-82 FFT algorithm Category I 10-19 Category II 10-20 decimation in frequency 10-20 decimation in time 10-20 double-memory technique 10-20 in-place 10-20 natural input-output 10-20 FFT definition of 10-1, 10-17 fft(x) MATLAB function 10-5, 11-68 Figure Window in MATLAB A-13 filter - see also digital filter active high-pass 4-22, 4-32 low-pass 4-22, 4-32, 4-23, 4-35 all-pass 11-1, 11-94 all-pole 11-21 band-elimination 11-1, 11-8 band-pass 11-1, 11-7 band-stop - see band-elimination Bessel 11-95 Chebyshev 11-10 Inverted 11-38 magnitude-square function 11-26 prototype 11-10 Type I 11-25 Type II 11-38 elliptic 11-39 high-pass 4-22, 4-30, 11-1, 11-4 low-pass 4-22, 4-30, 11-1, 11-2 low-pass analog filter prototypes 11-10 maximally flat 11-14 (footnote)
notch (band-elimination) 11-8 phase shift 11-1, 11-94 RC high-pass 11-4 RC low-pass 11-2 RLC band-elimination 4-22, 4-31, 11-8 RLC band-pass 4-22, 4-31, 11-7 filter design - see also digital filter band-elimination 11-41 band-pass 11-41 Butterworth analog low-pass 11-14 Chebyshev Type I 11-25 Type II 11-38 elliptic 11-39 high-pass 11-41 low-pass 11-14 filter MATLAB function 11-63 final value theorem in Z transform see Z transform - properties of final value theorem in Laplace transform see Laplace transform - properties of find MATLAB function 11-68 Finite Impulse Response (FIR) digital filter see digital filter FIR - see digital filter first harmonic - see Fourier series harmonics of first-order circuit 5-1 first-order simultaneous differential equations 5-1 Flip Block command in Simulink B-11 format in MATLAB A-31 fourier MATLAB command 8-33 Fourier series exponential form of 7-31 method used in window functions E-17 trigonometric form of 7-2, 7-10 alternate form of 7-25 Fourier series coefficients - evaluation of numerical evaluation using Excel 7-46 numerical evaluation using MATLAB 7-47 Fourier series of common waveforms full-wave rectifier 7-20, 7-24 half-wave rectifier 7-17, 7-20 square waveform with even symmetry 7-9, 7-13 with odd symmetry 7-8, 7-12 sawtooth 7-9, 7-15 triangular 7-9, 7-16 Fourier series - harmonics of first 7-1, 7-10 second 7-1, 7-10 third 7-1, 7-10 Fourier series - symmetry even 7-7 half-wave 7-7, 7-34 odd 7-7 quarter-wave 7-7 (footnote) types of 7-7 Fourier integral - see Fourier transform Fourier transform definition of 8-1 inverse of 8-1 special forms of 8-2
IN-2
Fourier transform - properties of area under f(t) 8-15 area under F() 8-15 conjugate time and frequency functions 8-13 constant function 8-18 frequency convolution 8-15 frequency differentiation 8-13 frequency shifting 8-11 imaginary time functions - Fourier transform of 8-6 linearity 8-9 Parseval's theorem 8-16 real time functions - Fourier transform of 8-3 symmetry 8-9 time convolution 8-14 time differentiation 8-12 time integration 8-13 time scaling 8-10 time shifting 8-11 Fourier Transform derivation from Laplace transform 8-25 Fourier transform of common functions cos 0t 8-19 cos0t u0(t) 8-24 delta ((t) and (t-a)) 8-18 e-j0t 8-19 e-j0t u0(t) 8-24 signum (sgn(t)) 8-20 sin0t 8-20 sin0t u0(t) 8-25 unit step (u0(t)) 8-22 Fourier transform of common waveforms combined rectangular pulses 8-29 cosine within a rectangular pulse 8-30 shifted rectangular pulse 8-28 symmetrical rectangular pulse 8-27 periodic time functions 8-31, 8-32 fourth-order all-pole low-pass filter see filter, low-pass fplot in MATLAB A-27 frequency convolution in DFT see DFT - common properties of frequency convolution in Fourier transform of - see Fourier transform - properties of frequency differentiation in Fourier transform of - see Fourier transform - properties of frequency shift in DFT see DFT - common properties of frequency shift in Fourier transform see Fourier transform - properties of frequency shift in Laplace transform see Laplace transform - properties of freqz MATLAB function 11-57 full rectification waveform - Laplace transform of - see Laplace transform of common waveforms full-wave rectifier - Fourier series of - see Fourier series of common waveforms Function Block Parameters in Simulink B-10 function files in MATLAB A-26 fundamental frequency 7-1
fzero MATLAB function A-26 G Gain block in Simulink B-9, B-18 gamma function 2-15 Gaussian elimination method D-19 generalized factorial function 2-15 Gibbs phenomenon 7-24 grid MATLAB command A-12 gtext MATLAB command A-13 H
Inverse Fourier transform see Fourier transform Inverse Laplace transform 2-1 see Laplace transform inverse of a matrix - see matrix Inverse Z transform - see Z transform inversion integral 9-32 Inverted Chebyshev filter - see filter J j operator C-1 L
half-wave rectifier - Fourier series of - see Fourier series of common waveforms half-wave symmetry see Fourier series - symmetry Heavyside MATLAB function 1-14 help in MATLAB A-2 Hermitian matrix - see matrix higher order delta functions - see delta function high-pass filter - see filter high-pass filter design - see filter design I identity matrix - see matrix ifft(x) MATLAB function 10-5 ifourier MATLAB function 8-33 IIR - see digital filter ilaplace MATLAB function 3-4 imag(z) MATLAB function A-23 imaginary axis - definition of C-2 imaginary number - definition of C-2 imaginary time functions 8-6 see Fourier transform - properties of impedance capacitive 4-2 inductive 4-2 complex input 4-8, 4-9 improper integral - definition of 2-15 improper rational function definition of 3-1, 3-13 impulse function - see delta function impulse invariant method - see transformation methods for mapping analog prototype filters to digital filters increments between points in MATLAB A-14 inductive admittance - see admittance inductive impedance - see impedance infinite impulse response - see digital filter initial value theorem in Z transform see Z transform - properties of initial value theorem in Laplace transform see Laplace transform - properties of in-place FFT algorithm 10-20 see FFT algorithm integration in frequency in Laplace transform see Laplace transform - properties of integration in time in Laplace transform see Laplace transform - properties of
L Hpitals rule 2-16 laplace MATLAB function 2-27 Laplace integral - see Laplace transform Laplace transform definition of 2-1 Inverse of 2-1, 3-1 Laplace transform - properties of convolution in the complex frequency domain 2-12 convolution in the time domain 2-11 differentiation in complex frequency domain 2-6 differentiation in time domain 2-4 final value theorem 2-10 frequency shift 2-4 initial value theorem 2-9 integration in complex frequency domain 2-8 time domain 2-6 linearity 2-3 scaling 2-4 time periodicity 2-8 time shift 2-3 Laplace transform of common waveforms full-rectified 2-32 half-rectified 2-26 linear segment 2-23 pulse 2-23 rectangular periodic 2-25 sawtooth 2-32 triangular 2-24 Laplace transform of common functions transform of e-at cost u0(t) 2-22 transform of e-at sint u0(t) 2-21 transform of e-at u0(t) 2-19 transform of cost u0(t) 2-20 transform of (t) 2-18 transform of (t-a) 2-18 transform of sint u0(t) 2-20 transform of tn u0(t) function 2-15 transform of tn e-at u0(t) 2-19 transform of u0(t) 2-14 transform of u1(t) 2-14 leakage 10-13 left shift in discrete-time domain see Z transform - properties of Leibnitzs rule 6 lims= MATLAB command A-27 line spectra 7-36 linear difference equation 9-38 IN-3
linearity in DFT see DFT - common properties of linearity in discrete-time domain see Z transform - properties of linearity property in Fourier transform see Fourier transform - properties of linearity property in Laplace transform see Laplace transform - properties of linspace MATLAB command A-14 ln (natural log) A-13 log in MATLAB A-13 log(x) MATLAB function A-13 log10(x) MATLAB function A-13 log2(x) MATLAB function A-13 loglog MATLAB command A-13 long division of polynomials 9-36 lower triangular matrix - see matrix low-pass analog filter prototypes - see filter low-pass filter - see filter lp2bp MATLAB function 11-43 lp2bs MATLAB function 11-43 lp2hp MATLAB function 11-43 lp2lp MATLAB function 11-43 M magnitude-squared function 11-10 main diagonal of a matrix - see matrix Math Operations in Simulink B-10 MATLAB Demos A-2 MATLABs Editor/Debugger A-1 matrix (matrices) adjoint of D-21 cofactor of D-13 conformable for addition D-2 conformable for subtraction D-2 conformable for multiplication D-4 congugate of D-8 definition of D-1 determinant D-10 minor of D-13 non-singular D-21 singular D-21 diagonal D-2, D-6 diagonal elements of D-2 elements of D-1 Hermitian D-9 identity D-7 inverse of D-22 left division in MATLAB D-25 multiplication in MATLAB A-18 power series of 5-9 scalar D-7 size of D-7 skew-Hermitian D-9 skew-symmetric D-9 square D-1 symmetric D-8 trace of D-2 transpose of D-8 triangular lower D-6 upper D-6 zero D-2 matrix left division in MATLAB - see matrix IN-4
matrix multiplication in MATLAB - see matrix matrix power series - see matrix maximally flat filter - see filter mesh(x,y,z) MATLAB function A-17 meshgrid(x,y) MATLAB command A-17 m-file in MATLAB A-2, A-26 minor of determinant - see matrix MINVERSE Excel function D-27 MMULT Excel function D-27 modulated signals 8-12 multiple eigenvalues - see eigenvalues multiple poles - see poles multiplication by an in discrete-time domain see Z transform - properties of multiplication by e-naT in discrete-time domain - see Z transform - properties of multiplication by n in discrete-time domain see Z transform - properties of multiplication by n2 indiscrete-time domain see Z transform - properties of multiplication of complex numbers C-3 N NaN in MATLAB A-26 natural input-output FFT algorithm see FFT algorithm network transformation resistive 4-1 capacitive 4-1 inductive 4-1 non-recursive realization digital filter see digital filter non-singular determinant - see matrix normalized cutoff frequency 11-15 notch filter - see filter N-point DFT - see DFT - definition of nth-order delta function - see delta function numerical evaluation of Fourier coefficients see Fourier series coefficients Nyquist frequency 10-13 O octave defined 11-12 odd functions 6-5, 7-34 odd symmetry - see Fourier series - symmetry orthogonal functions 7-2 orthogonal vectors 5-19 orthonormal basis 5-19 P parallel form realization - see digital filter Parsevals theorem - see Fourier transform - properties of partial fraction expansion 3-1, 3-2, 9-25 alternate method of 3-15 method of clearing the fractions 3-15 phase angle 11-2 phase shift filter - see filter picket-fence effect 10-14 plot MATLAB command A-10 polar form of complex numbers C-6
polar plot in MATLAB A-24 polar(theta,r) MATLAB function A-23 poles 3-1 complex 3-5 distinct 3-2 multiple (repeated) 3-8 poly MATLAB function A-4 polyder MATLAB function A-7 polynomial construction from known roots in MATLAB A-4 polyval MATLAB function A-6 pre-sampling filter 10-13 pre-warping 11-55 proper rational function definition of 3-1, 11-11 properties of the DFT see DFT - common properties of properties of the Fourier Transform see Fourier transform - properties of properties of the Laplace Transform see Laplace transform - properties of properties of the Z Transform see Z transform - properties of Q quarter-wave symmetry 7-7 (footnote) quit MATLAB command A-2 R radius of absolute convergence 9-3 ramp function 1-9 randn MATLAB function 11-68 Random Source Simulink block 11-80 rationalization of the quotient C-4 RC high-pass filter - see filter RC low-pass filter - see filter real axis C-2 real number C-2 real(z) MATLAB function A-23 rectangular form C-5 rectangular pulse expressed in terms of the unit step function 1-4 recursive realization digital filter see digital filter region of convergence 9-3 divergence 9-3 relationship between state equations and Laplace Transform 5-30 residue 3-2, 9-41 residue MATLAB function 3-3, 3-12 residue theorem 9-20, 9-21 right shift in the discrete-time domain see Z transform - properties of RLC band-elimination filter - see filter RLC band-pass filter - see filter roots of polynomials in MATLAB A-3 roots(p) MATLAB function 3-6, A-3 round(n) MATLAB function A-24 row vector in MATLAB A-3 Runge-Kutta method 5-1 running Simulink B-7
S sampling property of the delta function see delta function sampling theorem 10-13 sawtooth waveform - see Laplace transform of common waveforms sawtooth waveform - Fourier series of see Fourier series of common waveforms scalar matrix - see matrix scaling property of the Laplace transform see Laplace transform - properties of Scope block in Simulink B-12 script file in MATLAB A-2, A-26 second harmonic - see Fourier series harmonics of semicolons in MATLAB A-8 semilogx MATLAB command A-12 semilogy MATLAB command A-12 series form realization - see digital filter Shannons sampling theorem see sampling theorem shift of f[n] u0[n] in discrete-time domain see Z transform - properties of sifting property of the delta function see delta function signal flow graph 10-23 signals described in math form 1-1 signum function - see Fourier transform of common functions simout To Workspace block in Simulink B-12 simple MATLAB symbolic function 3-7 Simulation drop menu in Simulink B-12 simulation start icon in Simulink B-12 Simulink icon B-7 Simulink Library Browser B-8 sine function - Fourier transform of see Fourier transform of common functions singular determinant - see matrix Sinks library in Simulink B-18 sin0t u0(t) Fourier transform of - see Fourier transform of common functions size of a matrix - see matrix skew-Hermitian matrix - see matrix skew-symmetric matrix - see matrix special forms of the Fourier transform see Fourier transform spectrum analyzer 7-36 square matrix - see matrix square waveform with even symmetry - see Fourier series of common waveforms square waveform with odd symmetry - see Fourier series of common waveforms ss2tf MATLAB function 5-33 stability 11-13 start simulation in Simulink B-12 state equations for continuous-time systems 5-1 for discrete-time systems 9-45 state transition matrix 5-9 state variables for continuous-time systems 5-1
for discrete-time systems 9-45 State-Space block in Simulink B-12 state-space equations for continuous-time systems 5-1 for discrete-time systems 9-45 step function - see unit step function step invariant method - see transformation methods for mapping analog prototype filters to digital filters stop-band filter - see filter string in MATLAB A-16 subplots in MATLAB A-18 summation in the discrete-time Domain see Z transform - properties of symmetric matrix - see matrix symmetric rectangular pulse expressed as sum of unit step functions 1-6 symmetric triangular waveform expressed as sum of unit step functions 1-6 symmetry - see Fourier series - symmetry symmetry property of the Fourier transform see Fourier transform - properties of system function - definition of 8-35 T Taylor series 5-1 text MATLAB command A-14 tf2ss MATLAB function 5-33 theorems of the DFT 10-10 theorems of the Fourier Transform 8-9 theorems of the Laplace transform 2-2 theorems of the Z Transform 9-3 third harmonic - see Fourier series - harmonics of time convolution in DFT see DFT - common properties of time integration property of the Fourier transform - see Fourier transform - properties of time periodicity property of the Laplace transform 2-8 - see Laplace transform - properties of time scaling property of the Fourier transform - see Fourier transform - properties of time shift in DFT see DFT - common properties of time shift property of the Fourier transform see Fourier transform - properties of time shift property of the Laplace transform see Laplace transform - properties of title(string) MATLAB command A-12 trace of a matrix - see matrix Transfer Fcn block in Simulink 4-17 Transfer Fcn Direct Form II Simulink block 11-71 transfer function of continuous-time systems 4-13 discrete-time systems 9-38 transformation between s and z domains 9-22 transformation methods for mapping analog prototype filters to digital filters Impulse Invariant Method 11-52
Step Invariant Method 11-52 Bilinear transformation 11-53 transpose of a matrix - see matrix Tree Pane in Simulink B-7 triangular waveform expressed in terms of the unit step function 1-4 triplet - see delta function Tukey - see Cooley and Tukey U unit eigenvectors 5-19 unit impulse function ((t)) 1-8 unit ramp function (u1(t)) 1-8 unit step function (u0(t)) 1-2 upper triangular matrix - see matrix using MATLAB for finding the Laplace transforms of time functions 2-27 using MATLAB for finding the Fourier transforms of time function 8-33 V Vandermonde matrix 10-18 Vector Scope Simulink block 11-84 W warping 11-54 window functions Blackman E-12 Fourier series method for approximating an FIR amplitude response E-17 Hamming E-9, E-31 Hanning E-7, E-27 Kaiser E-14, E-35 other used as MATLAB functions E-15 rectangular E-2 triangular E-5, E-23 Window Visualization Tool in MATLAB E-4 X xlabel MATLAB command A-12 Y ylabel MATLAB command A-12 Z Z transform computation of with contour integration 9-20 definition of 9-1 Inverse of 9-1, 9-25 Z transform - properties of convolution in the discrete frequency domain 9-9 convolution in the discrete time domain 9-8 final value theorem 9-10 initial value theorem 9-9 left shift 9-5 linearity 9-3 IN-5
multiplication by an 9-6 multiplication by e-naT 9-6 multiplication by n 9-6 multiplication by n2 9-6 right shift 9-4 shift of f[n] u0[n] 9-3 summation 9-7 Z Transform of discrete-time functions cosine function cosnaT 9-16 exponential sequence e -naT u0[n] 9-16, 9-21 geometric sequence an 9-11 sine function sinnaT 9-16 unit ramp function nu0[n] 9-18, 9-21 unit step function u0[n] 9-14, 9-20 zero matrix - see matrix zeros 3-1, 3-2 zp2tf MATLAB function 11-17
IN-6
Students and working professionals will find Signals and Systems with MATLAB Computing and Simulink Modeling, Fourth Edition, to be a concise and easy-to-learn text. It provides complete, clear, and detailed explanations of the principal analog and digital signal processing concepts and analog and digital filter design illustrated with numerous practical examples.
This text includes the following chapters and appendices: Elementary Signals The Laplace Transformation The Inverse Laplace Transformation Circuit Analysis with Laplace Transforms State Variables and State Equations The Impulse Response and Convolution Fourier Series The Fourier Transform Discrete Time Systems and the Z Transform The DFT and The FFT Algorithm Analog and Digital Filters Introduction to MATLAB Introduction to Simulink Review of Complex Numbers Review of Matrices and Determinants Window Functions Each chapter contains numerous practical applications supplemented with detailed instructions for using MATLAB and Simulink to obtain accurate and quick solutions.
Steven T. Karris is the founder and president of Orchard Publications, has undergraduate and graduate degrees in electrical engineering, and is a registered professional engineer in California and Florida. He has more than 35 years of professional engineering experience and more than 30 years of teaching experience as an adjunct professor, most recently at UC Berkeley, California. products and the publication of MATLAB and His area of interest is in The MathWorks, Inc. Simulink based texts.
$70.00 U.S.A.