Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 1 DISCRETE-TIME SYSTEMS Contents CONTNUOUS-TIME AND DISCRETE-TIME SIGNALS DISCRETE-TIME SYSTEMS, DIGITAL SIGNAL PROCESSING BASIC OPERATIONS OF DISCRETE -TIME SYSTEMS DISCRETE TIME PROCESSES, SYMBOLS AND FUNCTIONS Introduction Basic Operations in Discrete Time Systems STANDARD CONFIGURATIONS NON-RECURSIVE – No feedback from output to input RECURSIVE - Feedback from output to input GENERAL FORM – Combination of Recursive and Non-Recursive Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 2 DISCRETE-TIME SYSTEMS CONTNUOUS-TIME AND DISCRETE-TIME SIGNALS A Continuous-Time or analogue signal is one which is defined at every point in an interval. v(t) AREA t1 t2 BASE A Discrete-Time signal is one which is defined only at discrete times (Instantaneous values). Such a sequence of values arises for example from the process of sampling a continuous-time signal. Discrete-time value v(nTS) t 0 0 1 TS 2 2TS 3 3TS 4 4TS 5 5TS 6 6TS v(nTS) are the discrete time values or instantaneous values of v(t) at the instants nTS, where TS is the sampling interval. Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 3 DISCRETE-TIME SYSTEMS, DIGITAL SIGNAL PROCESSING Discrete-time signals, denoted by x[n] for example, are signals defined only at discrete times. In practice a discrete-time signal is often formed by sampling a continuous-time signal at fixed intervals of time, TS, where TS is the sampling interval. This sampling forms a sequence of (instantaneous) values denoted by x(nTS). TS is the sampling interval, and n is the ‘sample number’ The discrete-time signal is encoded as a digital, binary signal representing the discrete-time signal, denoted eg as x[n], ie x[n] ≡ x(nTS). The conversion from an analogue to digital signal by sampling and encoding is called analogue-to-digital conversion (ADC). A digital-to-analogue converter (DAC) converts a digital signal to analogue, ie y[n] to y(t). An overall block diagram is illustrated below. Analogue x[n] x(t) Low Pass Filter ADC Digital y[n] Digital Signal Proc. DSP Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Analogue DAC Low Pass Filter y(t) Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 4 Example A signal v(t) = Vsinωt is sampled at a rate fS, starting at time t = 0, as illustrated below. Note that in this example there are 8 samples per cycle. v(2TS) v(t) V Sample values of v(t) at t = n TS. v(TS) 0 Time t -V Sample Pulses TS The sampled output is v(nTS). How do we calculate v(nTS)? v(nTS) are instantaneous values of v(t) at times t = nTS. Since v(t) = Vsinωt, at times t = nTS we may write: v(nTS) = Vsin(ω nTS). Now, since 2 , where T is the periodic time of the input signal, then, T 2nTs v(nTs ) V sin T Alternatively, 2nf v(nTs ) V sin fs (Either form can be useful). Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 5 Ts f 1 T fs 8 2n n v(nTs ) V sin V sin 8 4 In this example, with 8 samples per cycle, Calculating and tabulating values over 1 cycle: n 0 1 2 3 4 5 6 7 n 4 0 4 2 4 3 4 4 4 5 4 6 4 7 4 V(nTS) 0 0.7071V V 0.7071V 0 -0.7071V -V -0.7071V n V sin 4 Note that the sampled sequence v(nTS) represents the amplitude or instantaneous values of v(t) at the sampling instants. Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 6 BASIC OPERATIONS OF DISCRETE -TIME SYSTEMS DISCRETE TIME PROCESSES, SYMBOLS AND FUNCTIONS Introduction In discrete time or digital signal processing, discrete time values of a signal, usually in the form of binary numbers, are processed in a similar way to continuous time signals. Often the discrete time signal represents a continuous time signal, derived through a process of sampling and analogue-to-digital conversion, as illustrated below. y[n] x[n] Input x(t) ADC Discrete Time Process DAC Output y(t) Sampling Pulse Sample Rate fS Sampling Interval TS. The input and output signals are analogue or continuous time signals. The signals x[n] and y[n] are discrete time signals derived through sampling and ADC. Analogue-to digital conversion will be covered in a separate section. Some basic operations in discrete time systems are presented below. Basic Operations in Discrete Time Systems Some basic building blocks used in the ‘Discrete Time Process’ part of the above diagram are presented next. Delay x[n] TS x(nTS) Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 x[n – 1] x((n – 1)TS) Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 7 A delay, TS introduces a delay equal to the sampling interval (ie TS) We can think of this as ‘the current output is the previous input’. TS Example x[n] t = nTS x(nTS) n TS Delayed by TS x[n – 1] x((n – 1)TS) t = nTS n Delay elements may be cascaded thus: TS x[n] TS x[n – 1] TS x[n – 2] 3 stages of delay Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 x[n – 3] Staffordshire University Faculty of Computing, Engineering and Technology Signal Processing October 2005 Page 8 Addition of a Constant x[n] x[n] + a a TS a x[n] + a t = nTS n Summation of Sequences a[n] b[n] c[n] y[n] = a[n] + b[n] + c[n] + d[n] + e[n] d[n] e[n] Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 9 Scaling (Multiplication) x[n] y(t) = k x[n] k kx[n] eg k = 2 x[n] t = nTS n Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 10 EXERCISE Q1 Write a simple equation for each of the following systems. S1 (t) T 1 Vxdt T 0 SOUT S2 (t) Delay τ S3(t) TS a0 x[n – 2] x[n – 1] x[n] x[n – 3] TS a1 TS a2 a3 0.25 Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 11 Example A sequence x[n] as shown below is applied to the process also shown below. Determine the output sequence, y[n]. a0 = 2 x[n] y[n] TS a1 = 2 x[n-1] We can easily see: a1 = a2 = 2 Tabulate 2x[n] + 2x[n-1] y[n] = a1x[n] + a2x[n-1] n x[n] 0 0 1 1 2 2 3 4 4 8 5 0 6 0 7 0 n x[n] x[n-1] 0 0 - 1 1 0 2 2 1 3 4 2 4 8 4 5 0 8 6 0 0 7 0 0 y[n] - 2 6 12 24 16 0 0 Output Sequence y[n] = -, 0, 2, 12, 24, 16, 0, 0 Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 12 STANDARD CONFIGURATIONS NON-RECURSIVE – No feedback from output to input α0 x[n] α1 TS Σ α2 TS m=N-1 stages of delay α3 TS To next stage/s y[n] = α0x[n] + α1x[n-1] + α2x[n-2] + α3x[n-3] + α4x[n-4] + ……. y[n] N 1 i x[n i] i 0 Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 y[n] Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 13 Example Two term moving averager ½ Σ x[n] ½ TS y[n] = ½ x[n] + ½ x[n-1] ie y[n] x[n] x[n 1] 2 The output, y[n], is the average of the current and previous value of the input. In terms of instantaneous values, this is: y (nTs ) x(nTs ) x(( n 1)Ts ) 2 Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 y[n] Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 14 RECURSIVE - Feedback from output to input x[n] y[n] Σ α1 TS TS α2 α3 TS To next stage/s y[n] = x[n] + α1y[n-1] + α2y[n-2] + α3y[n-3] + ……. Example x[n] y[n] = x[n] + α1y[n-1] α1 TS Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 15 y[n] = x[n] + α1 y[n-1] But α1 y[n-1] = α1 x[n-1] + α1α1 y[n-2] and α12 y[n-2] = α12 x[n-2] + α13 y[n-3] etc, etc. ie y[n] = x[n] + α1x[n-1] + α12 x[n-2] + α13 x[n-3] + etc …. y[n] N 1 1i x[n i] i 0 Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 16 GENERAL FORM – Combination of Recursive and Non-Recursive a0 u[n] x[n] Σ y[n] Σ a1 TS TS TS a2 TS -α1 M stages N stages TS a3 -α2 -α3 y[n] = u[n] – α1y[n-1] – α2y[n-2] – α3y[n-3] - ….. - αMy[n-M] where u[n] = a0x[n] + a1x[n-1] + a2x[n-2] + … + aNx[n-N] y[n] = a0x[n] + a1x[n-1] + a2x[n-2] + .. + + aNx[n-N] - α1y[n-1] – α2y[n-2] – α3y[n-3] - ….. – αMy[n-M] y[n] N M a x [ n i ] i k y[n k ] i 0 k 1 This is called the Recurrence equation or Linear Difference equation. Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 TS Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 17 Exercise Q1. A sequence for x[n] has binary numbers representing the following decimal values: n x[n] 0 0 1 10 2 3 3 13 4 6 5 11 6 4 n x[n] 9 7 10 0 11 9 12 2 13 12 14 5 15 14 7 9 8 1 i) Sketch x[n] as a function of n to represent the sequence. ii) If y[n] = 1 {x[n ] x[n 1]} 2 calculate and tabulate y[n] and sketch y[n] as a function of n. Q2. a) A continuous-time signal v(t) = V + V cos t is sampled at a rate such that there are N = 8 samples per cycle, with the first sample coinciding with the maximum value of v(t), to give a discrete-time sequence v[n]. i) Show that the sample values may be expressed by: n 2f v[n] V V cos fS ii) b) c) Tabulate the values of v[n] over 1 cycle of v(t). [3 Marks] [3 Marks] Using delay, multiplier and summing elements: i) Give an equation for the average over N values [3 Marks] ii) Draw a block diagram for a ‘two-term moving averager’, ie to give an output y[n] corresponding to moving average of 2 sample values, v[n]. [3 Marks] iii) Calculate the two-term moving average over one cycle of v(t). [3 Marks] Determine the normalized average power of the sample values over 1 cycle. [5 Marks] Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Q3. a) Page 18 A discrete-time process is shown in figure Q3. x[n] a TS a 0 TS a 1 2 Figure Q3 y[n] Write an equation for the output sequence, y[n]. b) A sequence for x[n] has the following values: n -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 x[n] 0 0 0 10 10 10 5 15 10 20 5 0 2 4 6 8 i) Sketch x[n] as a function of n to represent the sequence. ii) If a0 = 0.25, a1 = 0.5, a2 = 0.25 calculate and tabulate y[n] and sketch y[n] as a function of n for n 0. Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005 Staffordshire University Faculty of Computing, Engineering and Technology October 2005 Signal Processing Page 19 Exercise. The equation for a simple non-recursive digital filter is given by: y ( nTs) 1 [x ( nTs) x (( n 1)Ts)] 2 where Ts is the sampling interval and x(nTs) and y(nTs) represent the sampled input and output values respectively. a) Draw a block diagram of the elements to produce the equation. b) If the input analogue signal is, [3 Marks] x ( t ) A sin t A sin 2 t T show that the input sampled sequence may be expressed by: x ( nTs ) A sin c) 2nTs T [2 Marks] Hence show that the output may be represented by: y ( nTs) A cos Ts T sin Ts T ( 2n 1) [6 Marks] d) If the sample rate is fixed at fs = 2 kHz, i) Determine equations for the gain and phase as a function of the input frequency. [5 Marks] ii) Sketch the filter amplitude/frequency and phase/frequency response for input signals in the range 0 to 1 kHz. [4 Marks] Signal Analysis and Representation / Discrete-Time Systems / Sept. 2005