Discrete-time signals and systems 1
DISCRETE-TIME DYNAMICAL SYSTEMS x(t) G y(t) Linear system: Output y(n) is a linear function of the inputs sequence: y(n) = k= h(k)x(n k) h(k): impulse response of the system: Impulse x(0) = 1, x(n) = 0, n 0 gives y(n) = h(n), all n 2
Some terminology: Linear Time Invariant (LTI) System: Impulse response from input x(n k) to output y(n) does not depend on time n, but only on k Causal system: Output y(n) does not depend on future inputs, but only on present and past inputs x(n), x(n 1),..., (i.e., h(k) = 0, k < 0). y(n) = h(0)x(n) + h(1)x(n 1) + 3
Any process which transform a signal {x(n)} to another signal {y(n)} is a discrete-time system (for example, an audio signal is transformed by reflections, etc). Often a (linear) discrete-time system is designed in order to process a signal, for example to remove noise. Then we call such a system a digital filter. 4
DIGITAL FILTER TYPES FIR (Finite Impulse Response) filters - have finite memory; output depends only on a finite number of inputs - modeled by (weighted) moving average models y(n) = h(0)x(n) + h(1)x(n 1) + + h(n 1)x(n + 1 N) IIR (Infinite Impulse Response) filters - have infinite memory; output depends on an infinite number of (past) inputs - modeled by difference equations y(n) + a 1 y(n 1) + + a N y(n N) = = b 0 x(n) + b 1 x(n 1) + + b M x(n M) 5
Calculation of filter output FIR filters: The operation y(n) = h(0)x(n)+h(1)x(n 1)+ +h(n 1)x(n+1 N), n = 0, 1, 2,..., M between the impulse response sequence {h(k)} = {h(0), h(1),..., h(n 1)} and the input sequence {x(n)} = {x(0), x(1),..., x(m 1)} to give the output sequence {y(n)} = {y(0), y(1),...} is called convolution, and is often denoted as {y(n)} = {h(k)} {x(n)} Computational burden: calculation of output sequence requires N M flops 6
Efficient software for DSPs exist In Matlab: y = conv(h,x) or y = filter(h,1,x) (cf. below) 7
IMPORTANT PROPERTY: Convolution corresponds to polynomial multiplication: If we define the polynomials then we see that Ŷ (z) = y(0) + y(1)z 1 + + y(m 1)z M+1 ˆX(z) = x(0) + x(1)z 1 + + x(m 1)z M+1 H(z) = h(0) + h(1)z 1 + + h(n 1)z N+1 H(z) ˆX(z) ( ) = h(0)x(0) + h(0)x(1) + h(1)x(0) z 1 + ( ) + h(0)x(n) + h(1)x(n 1) + + h(n 1)x(n + 1 N) z n + = y(0) + y(1)z 1 + + y(m 1)z M+1 = Ŷ (z) 8
the convolution {y(n)} = {h(k)} {x(n)} can be represented as polynomial multiplication Ŷ (z) = H(z) ˆX(z) ˆX(z): z-transform of sequence {x(n)} Ŷ (z): z-transform of sequence {y(n)} H(z): transfer function of the system having impulse response h(0), h(1),... 9
Relation between convolution and polynomial multiplication leads to an efficient implementation of convolution FFT CONVOLUTION ( high-speed convolution ) The Fourier transform X(k) of {x(n)} is precisely a polynomial in z 1, with z = e j2πk/n : Recall the Fourier transform of {x(n)}: X(k) = x(0) + x(1)e j2πk/n + + x(n 1)e j2π(n 1)k/N = x(0) + x(1) (e j2πk/n) 1 + + x(n 1) (e j2πk/n) (N 1) Comparison with ˆX(z) shows that: X(k) = ˆX(z k ), z k = e j2πk/n Hence X(k) evaluates ˆX(z) at N points z k, k = 0, 1,..., N 1 10
Hence we can compute the convolution as follows: 1. Compute FFT X(k) of sequence {x(n)}. Then X(k) = ˆX(z k ), z k = e j2πk/n. 2. Compute FFT H(k) of sequence {h(n)}. Use zero padding to obtain sequences of the same length. Then H(k) = H(z k ), z k = e j2πk/n. 3. Compute Y (k) as the element-wise product Y (k) = H(k)X(k). Then Y (k) = Ŷ (z k), z k = e j2πk/n. 4. Compute inverse Fourier transform {y(n)} of {Y (k)}. Then {y(n)} is the convolution {y(n)} = {h(k)} {x(n)}
TRANSFER FUNCTIONS x(t) G y(t) In the z-transform domain, we have the simple relation Ŷ (z) = H(z) ˆX(z) where H(z) = h(0) + h(1)z 1 + 12
GENERAL LINEAR DISCRETE-TIME DYNAMICAL SYSTEMS General LTI systems can be described by a difference equation: y(n) + a 1 y(n 1) + + a N y(n N) = = b 0 x(n) + b 1 x(n 1) + + b M x(n M) Discrete-time counterpart of differential equations. Left-hand side is a convolution between the sequence 1, a 1,..., a N {y(n)}, or in the z-transform: and ( 1 + a1 z 1 + + a N z N) Ŷ (z) Right-hand side is a convolution between the sequence b 0,..., b M {x(n)}, or in the z-transform: and ( b0 + b 1 z 1 + + b M z M) ˆX(z) 13
( 1 + a1 z 1 + + a N z N) Ŷ (z) = ( b 0 + b 1 z 1 + + b M z M) ˆX(z) or, Ŷ (z) = b 0 + b 1 z 1 + + b M z M ˆX(z) 1 + a 1 z 1 + + a N z N Hence the system has transfer function Ŷ (z) = H(z) ˆX(z), H(z) = b 0 + b 1 z 1 + + b M z M 1 + a 1 z 1 + + a N z N 14
STABILITY Example: First-order system y(n) + ay(n 1) = bu(n) For the input {u(n)} = {1, 0, 0, 0,...} we have: y(0) = b (assuming y( 1) = 0) y(1) = ay(0) + bu(1) = ab y(2) = ay(1) + bu(2) = a 2 b. y(n) = ( a) n b y(n) 0 if as t if a < 1 system is stable y(n) as t if a > 1 system is unstable 15
Characterization of stability in terms of system transfer function: H(z) = b 1 az 1 A value p for which H(p) becomes infinite is called a pole of H(z). Here, p is the solution of 1 ap 1 = 0 p = a. System is stable if its pole p = a has absolute value p < 1 The results generalizes to higher-order systems: A linear discrete-time dynamical system with transfer function H(z) = b 0 + b 1 z 1 + + b M z M 1 + a 1 z 1 + + a N z N is stable if and only if all its poles, i.e. the solutions p i of the equation 1 + a 1 z 1 + + a N z N = 0 satisfy p i < 1 (i.e., they are inside the unit circle in the complex plane). 16
INTERCONNECTED SYSTEMS Using transfer functions, it is easy to analyze connected systems Example: Series connection. x(n) H 1 y 1 (n) H 2 y(n) Introducing z-transforms ˆX(z), Ŷ 1 (z), Ŷ (z) and transfer functions H 1 (z), H 2 (z) gives: Ŷ (z) = H 2 (z)ŷ1(z) = H 2 (z)h 1 (z) ˆX(z) = H(z) ˆX(z) Series connection has impulse response function {h(k)} with z-transform H(z) = H 2 (z)h 1 (z). But this is equal to the convolution {h(k)} = {h 2 (k)} {h 1 (k)}. Hence the impulse response of the series connection is obtained by a convolution of the individual impulse responses 17
Example: Time shift. Consider a time shift Then: y(n) = x(n l) Ŷ (z) = z l ˆX(z) In other words, if the signal {x(n)} has z-transform ˆX(z), then the timeshifted signal {x(n l)} has z-transform z l ˆX(z). z is a so-called shift operator. 18
Example: Feedback connection. Determine the output {y(n)} as function of the input {x(n)} in the following feedback connection: {x(n)} + {e(n)} G {y(n)} {r(n)} K where the system G is described by the difference equation y(n) 0.8y(n 1) = e(n) the K is described by r(n) 0.5r(n 1) = y(n 1) + 0.1y(n 2) 19
SOLUTION OF DIFFERENCE EQUATIONS BY THE Z-TRANSFORM In analogy with the the Laplace transform for differential equations, tabulated z-transforms can be applied to solve difference equations as follows: Problem: Determine the solution {y(n)} of the difference equation y(n) + a 1 y(n 1) + + a N y(n N) = for a given input sequence {x(n)}. = b 0 x(n) + b 1 x(n 1) + + b M x(n M) Solution: 1. Write the difference equation in the z-transform plane: Ŷ (z) = b 0 + b 1 z 1 + + b M z M ˆX(z) 1 + a 1 z 1 + + a N z N where ˆX(z) is the z-transform of the input sequence {x(n)}. 2. Solve for Ŷ (z) and find the corresponding sequence {y(n)} whose transform Ŷ (z) is. 20
The calculation of ˆX(z) in stage 1 and of sequence {y(n)} in stage 2 is facilitated by tabulated z-transforms for several common signals (Table 7.1). Example: z-transform of a signal The exponentially decaying signal x(n) = { 0, n < 0 a n, n 0 has z-transform ˆX(z) = x(n)z n = n=0 a n z n n=0 = 1 + az 1 + a 2 z 2 + = 1 + az 1 + (az 1 ) 2 + = 1 1 az 1 = z z a Compare with Table 7.1, line 5, with c = 1, e α = a. 21
Example: Solution of difference equation Consider the difference equation y(n) 0.75y(n 1) = x(n 1) with x(n) = { 0, n < 0 ( 0.5) n, n 0 Then: and (cf. above) Ŷ (z) = ˆX(z) = z 1 ˆX(z) 1 0.75z 1 1 1 + 0.5z 1 22
Hence, z 1 Ŷ (z) = 1 0.75z 1 A partial fraction expansion gives 1 1 + 0.5z 1 Ŷ (z) = 4/5 1 0.75z 1 4/5 1 + 0.5z 1 or z Ŷ (z) = 4 5 ( z z 0.75 z ) z + 0.5 By Table 7.1, z a is the z-transform of the sequence {an }. Hence the z-transform of the sequence Ŷ (z) is y(n) = 4 5 [0.75n ( 0.5) n ] which is the solution of the difference equation. 23