Download as pdf
Download as pdf
You are on page 1of 27
SymboT Unit Abbreviation mame nas ets Fi) Flo. oy) G Gis) Ga His) H@) Alay nn He!®) Ao) i Ks) k k fa L elt — Qs) transfer function with feedback — system-specitic (©) unitramp funetion second s R resistance ohm 2 R thermal resistance Cwatt ow reet(t) rectangle funetion dimensionless — s complex frequency second st SNR signal-to-noise ratio dimensionless — J) ——_peviod second : T temperature degrees Celsius °C T lative temperature degrees centigrade °C 4) unitstep function dimensionless — jv velocity meterssecond mis. v voltage volt v Vis) s-domain voltage volt v % complex Fourier coefficient same as function Pa complex zero. second st 2 complex variable Zi} zeransform Lis) domain impedance ‘ohm, w attenuation coeficient nepersis Npis « real part of pole or zero second < 8{n] discrete-time impulse second on 6(t) impulse (delta) function second — 6 rotation or phase angle degrees or radians ° or rad (8) s-domain rotation angle degrees or radians ° or rad ‘ damping coefficient dimensionless — r time constant second s é phase angle degrees or radians * or rad o angular frequency radians/second. rad/s @___discrew-time angular frequency _radians/sample ___rad/sample Review of Complex Numbers Acomplex number amay be written in the rectangular form zextiy, 1) ‘where x and y are the real (Re) and imaginary (Sm) parts of 2, respectively, and j = /=T. Thats, =Me@), y= IME). 62 Note that 3m(3 + j4) = 4, not j4. ‘Alternatively, 2 may be written in polar form as lelel = [a1 (B3) where [zis the magnitude of 2, 6 is its phase angle, and the form isa useful shorthand representation commonly used in ‘numerical calculations. By applying Buler’ identity. el” =cos8 + jsind, Ba) we ean convert 2 from polar form, as in Eq. (B.3), into rectangular form, asin Eq. (B.1), ile!” = [al cose + jlelsin®, 5) ‘which leads tothe relations Izlcos@, yy = [al sind, B96) wafers? en Figure B-l: Relation between rectangular and polar representations of a complex number 2 = x + jy = |\2le!”. ‘The two forms of x are illustrated graphically in Fig. B-1. Because in the complex plane, a complex number assumes the form of a vector, itis represented by a bold letter. ‘When using Eq, (B.7), care should be taken to ensure that 6 is in the proper quadrant by noting the signs of x and y individually, as illustrated in Fig, B-2. Specifically, tanlQ/x) fx > 0, pa lmton ex ifr <0, xp ify =Oand y > 0, =m ify =Oandy <0. Complex numbers 22 and 24 point in opposite directions and their phase angles & and 2 differ by 180°, despite the fact that (/x) has the same value in both cases. 440 Figure B-2: Complex numbers 2 t0 24 have the same magnitude |2) = Y22+3? = 3.61, but their polar sngles ‘depend onthe polarities oftheir ral and imaginary component, ‘The complex conjugate of z, denoted with a star superscript (or asterisk), is obtained by replacing j (wherever it appears) with —j, so that x= jy= lle Patsy Iie. ‘The magnitude |2| is equal to the positive square root of the product of 2 and its complex conjugate: |e) = Vow 9 ‘We now highlight some of the salient properties of complex algebra, Equality: If wo complex numbers 2; and 22 are given by izle, (B.10a) (B.10b) i tin R= t jr = lel, then 2) =22 if and only if (iff) x; =. and y1 = y2 on, equivalently, [21] = [zal and 6, = 62, Addition: Bal (+2) + ir t yD. APPENDIX B_ REVIEW OF COMPLEX NUMBERS Multiplication: nm = 01+ iy + i) =n —y)+jo2t my). (B.128) 212 = |n|e™ Janie izalete) 2i|'za|le0s(6) + 6) + jsim(@) +03)). (B.12b) Division: For 22 #0, 4 _ tiv n° atin Gti ~ Gat i = Rta + Jean =m) gag) te HL lale’* tale tail 09 ieal Hil cost = 0) + jsin(@,—62)1, — (B.13b) Powers: For any positive integer n, £ = (\e"" = [al"el" = [al"(cosnd + jsinn), 4) 2? 2 aja)'e2 = 41x\'7[00s(0/2) + j sin(6/2)). (B.15) APPENDIX B_ REVIEW OF COMPLEX NUMBERS 441 ee ‘Table B-1: Properties of complex numbers. ete sine x Euler's Identity: e” = cos + jsiné pei Sane: cos lale’® xiv x = Re(z) = [z} e054 ‘Im(2) = [z| sin ire z yamtin a =2piff.x; =s9 and yy = 92 ayn2 = [ail ln2le/+ bla var = ae @=tan|(y/x) aN? = ypl"i2Qi0/2 atin a ta = (x ta) + Jt 9) BIB gina nl (8.163) jaePP a1ae, (B.160) welt a eI = Am (B.16) Via (eV ase 20D B.160) _ 40- W SE: (B.16e) For quick reference, the preceding properties of complex ‘numbers are summarized in Table B-1. Note that if a complex ‘number is given by (a + jb) and b = 1, itcan be written either as (a+ j1) or simply as (a+ j). Thus, is synonymous with al Example B-1: Working with Complex Numbers Given two complex numbers V=3-i4 - 2+ j3). (a) Express V and I in polar form, and find (b) VI, (c) VI", (@) V/A, and (6) VI Solution: (a) Iv =v" = VG=jNBFI9 = VOFI6 by = tan "(—4/3) = ~53.1°, V = [Vie = SeI590" a 52580" W=VP+¥ = VB =361. ‘Since 1 = (—2— j3) is in the third quadrant in the complex plane (Fig. B-3], 123.77, 4 = -180° + tan! (3) 1=3612132 ‘Alternatively, whenever the real part of a complex number is, negative, we can factor out a (—1) multiplier and then use 442 Figure B- (Example B-1), omplex numbers V and I inthe complex plane Eq, (B.16a) to replace it with a phase angle of either +180" ‘or ~ 180°, as needed. In the case of I, the process is as follows: 1-2-3 (2+ j3) etl, TER ele 'am 361! ete Since our preference is to end up with a phase angle within the range between —180° and +180°, we will choose —180°, Hence, T= 3.616718 ) VI = GA8193.61212372) = 5 x 3.61) 2081-137) = 18.05.1768 APPENDIX B_ REVIEW OF COMPLEX NUMBERS © VI" = 50-5" 5 3616/87 = 18.050, @ © Mi=v361e SB AVTEL eC MBT = 41 90 ¢7 18185" Exercise B-1: Express the following complex functions in polar form: n= 4-73)", n= (6-j9!2, Answer: 2) = 25437, ty = V5 A184, (See @) Exercise B-2: Show that /2j = (1+ j). (See) Mathematical Formulas C-1 Trigonometric Relations sin.x = £cos(x #90") cos.x = sin(x ++ 90°) sin(x + 180°) cos.x = —cos(x + 180°) cos? x = 5 (1 + 60828) sin(x + y) = sin.xcos y + cos.xsin y ccos(x + y) = cos x cos y = sin.x sin y 2sin.x sin y = cosCr — y) —coste + y) 2sin.x eos y = sin(x + y) + sin¢x — y) 2eos.x cos y = cos(x + y) + e0s(r = y) sin 2x = 2sinx osx cos2x = 1 = 2sin? x sins +siny = sin) eos (55 cos. + eos = 2eos (“5% cos (2 cove cosy =-2sin (“E2) sin (= 2 ei =cosx+jsinx (Euler's identity) 2 tek cor cost + sin? 2 rad = 360° rad = 57.30° C2. Indefinite Integrals (q@ and b are constants) Uae oor ac= + sax f dre t oe fincac=sinx—x fore=fen [eetas= S ws? 20042 APPENDIX MATHEMATICAL FORMULAS Peosaxax sinax “ of sinbx dx = (asinbx — beosbs! / ae e fe cose (acosbx + bsinbx) [esi ex ar= e w cytes [(esinde ~ 2b ond) sinbr + 2 ae [« rere Z| [ecateeas= fee se aieap [Wonoes2bsinon ower] sina bx sina tOx a aig 2a=b) a+b) [owerasbr ca bx | sina+ bey a+b) fsmescsbs d= = Se =bx _cosla tb a a yp Zab) 2a+o) USE ee ay “aaa ta C-3._ Definite Integrals (m and m are integers) max dx = f costnx dx = = a= footncde=2 ffsinnesinms dx =0, nm sin nxcosnx dx =0 sin nx cosms dx =0 See, Ge, [Sinn osm de = [BB and a C-4 Approximations for Small Quantities For |x| <1, (tay 1tax C-5_POLAR-RECTANGULAR FORMS. C-5 Polar-Rectangular Forms R Vier altars ~ltx oe Ind +4) = een iat fore #1 for [tl <1 Ag@Pp P EN D X MATLAB® and NI LabVIEW MathScript RT Module A Short Introduction for Use in Signals and Systems D-1 Background “A computer will always do exactly what you tell ito do. But that may not be what you had in mind”—a quote from the 1950s, ‘This Appendix isa shor introduction to The MathWorks, Inc. MATLAB®” and MathScript RT Module for this book. Itis not comprehensive; only commands direcily applicable to signals and systems are covered. Nocommands in any of MATLAB's® ‘Toolboxes are included, since these commands are not included, in basic MATLAB® or MathScript RT Module. Programming ‘concepts and techniques are not included, since they are not used anywhere in this book. MATLAB® MATLAB® is a computer program developed and sold by the ‘MathWorks, Inc. It is the most commonly used program in signal processing, bu itis also used in all fields of engineering. “MATLAB®” is an abbreviation for MATrix LABoratory. It was originally based on a set of numerical linear algebra programs, written in FORTRAN, called LINPACK. So MATLAB® tends o formulate problems in terms of vectors and arrays of numbers, and often solves problems by formulating them as linear algebra problems, *MATLAB® isa registered trademark of The MathWorks, Ie. MathScript RT Module ‘MathScript RT Module is a computer program developed and sold by National Instruments, as a module in LabVIEW. The basic commands used by MATLAB® also work in MathSeript RT Module, but higher-level MATLAB® commands, and those in Toolboxes, usually do not work in MathSeript RT Module, Unless otherwise noted, all MATLAB® commands used in this book and CD also work in MathScript RT Module. ‘A student version of MathScript RT Module is included on the CD accompanying the book. Access to MATLAB® is not required to use this book. In this sequel, we use “M/M” to designate “MATLAB® or MathScript RT Module.” Getting Started ‘To install the student version of MathScript RT Module included ‘on this CD, follow the instructions. When you run M/M, a prompt >> will appear when it is ready. Then you can type commands. Your first command shouldbe >>ca mydirectory, tochange directory to your working directory, which we call “mydirectory” here. We will use this font to represent typed commands and ‘generated output. You can get help for any command, such a plot, by typing at the prompt help plot. Some basic things to know about M/M: ‘© Inserting a semicolon "at the end of a command ‘Suppresses the output; without it MIM will ype the results of the computation. This is harmless, but itis irritating to have numbers flying by on your screen. D-2_ BASIC COMPUTATION 447 « Inserting ellipses “...”" at the end of a command means it is continued on the next line. This is useful for long commands, ‘Inserting "%" at the beginning of a line makes the line a comment; it will not be executed. Comments are used to explain what the program is doing at that point. ‘¢ clear eliminates all present variables. Programs should start with a clear. ‘¢ whos shows all variables and their sizes. ‘¢ MIM variables are case-sensitive: ¢ and are different variables, ¢ cave myfile X,Y saves the variables x and ¥ in the file myfile.mat for use in anothersession of M/M at another time, © Load my£ile loads all variables saved in myfile.mat, ‘0 they an now be used in the present session of M/M, ‘» quit ends the present session of M/M. m Files ‘An MM program is alist of commands executed in suecession, Programs are called “m-files” since their extension is ".m.” or “seripts.” ‘To write an am file, at the upper left, click: File > New —> m-file This opens a window with a text editor. ‘Type in your commands and then type: File > Save as myname.m Make sure you save it with an mextension. Then you can run the file by typing its name atthe prompt: >> myname. Make sure the file name is not the same as a MATLAB® command! Using your own name is a good idea, You can access previously-typed commands using uparrow ‘and downarrow on your keyboard, ‘To download a fle from a web site or the CD. right-click on it, select save target as, and use the menu to select the proper file ype (specified by its file extension). D-2 Basic Computation D-2.1 ‘© Addition: 3+2 gives ans=5 Basic Arithmetic Subtraction: 2 gives ans=1 ‘© Multiplication: 2°53 gives ans= « Division: 6/2 gives ans=3 © Powers: 7 gives ans=8 © Others: sin, cos, tan, exp, log, log10 ‘© Square root: art (49) gives an: Conjugate: conj (3+25) gives ans=3-24 Both & or 5 represent /=T; answers use i. pi represents sx. © does not represent 2.71828, D-2.2 Entering Vectors and Arrays ‘Tocenter row vector [1 23] and store i in type atthe prompt As(1 2 3); 0rA=(1,2,3]; To ener the same numbers as @ column vector and store it in A, type at the prompt either A=(1:2:3); or A=(1 2 3);a=A'; Note R=A’ replaces A wit its transpose “Transpose” means “convert rows to columns, and vice-versa Toentera vector of consecutive or eqully-spaced numbers, follow these examples: © (2:6) givesans=2 3.45 6 © (3:2:9] givsans=3 5.7 9 © (4:-1:1] gives ans=4 3 2 1 To enter an array or matrix of numbers, type, for example, Be[3 1 4;1 5 952 6 5. gives the array 5 and its transpose B 314 312 B=|159) a’ =|156 265, 495 Other basies of arrays: @ ones (M,N) isan M x N array of “1” © eros (M,N) isan M x N array of “0” ‘¢ Length (X) gives the length of vector x ‘© size (xc) gives the size of array For B above, size (B) gives ans=3 3 © A(Z,J) gives the (IJjth element of A. For 8 above, 5(2,3) gives ani 448. APPENDIX D_MATLAB® AND NILABVIEW MATHSCRIPT RT MODULE D-23 Array Operations ‘Arrays add and subtract point-by-point: M=(3 1 4]; Y=[2 7 3];X+¥givesans-5 8 7 But XY generates an error message. ‘To compute various types of vector products ‘© To multiply element-by-element, use x. *Y This gives ans=6 7 12, To divide clement-by-clement, type x./¥ © To find the inner product of x and vy G)Q)+NT+AVA)=25, use °" This gives ans=25 1 To find the outer product of x and ¥ AQ OM HEY (DQ AM (HE) wse xv HQ) HM HE), This zives the above matrix. ‘A common problem is when you think you have a row vector when in fact you have a column vector. Check by’ using size (x); in the present example, the command gives ans=1, 3 which tells you that x isa 1 x 3 (row) vector. ‘© The following functions operate on each element of an array separately, giving another array! sin, cos, tan, exp, log, log10, sqrt cos ({0:3]*pi) givesans=1 -1 1 -1 © To compute n? forn =0,1...5,use (0:5].~2 which gives ans=0 1 4 9 16 25 ‘© To compute 2" forn = 0,1. 2.7[0:5] which gives ans= S,use 248 16 32 (Other array operations include: @As[1 2354.5 61;(A(:))* Stacks A by columns into a column veetor and transposes the result to a row vector. In the present example, the command gives ans=1 4.25 3 6 © reshape(A(:),2,3) Unstacks the column vector to a 2x3 array which, in this case, is the original array A, eMe(1 415 9 2 6 5) ;C=K(2:8)-x(1:7) ‘Takes differences of successive values of x. In the present example, the command givesC=3 3 4 4-7 4-1 @D=(1 23]; Ee[4 5 6]; F=[D B] ‘This concatenates the vectors D and E (ie, it appends E after D to get vector F) In the present example, the command gives 7=1 23.45 6 ‘¢ Te£ind (A>2) stores in T locations (indices) elements of vector A that exceed 2. find({3 1 41 5]<2) givesans=2 4 © A(A>2)=0 sets to 0 all values of elements of vector A exceeding 2, A=[3 1 4 1 5]; A(A<2)=0 gives ae30405 ‘MIM indexing of arrays starts with 1, while signals and systems indexing starts with 0. For example, the DET is defined using index n = 0,1... ~1, fork =0,1....N — 1 ££ (2), which computes the DFT of ¥, performs Eft (x) =X*exp (—j*2*pi* [02N-1] /*(0:N-1]/N); D-2.4 Solving Systems of Equations bAb]-Bl 17139] ;X=A\y:x" using gives ans=5.000 6.000, which isthe solution [xy To solve the complex system of equations 1+2/344j)[x] _ [16 +327 S46) 748), 48 +64), [1425 3445;5+6j 7+8]1\[16+325 ;48+6431 gives 2-21 ans=¢ 4 2" which isthe solution, ‘These systems can also be solved using inv (A) *Y, but we do not recommend it because computing the matrix inverse of ‘takes much more computation than just solving the system of ‘equations. Computing a matrix inverse can lead to numerical difficulties for large matrices. D3_ PLOTTING D-3. Plotting D-3.1 Plotting Basics Toplot function x() fora << b # Generate, say, 100 values of 1 in a .1-45) ; (V+. S41j) .* (V4. 5-14) .* (V4 .5435); (V+. 5-34) .* (V4. 5455) .* (V4 .5-55) plot (Wi,abs (N./D1./D2),‘r"),grid on generates the following figure: (©) Figure 6-38(b): ‘This example shows how to use a loop: Hi=H./ (V-P (I) ); is executed for 1=1,2,3, 4, 5 in succession, The following file clear;W=Linspace(-2,2, 1000) xp (j*2*pi* [3:7] /10) ; nes (1, 1000) ; for 1=1:5;H=H./(V-P(T)) ;end subplot (211) , plot (W, abs(H)) grid on generates the following figure: \ z if a z 2 4-0 0 wo + we D-4_ PARTIAL FRACTIONS (a) Figure 6-76: This example shows how to use bol to superpose two plots. how to plot individual points, use suinp2ot to change the aspect ratio of a figure, and axis tight to tighten it. It also uses [3:0.001:b], not Linspace (a,b, 1000). to sample every 0,001. The following m file ‘ri=[0:1/45000:1/45); X1=cos (2*pi"500°T2) ; 'r2=(0:1/450:1/451; x2=cos (2*pi*500*72) subplot (211) ,plot (72,2, 'or’) ,hold, subplot (211) ,plot (T1,X1),axis tight generates the following figure: ‘These do not include the computer examples, whose programs are listed elsewhere on this CD. D-4 Partial Fractions D-4.1 Rectangular-to-Polar Complex Conversion fan MIM results a complex number, then its presented in is rectangularformaib3. M/M recognizes both: and as V1, ‘so that complex numbers can be entered as 3+23 or 3+2i. To convert a complex number % to polar form, use abs (xt) angle (2) to get its magnitude and phase (in radians, respectively. To get its phase in degrees, use angle (x)*180/pi Note atan(imag(x) /rea2 (x)) will not give the correct phase, since this formula is onl valid if the rel paris positive. angie comets this. “The real and imaginary pats of are found using ro (x) and imag (%) respectively D-4.2 Polynomial Zeros ‘To compute the zeros of a polynomial, enter its coefficients as @ row Yector P and use R=roots (P). For example, t0 find the zeros of 3x° — 21:+18 the roots of 3x? — 21+18=0) use P=[3 0 -21 18];R=roots(P):R’, giving ans= ~3.0000 2.0000 1.0000, which are the roots. “To find the monic (leading coefficient is one) polynomial from the values of its zeros, enter the numbers as a column vector ® and use P=poly(R). For example, to find the polynomial having (1,3,5} as its zeros, use Re[1;375];Pepoly(R), giving P=1 ~9 23 -15. The polynomial is therefore x3 — 9x? + 234-15 ‘Note that polynomial are stored as row vectors, and roots are stored as column vectors. Pole-zero diagrams are made using zplane, To produce the pole-zero diagram of type zplane({1 3 2], {1 5 61) is also plotted, as a dotted line. The unit circle |z|=1 D-4.3 Partial Fraction Expansions Partial fraction expansions are a vital part of signals and systems, and their computation is onerous (see Chapter 3), MIM computes partial fraction expansions using residue, Specifically, bos + bis“! +o + bu, He) = ee ie 9 = Gos ast bay has the partial fraction expansion (if M < ) Ri 4B spr His) =K + =P ‘The poles (pi) and residues {Ri} can be computed from coefficients {a;} and (bj) using Be by «.-byI:A=Lay ay ...ayy] IR P]=residue(B,A);(R P] ‘The residues (A) are given in column veetor , and poles (pi) are given in column vector P. 452 APPENDIX D ‘To compute the partial fraction expansion of 3s+6 WO = Syst use the command IR Pl=residue((3 6],[1 5 4]);[R P] aise] on= [F] te [=] em eine read of a aon s+a eT In practice, the poles and residues both often occur in ‘complex conjugate pairs. Then use Hos) Rel" + ReeP* = Rie" costor +0), R= [Riel and p=a + jor, to simplify the result. ‘To compute the partial fraction expansion of S47 Hs) use the command (R P]=residue((1 7], [1 8 25])71R This gives 10.5000 — 0.5000i —4.000 + 3.0007 0.5000 + 0.50004 —4.000 — 3.000%, from which we have 05 + j0.5 0.5 ~ j0.5 sree BOS ways ‘hich has the inverse Laplace transform it) = (0.5 — j0.5)e#" + 0.5 + 0.5)" From abs (0.5-0.53} ,angle(0.5-0.53), ) V2e~* cosa — 5 ‘Both A(t) expressions are valid for ¢ > 0. If H(S) is proper but not strictly proper, the constant K is, nonzero, It is computed using (R P K]=residue(B,A) ;[R P],x MATLAB® AND NI LABVIEW MATHSCRIPT RT MODULE since « has size different from R and P. ‘To find the partial fraction expansion of 248549 MO) = Ty 3s42 use the command IR P K=residue([1 8 9], [1 3 21);[R P] K 3-2 fa gives} |.x=1s0%= |], off Hs) = i] from which we ead ++ s¥2 Ren SHI Double poles are handled as follows To find the partial fraction expansion of 862 + 338+ 30 NO = Sys ised use the command IR Pl=residue({8 33 30], [1 5 8 41); sea 3 ar IR P] gives | 4-2], s0 R= ]4], P= |-2 |. We then 5-1 5 -1 read off Stats saa * Gra TST In practice, we are intrested notin an analytic expression for ‘h(2), but in computing f(t) sampled every T, seconds. These ‘samples can be computed directly from and P, for <1

You might also like