Chapter 2: Problem Solutions Discrete Time Processing of Continuous Time Signals Sampling à Problem 2.1. Problem: Consider a sinusoidal signal xt 3cos1000t 0.1 and let us sample it at a frequency Fs 2kHz. a) Determine and expression for the sampled sequence xn xnTs and determine its Discrete Time Fourier Transform X DTFTxn; b) Determine XF FTxt; c) Recompute X from the XF and verify that you obtain the same expression as in a). Solution: a) xn xt tnTs 3cos0.5n 0.1. Equivalently, using complex exponentials, xn 1.5ej0.1 ej0.5n 1.5ej0.1 ej0.5n Therefore its DTFT becomes j0.1 X DTFTxn 3ej0.1 2 3e 2 with b) Since FTej2F0 t F F0 then 2 Solutions_Chapter2[1].nb XF 1.5ej0.1 F 500 1.5ej0.1 F 500 for all F. c) Recall that X DTFTxn and XF FTxt are related as X Fs XF kFs FFs 2 k with Fs the sampling frequency. In this case there is no aliasing, since all frequencies are contained within Fs 2 1kHz. Therefore, in the interval we can write X Fs XF FFs 2 with Fs 2000Hz. Substitute for XF from part b) to obtain j0.1 2000 X 20001.5ej0.1 2000 2 500 1.5e 2 500 Now recall the property of the "delta" function: for any constant a 0, 1 t at a a Therefore we can write 3ej0.1 X 3ej0.1 2 2 same as in b). à Problem 2.2. Problem Repeat Problem 1 when the continuous time signal is xt 3cos3000t Solution Following the same steps: a) xn 3cos1.5n. Notice that now we have aliasing, since Fs F0 1500Hz 2 1000Hz. Therefore, as shown in the figure below, there is an aliasing at Fs F0 2000 1500Hz 500Hz. Therefore after sampling we have the same signal as in Problem 1.1, and everything follows. Solutions_Chapter2[1].nb 3 X (F ) 1 .5 1.5 F (kHz ) Fs X ( F kFs ) k 1 .5 0.5 0.5 F2s 1.0 Fs 2 1.5 F (kHz ) 1 .0 à Problem 2.3. Problem For each XF FTxt shown, determine X DTFTxn, where xn xnTs is the sampled sequence. The Sampling frequency Fs is given for each case. a) XF F 1000, Fs 3000Hz; b) XF F 500 F 500, Fs 1200Hz F c) XF 3rect 1000 , Fs 2000Hz; F d) XF 3rect 1000 , Fs 1000Hz; F3000 F3000 e) XF rect rect , Fs 3000Hz; 1000 1000 Solution For all these problems use the relation X Fs X Fs 2 kFs k k k 3000 2 a) X 3000 2 1000 k3000 2 3 k2; 4 Solutions_Chapter2[1].nb 1200 1200 b) X 1200 2 500 k1200 2 500 k1200 k 2 0 k2 0 k2 0 2 500 1200 1.2; k 20002 2000 k2 c) X 2000 3 rect k 1000 1000 6000 rect shown k k below. X ( ) 2 2 2 2 10002 1000 k2 d) X 1000 3 rect k 1000 1000 3000 rect 2 shown below k k X ( ) 2 2 300023000 3000 300023000 3000 e) X 3000 rect 1000 k 1000 rect 1000 k 1000 3 3 3000 rect 2 3 3k rect 2 3 3k k k2 6000 rect 23 k k shown below. X ( ) 6000 2 26 2 6 2 Solutions_Chapter2[1].nb 5 à Problem 2.4. Problem In the system shown, let the sequence be yn 2cos0.3n 4 and the sampling frequency be Fs 4kHz. Also let the low pass filter be ideal, with bandwidth Fs 2. s (t ) y[n] ZOH LPF y (t ) Fs a) Determine an expression for SF FTst. Also sketch the frequency spectrum (magnitude only) within the frequency range Fs F Fs ; b) Determine the output signal yt. Solution. From what we have seen, recall that 1 F SF ejFFs Fs sinc Fs Y 2FFs From Y 2 2 ej4 0.3 k2 ej4 0.3 k2 we obtain k Y 2FFs F F j4 2 ej4 2 Fs 0.3 k2 e Fs 0.3 k2 k Fs j4 F 600 k4000 2 2 e k F j4 e 2 Fs 600 k4000 and then 600k4000 SF Fs Ts ej600k40004000sinc ej4 F 600 k4000 4000 k 600k4000 F j600k40004000 j4 2 Ts e sinc 4000 e Fs 600 k4000 where we used the fact that the ZOH has frequency response Ts ejFFs sincF Fs . 6 Solutions_Chapter2[1].nb This can be simplified to 3 j4 F 600 k4000 20 sinc SF 1k ej 20 ke 3 3 j4 F 600 k4000 20 sinc 1 ej 20 ke k k 3 In the interval Fs 4000 F Fs 4000 we have only terms corresponding to k 1, 0, 1. The reader can verify that all other frequencies are outside this interval. Therefore, for 4000 F 4000 we have SF 0.17ej2.827F 3400 0.9634ej0.1 F 600 0.9634ej0.1 F 600 0.17ej2.827F 3400 shown below. | S (F ) | 5.6 3.4 0.6 3.4 5.6 F (kHz ) b) Since the Low Pass Filter stops all the frequencies above Fs 2 the output signal yt has only the frequencies at F 600Hz, and therefore yt IFT0.9634ej0.1 F 600 0.9634ej0.1 F 600 2 0.9634 cos1200t 0.1 à Problem 2.5. Problem We want to digitize and store a signal on a CD, and then reconstruct it at a later time. Let the signal xtbe xt 2cos500t 3sin1000t cos1500t Solutions_Chapter2[1].nb 7 x[n] x(t ) x[n] ZOH Fs LPF Fs and let the sampling frequency be Fs 2000Hz. a) Determine the continuous time signal yt after the reconstruction. b) Notice that yt is not exactly equal xt. How could we reconstruct the signal xt exactly from its samples xn? Solution a) Recall the formula, in absence of aliasing, F YF ejFFs sinc Fs XF with Fs 2000Hz being the sampling frequency. In this case there is no aliasing, since the maximum frequency is 750Hz smaller than Fs 2 1000Hz. Therefore, each sinusoid at frequency F has magnitude and phase scaled by the above expression. Define F sin 2000 e 2000 GF F 2000 jF which yields G250 0.9745ej0.392, G500 0.9003ej0.785, G750 0.784ej1.178 Finally, apply to each sinusoid to obtain. yt 2 0.9745 cos500t 0.392 3 0.9003 sin1000t 0.785 0.784cos1500t 1.178 b) In order to compensate for the distortion we can design a filter with frequency response 1 GF, Fs Fs when 2 F 2 .The magnitude would be as follows 8 Solutions_Chapter2[1].nb à Problem 2.6. Problem In the system shown below, determine the output signal yt for each of the following input signals xt. Assume the sampling frequency Fs 5kHz and the Low Pass Filter (LPF) to be ideal with bandwidth Fs 2: x[n] x(t ) ZOH Fs LPF y (t ) Fs a) xt ej2000t ; b) xt cos2000t 0.15; c) xt 2cos5000t; d) xt 2sin5000t; e) xt cos2000t 0.1 cos5500t. Solution Recall the frequency response, in case of no aliasing, is pF ÅÅÅÅ Sin ÅÅÅÅÅÅÅÅ 5000 ‰- ÅÅÅÅÅÅÅÅ ÅÅ Å jpF 5000 GF = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ pÅÅÅÅÅÅÅÅ F ÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ 5000 with 2500 F 2500. Then: a) G1000 0.935ej0.628 and then yt 0.935ej2000t0.628 b) Using the same number for 1000Hz we obtain yt 0.935 cos2000 t 0.15 0.628 c) G2500 0.637ej1.5708 , therefore yt 2 0.637cos5000t 1.5708 d) same: yt 2 0.637sin5000t 1.5708 Solutions_Chapter2[1].nb 9 e) the term cos2 2750 t has aliasing, since it has a frequency above 2500Hz. From the figure, the aliased frequency is X (F ) X ( F Fs ) 2.75 2.75 X ( F Fs ) F (kHz ) 2.75 5 2.25 Faliased 5.00 2.75 2.25kHz. Therefore it is as if the input signal were xt cos2000t 0.1 cos4500t. This yields G1000 0.935ej0.628 and G2250 0.699ej0.393 , and finally yt 0.935cos2000t 0.1 0.628 0.699cos4500t 1.41372 à Problem 2.7. Problem Suppose in the DAC we want to use a linear interpolation between samples, as shown in the figure below. We can call this reconstructor a First Order Hold, since the equation of a line is a polynomial of degree one. y[n] y[n] y (t ) y (t ) FOH Fs n Ts a) Show that yt xngt nTs , with gt a triangular pulse as shown below; n 10 Solutions_Chapter2[1].nb g (t ) Ts 1 Ts t b) Determine an expression for YF FTyt in terms of Y DTFTyn and GF FTgt; c) In the figure below, let yn 2cos0.8n , the sampling frequency Fs 10kHz and the filter be ideal with bandwidth Fs 2. Determine the output signal yt. y[n] FOH LPF y (t ) Fs Solution a) From the interpolation yt xngt nTs and the definition of the interpolating n function gt we can see that yt is a sequence of straight lines. In particular if we look at any interval nTs t n 1Ts it is easy to see that only two terms in the summation are nonzero, as yt xngt nTs xn 1gt n 1Ts , for nTs t n 1Ts This is shown in the figure below. Since g Ts 0 we can see that the line has to go through the two points xn and xn 1, and it yields the desired linear interpolation. Solutions_Chapter2[1].nb 11 y (t ) x[n]g (t nTs ) x[ n 1]g (t ( n 1)Ts ) nTs (n 1)Ts t Interpolation by First Order Hold (FOH) b) Taking the Fourier Transform we obtain YF FTyt xnGFej2FnTs GFX 2FFs n where GF FTgt. Using the Fourier Transform tables, or the fact that (easy to verify) 1 t t gt Ts rect Ts rect Ts F t F we determine GF Ts sinc Fs , since FTrect Ts Ts sinc Fs . 2 à Problem 2.8. Problem In the system below, let the sampling frequency be Fs 10kHz and the digital filter have difference equation yn 0.25xn xn 1 xn 2 xn 3 Both analog filters (Antialiasing and Reconstruction) are ideal Low Pass Filters (LPF) with bandwidth Fs 2. ADC x (t ) H ( z) LPF anti-aliasing filter y[ n ] x[ n] Ts Ts clock y( DAC ZOH Ts LPF reconstruction filter 12 Solutions_Chapter2[1].nb a) Sketch the frequency response H of the digital filter (magnitude only); b) Sketch the overall frequency response YF XF of the filter, in the analog domain (again magnitude only); c) Let the input signal be xt 3cos6000t 0.1 2cos12000t Determine the output signal yt. Solution. 1z , where a) The transfer function of the filter is Hz 0.251 z1 z2 z3 0.25 1z1 we applied the geometric sum. Therefore the frequency response is 4 sin2 1e H Hz zej 0.25 0.25 ej1.5 1ej sin j4 2 whose magnitude is shown below. b) Recall that the overall frequency response is given by YF F jFFs sinc XF H 2FFs e Fs In our case Fs 10kHz, and therefore we obtain YF XF 1.4 1.2 1 0.8 0.6 0.4 0.2 4000 2000 F 2000 4000 Solutions_Chapter2[1].nb 13 c) The input signal has two frequencies: F1 3kHz Fs 2, and F2 6kHz Fs 2, with Fs 10kHz the sampling frequency. Therefore the antialising filter is going to stop the second frequency, and the overall output is going to be yt 3 0.156 cos6000 t 0.1 0.1 0.467745 cos6000 t 0.62832 since, at F 3kHz, YF XF 0.156ej0.1 . Quantization Errors à Problem 2.9 Problem In the system below, let the signal xn be affected by some random error en as shown. The error is white, zero mean, with variance e2 1.0. Determine the variance of the error n after the filter for each of the following filters Hz: e[n] y[n] x[n] H (z ) e[n] H (z ) x[n] H (z ) [n] y[n] 14 Solutions_Chapter2[1].nb a) Hz an ideal Low Pass Filter with bandwidth 4; z b) Hz ; z0.5 1 sn sn 1 sn 2 sn 3, with sn xn en; c) yn 4 d) H e , for . Solution. Recall the two relationships in the frequency and time domain: 1 2 2 d 2 H 2 e hn 2 e2 1 a) 2 2 1 4 1 2 2 2 d 2 H e 2 d e 4 e ; 4 b) the impulse response in this case is hn 0.5n un therefore 1 4 2 2 hn 2 e2 0.52n e2 e2 10.25 3 e 0 1 c) in this case n 4 en en 1 en 2 en 3 . Therefore the impulse response is 1 hn 4 n n 1 n 2 n 3 and therefore 1 1 1 2 2 2 2 42 e 4 16 e 4 e 3 1 w 2 2 d) 2 d e 0.3045 e 2 e n0 à Problem 2.10. Problem A continuous time signal xt has a bandwidth FB 10kHz and it is sampled at Fs 22kHz, using 8bits/sample. The signal is properly scaled so that xn 128 for all n. a) Determine your best estimate of the variance of the quantization error e2 ; b) We want to increase the sampling rate by 16 times. How many bits per samples you would use in order to maintain the same level of quantization error? Solutions_Chapter2[1].nb Solution a) Since the signal is such that 128 xn 128 it has a range VMAX 256. If we digitize it with Q1 8 bits. we have 28 256 levels of quantization. Therefore each level has a range VMAX 2Q1 256 256 1. Therefore the variance of the noise is e2 1 12 if we assume uniform distribution. b) If we increase the sampling rate as Fs2 16 Fs1 , the number of bits required for the same quantization error becomes Fs1 1 log 1 4 6 bits sample Q2 Q1 2 Fs2 8 2 2 15