Chapter 1 Analysis of Discrete-Time Linear Time-Invariant Systems 1.1 Signals 1.1.1 Definitions and Notation A signal is a function: “signal” and “function” are synonymous. The two notions are the same, and we will be using them interchangeably. The historical reason for the existence of these two terms to denote the same thing is that “function” is the standard term from mathematics, whereas “signal” is an engineering term which originally was used to denote measurable physical quantities, like a voltage signal. Continuous-time (CT) or analog signals are: • defined for every value of time on an interval (possibly, an infinite interval), AND • take on values in an interval. A graph of a continuous-time function is shown in Fig. 1.1(a). Discrete-Time (DT) signals or sequences are defined only at integer values of time. A graph of a discrete-time function is shown in Fig. 1.1(b). To emphasize the difference between continuous time and discrete time, we will use n, instead of t, for discrete time. A digital signal or digital sequence is a DT signal which can take on only integer values. Fig. 1.1(c) is a digital signal which takes on only two different values (sometimes such signals are called binary signals). Sometimes, notation such as f : Z → R, is used to indicate that f is a discrete-time signal. Here, R is the set of all real numbers, i.e. the real line; Z is the set of all integers, {. . . , −2, −1, 0, 1, 2, . . .}. In order to completely understand this notation, it is important to recall that a function is a mapping from one set to another. A function is a RULE for producing a number in its range, given a number from its domain. It is helpful to think of a function as a block diagram shown in Fig. 1.2(a). WHAT IS A FUNCTION? 9 10 CHAPTER 1. ANALYSIS OF DISCRETE-TIME LINEAR TIME-INVARIANT SYSTEMS 0 −5 0 50 t 100 1 f1(n) 2 f(n) x(t) 5 1 0 0 (a) 2 n 0 −1 0 4 5 n (b) (c) Figure 1.1. (a) A continuous-time function. (b) A discrete-time function. (c) A digital function. a single number n, taken from the domain of f , D function f (a) A generic function. a single number f (n) in the range of f , R argument n, an integer value f (n) = n/3, a real number Function f = ”divide by 3” (b) Function f (n) = n/3. Figure 1.2. Functions as block diagrams. Example 1.1. The concept of function or signal has a straightforward programming analogy: you can think of a signal as a program that takes a single number as its input and produces another number as the output, for example, float divide_by_3(n) int n; { float x; x = n/3.0; return(x); } The function which performs division by three can be thought of as this module of code or a rule or an algorithm. Then you can call this subroutine from elsewhere, and evaluate it for a particular argument, for example, main() { ... x = divide_by_3(5); ... } 11 Sec. 1.1. Signals When you evaluate the function, you will be assigning to x a particular number, in this case, 5/3 (or approximately 5/3, modulo computer precision). So, a function is a procedure which takes in one number and produces another number. When we write R → R to describe continuous-time functions, we mean that continuoustime functions can take in any number on the real line and produce another number anywhere on the real line.1 Discrete-time functions, on the other hand, can only take in an integer number, but can produce a real number: Z → R. Digital functions take in an integer and produce an integer: Z → Z. Note the important distinction between a discrete-time signal f and its n-th sample f (n) which is a single number. Sometimes it is convenient to abuse this notation and refer to “signal f (n)”. In this case, it is implied that we are referring to a signal f defined for integer n. 1.1.2 Specifying a Signal There are many different ways to specify or represent a function. (a) formula, e.g. f (n) = n/3 for n = 0, 1, 2, 3, 4. (b) graphical representations (note that, for 2-D functions, surface plots and intensity f(n) 2 1 0 0 2 n 4 images can be very useful). (c) a list of all values for all arguments: n f(n) 0 0 1 1/3 2 2/3 3 1 4 4/3 (d) A vector in an N-dimensional space (see Fig. 1.3), which will be used for: • N-point signals 1 More generally, a continuous-time signal is described by I1 → I2 where I1 and I2 are two intervals on the real line. Similarly for DT signals and digital signals. 12 CHAPTER 1. ANALYSIS OF DISCRETE-TIME LINEAR TIME-INVARIANT SYSTEMS • periodic signals with period N. This is done by recording the N values of the signal f (n) as a column vector. We will typically denote vectors by boldface letters, thus, the vector corresponding to an N -point or an N -periodic signal f is f : f (0) f (1) f = . . .. f (N − 1) This approach is very important and will be emphasized throughout the course. It provides geometric intuition into many key theoretical results and helps turn complicated formulas and proofs into very natural, intuitive statements. For example, when signals are viewed as vectors in an N -dimensional Euclidean space, it turns out that the Discrete Fourier Transform is essentially a rotation in this space (see Fig. 1.3(b)). Parseval’s theorem therefore simply says that if you rotate a vector, you do not change its length. We will also occasionally treat random variables as vectors, to gain geometric insight into linear prediction and recursive estimation. 1.1.3 Properties of Signals Different types of functions require different processing tools. It will be important for us to know: is a function periodic or not? Is it finite duration? Is it bounded? Is its energy finite? (a) Periodicity. If f (n) = f (n+N ) for some fixed N and all n, we say that f is periodic with period N . For example, the function given by the formula f1 (n) = (−1)n , for all integer n, is periodic with period 2, as shown in Fig. 1.4, left (we assume heren that the signal (−2) , |n| ≤ 2 is extends infinitely in both directions). The function f2 (n) = 0, otherwise not periodic, as shown in Fig. 1.4, right. If f (n) = 0 outside of a finite interval, f is a signal of finite duration; otherwise, f is a signal of infinite duration. For example, the signal f1 (n) defined above is infinite duration; f2 (n) is finite duration. (b) Finite/infinite duration. of a signal f will be denoted E(f ). (A more standard notation which you will find in mathematics literature, is kf k22 .) The energy is defined as follows: (c) The energy E(f ) = +∞ X n=−∞ |f (n)|2 . (1.1) Sec. 1.1. Signals R3 % % % % " % "" " % " " % t x = x(1) (a) $ ' x(0) 13 x(2) $ ' F T (x2 ) R N s x1 %e es x % " 2 % " % "" " % " % " s ,T s, T l T F T (x1 l ) l TT l lT l T FT & % RN & % (b) Figure 1.3. (a) A vector space representation for N -point or N -periodic signals, with N = 3. (b) In this framework, the Fourier transform is very similar to a rotation: it preserves distances and angles. 5 f2(n) f1(n) 1 0 −1 0 5 n 0 −5 −4−2 0 2 4 n Figure 1.4. A periodic signal (left) and a nonperiodic signal (right). The absolute value needs to be in the definition, for the case when f (n) is complexvalued. For example, the energy of f1 is 1 + 1 + 1 + . . ., which is infinite. The energy of f2 5 is (1/4)2 + (−1/2)2 + 12 + (−2)2 + 42 = 21 16 . [An important remark here is that, since we will often be dealing with sums of the type: 1 + q + q2 + . . . , 14 CHAPTER 1. ANALYSIS OF DISCRETE-TIME LINEAR TIME-INVARIANT SYSTEMS it is useful to remember the formulas for summing the geometric series: If m, N ∈ Z and 0 ≤ m < N, then q m + q m+1 + . . . + q N −1 = and, if 0 < |q| < 1, then ∞ X qn = n=m qm − qN 1−q qm . 1−q To verify the first formula, multiply both sides by 1 − q and cancel some terms on the lefthand side. To verify the second formula, take the limit of both sides of the first formula as N → ∞. (Why would the second formula not work for |q| ≥ 1?)] (d) The magnitude of a signal f is the maximum of its absolute value: M(f ) = max −∞<n<∞ |f (n)| (1.2) (Another notation for the magnitude of f is kf k∞ .) For example, the magnitude of f1 is 1; the magnitude of f2 is 4. If a signal has a finite magnitude, we say that it is bounded. 1.1.4 Special Signals 0.5 0 −4−2 0 2 4 n 1 u(n) δ(n) 1 0.5 0 −4 −2 0 2 4 n Figure 1.5. Unit sample (left) and unit step (right). There are several special signals which we will encounter very often. 1, n = 0 (a) Unit sample (or unit impulse), δ(n) = 0, n 6= 0 1, n ≥ 0 (b) Unit step, u(n) = 0, n < 0 (c) Sinusoids: sin(ωn + φ) or cos(ωn + φ). 15 Sec. 1.1. Signals cos(πt), cos(3πt), and cos(πn)=cos(3πn) 1 cos(2πn) = cos(0n) 1 0 0.5 0 −4 −2 0 2 4 −1 0 1 n 2 3 4 t,n Figure 1.6. Left: the DT frequency 2π is the same as the DT frequency zero. Right: adding 2π to the frequency does not change the DT signal. Apparent motion Actual motion Figure 1.7. 1.1.5 Peculiar Properties of DT Sinusoids (a) The highest rate of oscillation in a discrete-time sinusoid is attained when ω = π or ω = −π . For example, the DT frequency 2π is actually smaller than the DT frequency π. Indeed, since n is integer, we have: cos(2πn) = 1 = cos(0 · n), for all n. So, the DT frequency 2π is the same as the DT frequency 0! 16 CHAPTER 1. ANALYSIS OF DISCRETE-TIME LINEAR TIME-INVARIANT SYSTEMS (b) Discrete-time sinusoids whose frequencies differ by an integer multiple of 2π are identical: cos((ω + 2π)n + φ) = cos(ωn + φ). This is illustrated in Fig. 1.6, right. Notice that the continuous-time signals cos(πt) and cos(3πt) are the same at integer points. So, if we sample either of these signals at integer points, we will get the same signal: cos(π0) = cos(3π0) cos(π1) = cos(3π1) cos(π2) = cos(3π2) .. . cos(πn) = cos(3πn) for any integer n. More generally, cos((ω + 2π)n + φ) = cos((ωn + φ) + 2πn) = cos(ωn + φ)cos(2πn) − sin(ωn + φ)sin(2πn) = cos(ωn + φ) · 1 − sin(ωn + φ) · 0 = cos(ωn + φ) Even though the two continuous-time signals in Fig. 1.6, right, are different, their sampling at integer points is the same. The dashed continuous-time signal oscillates faster, but it all happens in between sampling instants. The sampling points so not see this activity. This is why two different continuous-time frequencies can appear to be the same discrete-time frequency. This phenomenon is called aliasing. You have all encountered aliasing when watching a movie. You must have noticed that sometimes a car moves in one direction, but its wheels seem to be rotating in the opposite direction. A simplistic picture of this is shown in Fig. 1.7. Between each pair of consecutive movie frames, the wheels rotate 270 degrees (three-quarters of one full revolution) which looks like a 90-degree rotation backwards. Suppose you are sampling a CT sinusoid x(t) at integer points n = 0, ±1, ±2, . . .. If x(0) = 1 as in Fig. 1.8(left) then, in order for the DT sinusoid x(n) to be periodic, it has to have a value of one again some time in the future. In Fig. 1.8(left), this happens at n = 5. From then on, the DT signal 4π will start repeating. For this particular example, 5 = 4π ω and so ω = 5 . (Even in the case when the DT sinusoid x(n) is periodic, its period may bedifferent from the period of x(t). Note that, while the fundamental period of cos 4π 5 t is 2.5, the fundamental n is 5.) period of cos 4π 5 But suppose now that ω = 1, as in Fig. 1.8(b). Then there is no value of n besides n = 0 for which x(n) = 1. So, the value of the sample x(0) will never repeat. As you can see, cos(6) is pretty close to 1: it is, in fact, approximately 0.96; however, there is no integer n except 0 for which cos(n) is exactly equal zero.2 (c) DT sinusoids are not necessarily periodic! 2 It is possible to show, however, that cos(n) can be arbitrarily close to zero. In other words, for any ε > 0, no matter how small, there exists a positive integer n for which cos(n) > 1 − ε. 17 Sec. 1.1. Signals cos(4πt/5), cos(4πn/5) cos(t), cos(n) 1 1 0 0 −1 0 1 2 3 t,n 4 5 6 −1 0 1 2 3 4 5 6 t,n Figure 1.8. Left: DT sinusoid whose frequency ω = 4π/5 is a rational multiple of π is periodic. Right: DT sinusoid whose frequency ω = 1 is not a rational multiple of π is not periodic. What should happen for the sampled signal to be periodic? An integer number of the continuous-time periods has to eventually become an integer. In other words, there must exist two integers k and m such that k · 2π ω = m · 1, i.e. the continuous-time period 2π must be a rational number. If this happens, then the sample at n = m will have the ω same value as the sample at n = 0, and the resulting sinusoid will be periodic. If this never happens, then no sample will ever have the same value as the sample at n = 0.