1.SAMPLING AND RECONSTRUCTION The input spectrum X()consists of two sharp spectral lines at frequencies and 2,as can be seen by taking the Fourier transform of x(t): X(2)=2πA1δ(2-21)+2πA2δ(2-22) The corresponding output spectrum Y()is obtained from Eq.(1.2.4): Y(2)=H(2)X(2)=H(2)(2πA16(2-21)+2πA2δ(2-22)) =2πA1H(21)6(2-21)+2TA2H(22)6(2-22) What makes the subject of linear filtering useful is that the designer has complete control over the shape of the frequency response H()of the filter.For example,if the sinusoidal component represents a desired signal and 2 an unwanted interference then a filter may be designed that lets pass through,while at the same time it filters out the 2 component.Such a filter must have H()=1 and H(2)=0. 1.3 Sampling Theorem Next,we study the sampling process,illustrated in Fig.1.3.1,where the analog signal x(t)is periodically measured every T seconds.Thus,time is discretized in units of the sampling interval T: t=nT,n=0,1,2,.. Considering the resulting stream of samples as an analog signal,we observe that the sampling process represents a very drastic chopping operation on the original signal x(t),and therefore,it will introduce a lot of spurious high-frequency components into the frequency spectrum.Thus,for system design purposes,two questions must be answered: 1.What is the effect of sampling on the original frequency spectrum? 2.How should one choose the sampling interval T? We will try to answer these questions intuitively,and then more formally using Fourier transforms.We will see that although the sampling process generates high frequency components,these components appear in a very regular fashion,that is,ev- ery frequency component of the original signal is periodically replicated over the entire frequency axis,with period given by the sampling rate: 6= (1.3.1) This replication property will be justified first for simple sinusoidal signals and then for arbitrary signals.Consider,for example,a single sinusoid x(t)=e2mift of frequency f.Before sampling,its spectrum consists of a single sharp spectral line at f.But after sampling,the spectrum of the sampled sinusoid x(nT)=e2mifnT will be the periodic replication of the original spectral line at intervals of fs,as shown in Fig.1.3.2
4 1. SAMPLING AND RECONSTRUCTION The input spectrum X(Ω) consists of two sharp spectral lines at frequencies Ω1 and Ω2, as can be seen by taking the Fourier transform of x(t): X(Ω)= 2πA1δ(Ω − Ω1)+2πA2δ(Ω − Ω2) The corresponding output spectrum Y(Ω) is obtained from Eq. (1.2.4): Y(Ω) = H(Ω)X(Ω)= H(Ω) 2πA1δ(Ω − Ω1)+2πA2δ(Ω − Ω2) = 2πA1H(Ω1)δ(Ω − Ω1)+2πA2H(Ω2)δ(Ω − Ω2) What makes the subject of linear filtering useful is that the designer has complete control over the shape of the frequency response H(Ω) of the filter. For example, if the sinusoidal component Ω1 represents a desired signal and Ω2 an unwanted interference, then a filter may be designed that lets Ω1 pass through, while at the same time it filters out the Ω2 component. Such a filter must have H(Ω1)= 1 and H(Ω2)= 0. 1.3 Sampling Theorem Next, we study the sampling process, illustrated in Fig. 1.3.1, where the analog signal x(t) is periodically measured every T seconds. Thus, time is discretized in units of the sampling interval T: t = nT, n = 0, 1, 2,... Considering the resulting stream of samples as an analog signal, we observe that the sampling process represents a very drastic chopping operation on the original signal x(t), and therefore, it will introduce a lot of spurious high-frequency components into the frequency spectrum. Thus, for system design purposes, two questions must be answered: 1. What is the effect of sampling on the original frequency spectrum? 2. How should one choose the sampling interval T? We will try to answer these questions intuitively, and then more formally using Fourier transforms. We will see that although the sampling process generates high frequency components, these components appear in a very regular fashion, that is, every frequency component of the original signal is periodically replicated over the entire frequency axis, with period given by the sampling rate: fs = 1 T (1.3.1) This replication property will be justified first for simple sinusoidal signals and then for arbitrary signals. Consider, for example, a single sinusoid x(t)= e2πjf t of frequency f . Before sampling, its spectrum consists of a single sharp spectral line at f . But after sampling, the spectrum of the sampled sinusoid x(nT)= e2πjfnT will be the periodic replication of the original spectral line at intervals of fs, as shown in Fig. 1.3.2.
1.3.SAMPLING THEOREM 5 ideal sampler analog x() x(nT) sampled signal AT signal x(nT) 0T2T◆··nT Fig.1.3.1 Ideal sampler. frequency f-3f-2f5 f f+5f+2f+3新 Fig.1.3.2 Spectrum replication caused by sampling. Note also that starting with the replicated spectrum of the sampled signal,one can- not tell uniquely what the original frequency was.It could be any one of the replicated frequencies,namely,f'=f+mfs,m =0,+1,+2,....That is so because any one of them has the same periodic replication when sampled.This potential confusion of the original frequency with another is known as aliasing and can be avoided if one satisfies the conditions of the sampling theorem. The sampling theorem provides a quantitative answer to the question of how to choose the sampling time interval T.Clearly,T must be small enough so that signal variations that occur between samples are not lost.But how small is small enough?It would be very impractical to choose T too small because then there would be too many samples to be processed.This is illustrated in Fig.1.3.3,where T is small enough to resolve the details of signal 1,but is unnecessarily small for signal 2. signal 1 signal 2 Fig.1.3.3 Signal 2 is oversampled. Another way to say the same thing is in terms of the sampling rate fs.which is
1.3. SAMPLING THEOREM 5 t x(t) t T 0 T 2T nT x(nT) . . . x(t) x(nT) T analog signal sampled signal ideal sampler Fig. 1.3.1 Ideal sampler. f f-3f s f-2f s f-fs f f+fs f+2f s f+3f s . . . . . . frequency Fig. 1.3.2 Spectrum replication caused by sampling. Note also that starting with the replicated spectrum of the sampled signal, one cannot tell uniquely what the original frequency was. It could be any one of the replicated frequencies, namely, f = f + mfs, m = 0, ±1, ±2,... . That is so because any one of them has the same periodic replication when sampled. This potential confusion of the original frequency with another is known as aliasing and can be avoided if one satisfies the conditions of the sampling theorem. The sampling theorem provides a quantitative answer to the question of how to choose the sampling time interval T. Clearly, T must be small enough so that signal variations that occur between samples are not lost. But how small is small enough? It would be very impractical to choose T too small because then there would be too many samples to be processed. This is illustrated in Fig. 1.3.3, where T is small enough to resolve the details of signal 1, but is unnecessarily small for signal 2. t T signal 1 signal 2 Fig. 1.3.3 Signal 2 is oversampled. Another way to say the same thing is in terms of the sampling rate fs, which is
1.SAMPLING AND RECONSTRUCTION measured in units of [samples/sec]or [Hertz]and represents the "density"of samples per unit time.Thus,a rapidly varying signal must be sampled at a high sampling rate fs,whereas a slowly varying signal may be sampled at a lower rate. 1.3.1 Sampling Theorem A more quantitative criterion is provided by the sampling theorem which states that for accurate representation of a signal x(t)by its time samples x(nT),two conditions must be met: 1.The signal x(t)must be bandlimited,that is,its frequency spectrum must be limited to contain frequencies up to some maximum frequency,say fmax,and no frequencies beyond that.A typical bandlimited spectrum is shown in Fig.1.3.4. 2.The sampling rate fs must be chosen to be at least twice the maximum frequency fmax,that is, fs≥2fmax (1.3.2) or,in terms of the sampling time interval T 1 X(f) Jmax 0 Jmax Fig.1.3.4 Typical bandlimited spectrum. The minimum sampling rate allowed by the sampling theorem,that is,fs=2fmax,is called the Nyquist rate.For arbitrary values of fs,the quantity fs/2 is called the Nyquist frequency or folding frequency.It defines the endpoints of the Nyquist frequency inter- val: [- fss]=Nyquist Interval 2 The Nyquist frequency fs/2 also defines the cutoff frequencies of the lowpass analog prefilters and postfilters that are required in DSP operations.The values of fmax and fs depend on the application.Typical sampling rates for some common DSP applications are shown in the following table
6 1. SAMPLING AND RECONSTRUCTION measured in units of [samples/sec] or [Hertz] and represents the “density” of samples per unit time. Thus, a rapidly varying signal must be sampled at a high sampling rate fs, whereas a slowly varying signal may be sampled at a lower rate. 1.3.1 Sampling Theorem A more quantitative criterion is provided by the sampling theorem which states that for accurate representation of a signal x(t) by its time samples x(nT), two conditions must be met: 1. The signal x(t) must be bandlimited, that is, its frequency spectrum must be limited to contain frequencies up to some maximum frequency, say fmax, and no frequencies beyond that. A typical bandlimited spectrum is shown in Fig. 1.3.4. 2. The sampling rate fs must be chosen to be at least twice the maximum frequency fmax, that is, fs ≥ 2fmax (1.3.2) or, in terms of the sampling time interval: T ≤ 1 2fmax . fmax -fmax 0 f X(f) Fig. 1.3.4 Typical bandlimited spectrum. The minimum sampling rate allowed by the sampling theorem, that is, fs = 2fmax, is called the Nyquist rate. For arbitrary values of fs, the quantity fs/2 is called the Nyquist frequency or folding frequency. It defines the endpoints of the Nyquist frequency interval: −fs 2 , fs 2 = Nyquist Interval The Nyquist frequency fs/2 also defines the cutoff frequencies of the lowpass analog prefilters and postfilters that are required in DSP operations. The values of fmax and fs depend on the application. Typical sampling rates for some common DSP applications are shown in the following table
1.3.SAMPLING THEOREM 7 application fmax fs geophysical 500Hz 1 kHz biomedical 1 kHz 2 kHz mechanical 2 kHz 4 kHz speech 4 kHz 8 kHz audio 20 kHz 40 kHz video 4 MHz 8 MHz 1.3.2 Antialiasing Prefilters The practical implications of the sampling theorem are quite important.Since most signals are not bandlimited,they must be made so by lowpass filtering before sampling. In order to sample a signal at a desired rate fs and satisfy the conditions of the sampling theorem,the signal must be prefiltered by a lowpass analog filter,known as an antialiasing prefilter.The cutoff frequency of the prefilter,fmax,must be taken to be at most equal to the Nyquist frequency fs/2,that is,fmax sfs/2.This operation is shown in Fig.1.3.5. The output of the analog prefilter will then be bandlimited to maximum frequency fmax and may be sampled properly at the desired rate fs.The spectrum replication caused by the sampling process can also be seen in Fig.1.3.5.It will be discussed in detail in Section 1.5. nput spectrum prefiltered spectrum replicated refilter spectrum f o fR 0 n(0 analog x(t sampler x(nT) lowpass and 声to DSP analog prefilter bandlimited quantizer digital signal signal signal cutoff fmax=f /2 ratef Fig.1.3.5 Antialiasing prefilter. It should be emphasized that the rate fs must be chosen to be high enough so that, after the prefiltering operation,the surviving signal spectrum within the Nyquist interval [-fs/2,fs/2]contains all the significant frequency components for the application at hand. Example 1.3.1:In a hi-fi digital audio application,we wish to digitize a music piece using a sampling rate of 40 kHz.Thus,the piece must be prefiltered to contain frequencies up to 20 kHz.After the prefiltering operation,the resulting spectrum of frequencies is more than adequate for this application because the human ear can hear frequencies only up to 20 kHz. ▣
1.3. SAMPLING THEOREM 7 application fmax fs geophysical 500 Hz 1 kHz biomedical 1 kHz 2 kHz mechanical 2 kHz 4 kHz speech 4 kHz 8 kHz audio 20 kHz 40 kHz video 4 MHz 8 MHz 1.3.2 Antialiasing Prefilters The practical implications of the sampling theorem are quite important. Since most signals are not bandlimited, they must be made so by lowpass filtering before sampling. In order to sample a signal at a desired rate fs and satisfy the conditions of the sampling theorem, the signal must be prefiltered by a lowpass analog filter, known as an antialiasing prefilter. The cutoff frequency of the prefilter, fmax, must be taken to be at most equal to the Nyquist frequency fs/2, that is, fmax ≤ fs/2. This operation is shown in Fig. 1.3.5. The output of the analog prefilter will then be bandlimited to maximum frequency fmax and may be sampled properly at the desired rate fs. The spectrum replication caused by the sampling process can also be seen in Fig. 1.3.5. It will be discussed in detail in Section 1.5. analog lowpass prefilter analog signal digital signal to DSP bandlimited signal sampler and quantizer rate f cutoff s fmax = fs/2 -fs f f s 0 replicated spectrum f f s -f /2 s/2 0 prefiltered spectrum f 0 input spectrum prefilter xin(t) x(t) x(nT) Fig. 1.3.5 Antialiasing prefilter. It should be emphasized that the rate fs must be chosen to be high enough so that, after the prefiltering operation, the surviving signal spectrum within the Nyquist interval [−fs/2, fs/2] contains all the significant frequency components for the application at hand. Example 1.3.1: In a hi-fi digital audio application, we wish to digitize a music piece using a sampling rate of 40 kHz. Thus, the piece must be prefiltered to contain frequencies up to 20 kHz. After the prefiltering operation, the resulting spectrum of frequencies is more than adequate for this application because the human ear can hear frequencies only up to 20 kHz
8 1.SAMPLING AND RECONSTRUCTION Example 1.3.2:Similarly,the spectrum of speech prefiltered to about 4 kHz results in very intelligible speech.Therefore,in digital speech applications it is adequate to use sampling rates of about 8 kHz and prefilter the speech waveform to about 4 kHz. ▣ What happens if we do not sample in accordance with the sampling theorem?If we undersample,we may be missing important time variations between sampling instants and may arrive at the erroneous conclusion that the samples represent a signal which is smoother than it actually is.In other words,we will be confusing the true frequency content of the signal with a lower frequency content.Such confusion of signals is called aliasing and is depicted in Fig.1.3.6. aliased signal true signal 0 T 2T 3T 4T 5T 6T 7T 8T 9T 10T Fig.1.3.6 Aliasing in the time domain. 1.3.3 Hardware Limits Next,we consider the restrictions imposed on the choice of the sampling rate fs by the hardware.The sampling theorem provides a lower bound on the allowed values of fs. The hardware used in the application imposes an upper bound. In real-time applications,each input sample must be acquired,quantized,and pro- cessed by the DSP,and the output sample converted back into analog format.Many of these operations can be pipelined to reduce the total processing time.For example, as the DSP is processing the present sample,the D/A may be converting the previous output sample,while the A/D may be acquiring the next input sample. In any case,there is a total processing or computation time,say Tproc seconds,re- quired for each sample.The time interval T between input samples must be greater than Tproc;otherwise,the processor would not be able to keep up with the incoming samples.Thus, T≥Tproc or,expressed in terms of the computation or processing rate,fproc=1/Tproc,we obtain the upper bound fs s fproc,which combined with Eq.(1.3.2)restricts the choice of fs to the range: 2fmax≤fs≤fproc In succeeding sections we will discuss the phenomenon of aliasing in more detail, provide a quantitative proof of the sampling theorem,discuss the spectrum replication
8 1. SAMPLING AND RECONSTRUCTION Example 1.3.2: Similarly, the spectrum of speech prefiltered to about 4 kHz results in very intelligible speech. Therefore, in digital speech applications it is adequate to use sampling rates of about 8 kHz and prefilter the speech waveform to about 4 kHz. What happens if we do not sample in accordance with the sampling theorem? If we undersample, we may be missing important time variations between sampling instants and may arrive at the erroneous conclusion that the samples represent a signal which is smoother than it actually is. In other words, we will be confusing the true frequency content of the signal with a lower frequency content. Such confusion of signals is called aliasing and is depicted in Fig. 1.3.6. true signal t T T 2T 3T 4T 5T 6T 7T 8T 9T 10T aliased signal 0 Fig. 1.3.6 Aliasing in the time domain. 1.3.3 Hardware Limits Next, we consider the restrictions imposed on the choice of the sampling rate fs by the hardware. The sampling theorem provides a lower bound on the allowed values of fs. The hardware used in the application imposes an upper bound. In real-time applications, each input sample must be acquired, quantized, and processed by the DSP, and the output sample converted back into analog format. Many of these operations can be pipelined to reduce the total processing time. For example, as the DSP is processing the present sample, the D/A may be converting the previous output sample, while the A/D may be acquiring the next input sample. In any case, there is a total processing or computation time, say Tproc seconds, required for each sample. The time interval T between input samples must be greater than Tproc; otherwise, the processor would not be able to keep up with the incoming samples. Thus, T ≥ Tproc or, expressed in terms of the computation or processing rate, fproc = 1/Tproc, we obtain the upper bound fs ≤ fproc, which combined with Eq. (1.3.2) restricts the choice of fs to the range: 2fmax ≤ fs ≤ fproc In succeeding sections we will discuss the phenomenon of aliasing in more detail, provide a quantitative proof of the sampling theorem, discuss the spectrum replication