Discrete-time Processing of Continuous-time Signals (cf. Oppenheim, 1999) A major application of discrete-time systems is in the processing of continuous-time signals. The overall system is equivalent to a continuous-time system, since it transforms the continuous-time input signal xs(t) into the continuous time signal yr(t). Question: what is this equivalent system? Ideal discrete-to-continuous (D/C) converter Ideal reconstruction filter The ideal reconstruction filter is a continuous-time filter, with the frequency response being Hr(j) and impulse response hr(t). hr (t ) sin( t / T ) /(t / T ) From now on, we use to represent the transform domain of continuous Fourier transform. Continuous to discrete (C/D) converter s t t nT continuous F. T. k where s = 2/T xs t x(t ) s (t ) 2 S j T xc (t ) t nT k k k Time domain multiplication s C/D converter 1 X c ( j) S ( j) We have X s ( j) 2 Frequency domain convolution Hence, the continuous Fourier transforms of xs(t) consists of periodically repeated copies of the Fourier transform of xc(t). 1 X s j X c j k s where s = 2/T T k Review of Nyquist sampling theorem: Aliasing effect: If s > 2N, the copies of Xc(j) overlap, where N is the highest nonzero frequency component of Xc(j). N is referred to as the Nyquist frequency. Ideal C/D converter In the above, we characterize the relationship of xs(t) and xc(t) in the continuous F.T. domain. From another point of view, Xs(j) can be represented as the linear combination of a serious of complex exponentials: X s j since xs t jTn x nT e c n x nT t nT n c If x(nT) x[n], its DTFT is X (e jw ) jwn x [ n ] e n jwn x ( nT ) e n Input-output relationship of C/D converter Combining these properties, we have the relationship between the continuous F.T. and DTFT of the sampled signal: jw jT X s j X e w T X e where X c j : represent continuous F.T. X e jw : represent DTFT Thus, we have the input-output relationship of C/D converter X e jw w 2k 1 2k 1 X c j X c j T k T T k T T Combine C/D, discrete-time system, and D/C Consider again the discrete-time processing of continuous signals Let H(ejw) be the frequency response of the discrete-time system in the above diagram. Since Y(ejw) = H(ejw)X(ejw) Y e jT H e jT X e jT D/C converter revisited An ideal low-pass filter Hr(j) that has a cut-off frequency c= s/2 = /T and gain T is used for reconstructing the continuous signal. Frequency domain of D/C converter: (Hr(j) is its frequency response) Yr j H r jY e jT TY e jT , / T otherwise 0, Remember that the corresponding impulse response is a sinc function, and the reconstructed signal is sin t nT / T yr t yn t nT / T n Input-output Relationship for Discrete-time processing of continuous-time signals Assumption: If Xc(j) is band limited with Xc(j) = 0 for ||>/T, then and hence 1 jT X c j X e T jT jT TH e X e , /T jT Yr j H r j Y e 0, otherwise H e jT X c j , / T 0, otherwise Effective Frequency Response for Discrete-time processing of continuous-time signals So, if Xc(j) is band limited with Xc(j) = 0 for ||>/T, we have the following effective response for the entire system: Yr j H eff j X c j , jT H e , /T where H eff j /T 0, Effective Frequency Response It is important to emphasize that the LTI behavior of the system depends on two factors: First, the discrete-time system is LTI. Second, the input signal is band-limited, and the sampling rate is high enough so that any aliased components are removed. Discrete-time processing of continuoustime signals If we are given a desired continuous-time system with band-limited frequency response Hc(j), and we want to implement it by discrete-time processing, We can choose appropriate T and discrete-time filter satisfying H(ejw) = Hc(jw/T) to synthesize the continuous response Hc(j). Time-domain behavior of discrete-time processing of continuous-time signals In time domain Since H(ejw) = Hc(jw/T) |w| < In addition, Hc(j) = 0, ||>/T (band limited) We have the impulse invariance property, h[n]=Thc(nT), i.e., the impulse response of the discrete-time system is a scaled, sampled version of the continuous inpulse response hc(t). Remark: It is because that if h[n] Thc (nT ) w 2k H (e ) H c ( j ( )) T T k w jw and thus H (e ) H c ( j ) | w | since band limited. T jw Continuous-time processing of discrete-time signals On the other hand, we can also consider to process discretetime signal with continuous-time filters. Cascading D/C, continuous-time system, and C/D. From the definition of the ideal D/C converter, Xc(j) and therefore also Yc(j), will necessarily be zero for ||>/T. Continuous-time processing of discrete-time signals Ye jw 1 w Yc j T T | w | Yc j H c jX c j X c j TX e jT | | / T | | / T Hence, we have the effective system of the continuoustime processing of discrete-time signals to be H eff e jw w H c j , T w Changing the Sampling rate using discrete-time processing downsampling; sampling rate compressor; xd [n] xnM Frequency domain of downsampling Since this is a ‘re-sampling’ process. Remember that, from continuous-time sampling of x[n]=xc(nT), we have X e jw 1 w 2k X c j( ) T k T T Similarly, for the down-sampled signal xd[m]=xc(mT’), (where T’ = MT), we have X d e jw 1 w 2r X c j( ) T ' r T ' T ' Frequency domain of downsampling We are interested in the relation between X(ejw) and Xd(ejw). Let’s represent r as r = i + kM, where 0 i M1, (i.e., r i (mod M)). Then 1 w 2r jw X d e X c j( ) MT r MT MT 1 M 1 w 2k 2i X c j( ) T MT MT i 0 T k M 1 1 w 2i 2k X c j( ) X (e j ( w 2i ) / M ) T k MT T Frequency domain of downsampling Therefore, the downsampling can be treated as a ‘resampling’ process. It s frequency domain relationship is similar to that of the D/C converter as: Xd e jw 1 M M 1 X e j w 2i / M i 0 This is equivalent to compositing M copies of the of X(ejw), frequency scaled by M and shifted by inter multiples of 2. The aliasing can be avoided by ensuring that X(ejw) is bandlimited as 0 X e jw for wN | w | , and 2/M 2wN Example of downsampling in the Frequency domain (without aliasing) Sampling with a sufficiently large rate which avoids aliasing Example of downsampling in the Frequency domain (without aliasing) Downsampling by 2 (M=2) Downsampling with prefiltering to avoid aliasing (decimation) From the above, the DTFT of the down-sampled signal is the superposition of M shifted/scaled versions of the DTFT of the original signal. To avoid aliasing, we need wN</M, where wN is the highest frequency of the discrete-time signal x[n]. Hence, downsampling is usually accompanied with a pre-low-pass filtering, and a low-pass filter followed by down-sampling is usually called a decimator, and termed the process as decimation. Up-sampling Upsampling; sampling rate expander. : or equivalently, xn / L , n 0 , L , 2 L , ... xe n otherwise 0, xe n In frequency domain: xk n kL k ( x[k ] [n kL])e X e e jw n k jwn jwLk jwL ( x [ k ] e ) X e k Example of up-sampling Upsampling in the frequency domain Up-sampling with post low-pass filtering Similar to the case of D/C converter, upsampoling is usually companied with a post low-pass filter with cutoff frequency /L and gain L, to reconstruct the sequence. A low-pass filter followed by up-sampling is called an interpolator, and the whole process is called interpolation. Example of up-sampling followed by low-pass filtering Applying low-pass filtering Interpolation Similar to the ideal D/C converter, If we choose an ideal lowpass filter with cutoff frequency /L and gain L, its impulse response is sinn / L hi n n / L Hence xi n xe n hi n xk n kL hi n k sin n kL / L xk n kL / L k Its an interpolation of the discrete sequence x[k] Sampling rate conversion by a non-integer rational factor By combining the decimation and interpolation, we can change the sampling rate of a sequence. Changing the sampling rate by a non-integer factor T’ = TM/L. Eg., L=100 and M=101, then T’ = 1.01T. Changing the Sampling rate using discrete-time processing Since the interpolation and decimation filters are in cascade, they can be combined as shown above. Digital Processing of Analog Signals Pre-filtering to avoid aliasing It is generally desirable to minimize the sampling rate. Eg., in processing speech signals, where often only the lowfrequency band up to about 3-4k Hz is required, even though the speech signal may have significant frequency content in the 4k to 20k Hz range. Also, even if the signal is naturally bandlimited, wideband additive noise may fll in the higher frequency range, and as a result of sampling. These noise components would be aliased into the low frequency band. Over-sampled A/D conversion The anti-aliasing filter is an analog filter. However, in applications involving powerful, but inexpensive, digital processors, these continuous-time filters may account for a major part of the cost of a system. Instead, we first apply a very simple anti-aliasing filter that has a gradual cutoff (instead of a sharp cutoff) with significant attenuation at MN. Next, implement the C/D conversion at the sampling rate higher than 2MN. After that, sampling rate reduction by a factor of M that includes sharp anti-aliasing filtering is implemented in the discretetime domain. Using over-sampled A/D conversion to simplify a continuous-time anti-aliasing filter Example of over-sampled A/D conversion Example of over-sampled A/D conversion Sample and hold x0 (t ) x[n]h (t nT ) n 0 1 0 t T h0 (t ) 0 otherwise Example of sample and hold Quantizer (Quantization) The real-valued signal has to be stored as a code for digital processing. This step is called quantization. xˆ[n] Q( x[n]) The quantizer is a nonlinear system. Typically, we apply two’s complement code for representation. Quantizer (Quantization) Quantizer (Quantization) In general, if we have a (B+1)-bit binary two’s complement fraction of the form: a0 a1a2 ...aB 0 1 2 B a 2 a 2 a 2 ... a 2 then its value is 0 1 2 B 2 X m / 2 B 1 X m / 2 B The step size of the quantizer is where Xm is the full scale level of the A/D converter. The numerical relationship beween the code words and the quantizer samples is xˆ[n] X m xˆ B [n] Example of quantization Analysis of quantization errors Quantization error e[n] xˆ[n] x[n] In general, for a (B+1)-bit quantizer with step size , the quantization error satisfies that / 2 e[n] / 2 when ( X m / 2) x[n] ( X m / 2) If x[n] is outside this range, then the quantization error is larger in magnitude than /2, and such samples are saided to be clipped. Analysis of quantization errors Analyzing the quantization by introducing an error source and linearizing the system: The model is equivalent to quantizer if we know e[n]. Assumptions about e[n] e[n] is a sample sequence of a stationary random process. e[n] is uncorrelated with the sequence x[n]. The random variables of the error process e[n] are uncorrelated; i.e., the error is a white-noise process. The probability distribution of the error process is uniform over the range of quantization error (i.e., without being clipped). The assumptions would not be justified. However, when the signal is a complicated signal (such as speech or music), the assumptions are more realistic. Experiments have shown that, as the signal becomes more complicated, the measured correlation between the signal and the quantization error decreases, and the error also becomes uncorrelated. Example of quantization error original signal 3-bit quantization result 3-bit quantization error Example of quantization error 8-bit quantization error In a heuristic sense, the assumptions of the statistical model appear to be valid if the signal is sufficiently complex and the quantization steps are sufficiently small, so that the amplitude of the signal is likely to traverse many quantization steps from sample to sample. Quantization error analysis / 2 e[n] / 2 e[n] is a white noise sequence. The probability density function of e[n] is Quantization error analysis The mean value of e[n] is zero, and its variance is /2 2 1 e2 e 2 de 12 / 2 Xm Since B 2 For a (B+1)-bit quantizer with full-scale value Xm, the noise variance, or power, is 2 B 2 2 X m e2 12 Quantization error analysis A common measure of the amount of degradation of a signal by additive noise is the signal-to-noise ratio (SNR), defined as the ratio of signal variance (power) to noise variance. Expressed in decibels (dB), the SNR of a (B+1)-bit quantizer is x2 12 2 2 B x2 SNR 10 log 10 2 10 log 10 2 Xm e Xm 6.02 B 10.8 20 log 10 x Hence, the SNR increases approximately 6dB for each bit added to the world length of the quantized samples. Quantization error analysis The equation can be further simplified for analysis. For example, if the signal amplitude has a Gaussian distribution, only 0.064 percent of the samples would have an amplitude greater than 4x. Thus to avoid clipping the peaks of the signal (as is assumed in our statistical model), we might set the gain of filters and amplifiers preceding the A/D converter so that x = Xm/4. Using this value of x gives SNR 6B 1.25dB For example, obtaining a SNR about 90-96 dB in high-quality music recording and playback requires 16-bit quantization. But it should be remembered that such performance is obtained only if the input signal is carefully matched to the full-scale of the A/D converter.