1.4.SAMPLING OF SINUSOIDS 9 property,and consider the issues of practical sampling and reconstruction and their effect on the overall quality of a digital signal processing system.Quantization will be considered later on. 1.4 Sampling of Sinusoids The two conditions of the sampling theorem,namely,that x(t)be bandlimited and the requirement fs>2fmax,can be derived intuitively by considering the sampling of sinusoidal signals only.Figure 1.4.1 shows a sinusoid of frequency f, x(t)=cos(2πft) that has been sampled at the three rates:fs =8f,fs=4f,and fs 2f.These rates correspond to taking 8,4,and 2 samples in each cycle of the sinusoid. Fig.1.4.1 Sinusoid sampled at rates fs=8f,4f,2f. Simple inspection of these figures leads to the conclusion that the minimum ac- ceptable number of samples per cycle is two.The representation of a sinusoid by two samples per cycle is hardly adequate,but at least it does incorporate the basic up-down nature of the sinusoid.The number of samples per cycle is given by the quantity fs/f: samples/sec-samples f cycles/sec cycle Thus,to sample a single sinusoid properly,we must require s≥2 samples/cycle f →fs≥2f (1.4.1) Next,consider the case of an arbitrary signal x(t).According to the inverse Fourier transform of Eq.(1.2.3),x(t)can be expressed as a linear combination of sinusoids. Proper sampling of x(t)will be achieved only if every sinusoidal component of x(t)is properly sampled. This requires that the signal x(t)be bandlimited.Otherwise,it would contain si- nusoidal components of arbitrarily high frequency f,and to sample those accurately, we would need,by Eq.(1.4.1),arbitrarily high rates fs.If the signal is bandlimited to fIt also depends on the phase of the sinusoid.For example,sampling at the zero crossings instead of at the peaks,would result in zero values for the samples
1.4. SAMPLING OF SINUSOIDS 9 property, and consider the issues of practical sampling and reconstruction and their effect on the overall quality of a digital signal processing system. Quantization will be considered later on. 1.4 Sampling of Sinusoids The two conditions of the sampling theorem, namely, that x(t) be bandlimited and the requirement fs ≥ 2fmax, can be derived intuitively by considering the sampling of sinusoidal signals only. Figure 1.4.1 shows a sinusoid of frequency f , x(t)= cos(2πf t) that has been sampled at the three rates: fs = 8f , fs = 4f , and fs = 2f . These rates correspond to taking 8, 4, and 2 samples in each cycle of the sinusoid. fs = 4f f f s = 2f s = 8f Fig. 1.4.1 Sinusoid sampled at rates fs = 8f, 4f, 2f . Simple inspection of these figures leads to the conclusion that the minimum acceptable number of samples per cycle is two. The representation of a sinusoid by two samples per cycle is hardly adequate,† but at least it does incorporate the basic up-down nature of the sinusoid. The number of samples per cycle is given by the quantity fs/f : fs f = samples/sec cycles/sec = samples cycle Thus, to sample a single sinusoid properly, we must require fs f ≥ 2 samples/cycle ⇒ fs ≥ 2f (1.4.1) Next, consider the case of an arbitrary signal x(t). According to the inverse Fourier transform of Eq. (1.2.3), x(t) can be expressed as a linear combination of sinusoids. Proper sampling of x(t) will be achieved only if every sinusoidal component of x(t) is properly sampled. This requires that the signal x(t) be bandlimited. Otherwise, it would contain sinusoidal components of arbitrarily high frequency f , and to sample those accurately, we would need, by Eq. (1.4.1), arbitrarily high rates fs. If the signal is bandlimited to †It also depends on the phase of the sinusoid. For example, sampling at the zero crossings instead of at the peaks, would result in zero values for the samples
10 1.SAMPLING AND RECONSTRUCTION some maximum frequency fmax,then by choosing fs 2fmax,we are accurately sam- pling the fastest-varying component of x(t),and thus a fortiori,all the slower ones.As an example,consider the special case: X(t)=A1cos(2πft)+A2cos(2πf2t)+···+Amax Cos(2πfmaxt) where fi are listed in increasing order.Then,the conditions 2f≤2f2≤··≤2fmax≤fs imply that every component of x(t),and hence x(t)itself,is properly sampled. 1.4.1 Analog Reconstruction and Aliasing Next,we discuss the aliasing effects that result if one violates the sampling theorem conditions (1.3.2)or (1.4.1).Consider the complex version of a sinusoid: x(t)=elot =e2mift and its sampled version obtained by setting t=nT, x(nT)=eloTn =e2nifTn Define also the following family of sinusoids,form=0,±l,±2,, Xm(t)=e2mj(f+mfs)t and their sampled versions, Xm(nT)=e2nj(f+mfs)Tn Using the property fsT=1 and the trigonometric identity, e2njmfsTn =e2njmn =1 we find that,although the signals xm(t)are different from each other,their sampled values are the same;indeed, Xm(nT)=e2ni(f+mf)Tn =e2nifTne2nimf,Tn =e2nifTn =x(nT) In terms of their sampled values,the signals xm(t)are indistinguishable,or aliased. Knowledge of the sample values x(nT)=Xm(nT)is not enough to determine which among them was the original signal that was sampled.It could have been any one of the Xm(t).In other words,the set of frequencies, f,f±fs,f±2fs,,f±mf,… (1.4.2) are equivalent to each other.The effect of sampling was to replace the original fre- quency f with the replicated set(1.4.2).This is the intuitive explanation of the spectrum
10 1. SAMPLING AND RECONSTRUCTION some maximum frequency fmax, then by choosing fs ≥ 2fmax, we are accurately sampling the fastest-varying component of x(t), and thus a fortiori, all the slower ones. As an example, consider the special case: x(t)= A1 cos(2πf1t)+A2 cos(2πf2t)+···+ Amax cos(2πfmaxt) where fi are listed in increasing order. Then, the conditions 2f1 ≤ 2f2 ≤···≤ 2fmax ≤ fs imply that every component of x(t), and hence x(t) itself, is properly sampled. 1.4.1 Analog Reconstruction and Aliasing Next, we discuss the aliasing effects that result if one violates the sampling theorem conditions (1.3.2) or (1.4.1). Consider the complex version of a sinusoid: x(t)= ejΩt = e2πjf t and its sampled version obtained by setting t = nT, x(nT)= ejΩTn = e2πjfTn Define also the following family of sinusoids, for m = 0, ±1, ±2,... , xm(t)= e2πj(f + mfs)t and their sampled versions, xm(nT)= e2πj(f + mfs)Tn Using the property fsT = 1 and the trigonometric identity, e2πjmfsTn = e2πjmn = 1 we find that, although the signals xm(t) are different from each other, their sampled values are the same; indeed, xm(nT)= e2πj(f + mfs)Tn = e2πjfTne2πjmfsTn = e2πjfTn = x(nT) In terms of their sampled values, the signals xm(t) are indistinguishable, or aliased. Knowledge of the sample values x(nT)= xm(nT) is not enough to determine which among them was the original signal that was sampled. It could have been any one of the xm(t). In other words, the set of frequencies, f, f ± fs, f ± 2fs, ..., f ± mfs, ... (1.4.2) are equivalent to each other. The effect of sampling was to replace the original frequency f with the replicated set (1.4.2). This is the intuitive explanation of the spectrum
1.4.SAMPLING OF SINUSOIDS 11 ideal ideal sampler reconstructor ) T x(nT) x(t) analog sampled analog signal signal f20f2 signal ratef lowpass filter cutoff=f2 Fig.1.4.2 Ideal reconstructor as a lowpass filter. replication property depicted in Fig.1.3.2.A more mathematical explanation will be given later using Fourier transforms. Given that the sample values x(nT)do not uniquely determine the analog signal they came from,the question arises:What analog signal would result if these samples were fed into an analog reconstructor,as shown in Fig.1.4.2? We will see later that an ideal analog reconstructor extracts from a sampled signal all the frequency components that lie within the Nyquist interval [-fs/2,fs/2]and removes all frequencies outside that interval.In other words,an ideal reconstructor acts as a lowpass filter with cutoff frequency equal to the Nyquist frequency fs/2. Among the frequencies in the replicated set (1.4.2),there is a unique one that lies within the Nyquist interval.t It is obtained by reducing the original f modulo-fs,that is, adding to or subtracting from f enough multiples of fs until it lies within the symmetric Nyquist interval [-fs/2,fs/2].We denote this operation by+ fa =f mod(fs) (1.4.3) This is the frequency,in the replicated set(1.4.2),that will be extracted by the analog reconstructor.Therefore,the reconstructed sinusoid will be: Xa(t)=e2nifat It is easy to see that fa =f only if f lies within the Nyquist interval,that is,only if Ifl s fs/2,which is equivalent to the sampling theorem requirement.If f lies outside the Nyquist interval,that is,Ifl fs/2,violating the sampling theorem condition,then the "aliased"frequency fa will be different from f and the reconstructed analog signal x(t)will be different from x(t),even though the two agree at the sampling times xa(nT)=x(nT). It is instructive also to plot in Fig.1.4.3 the aliased frequency fa =f mod(fs)versus the true frequency f.Observe how the straight line furue f is brought down in segments by parallel translation of the Nyquist periods by multiples of fs. In summary,potential aliasing effects that can arise at the reconstruction phase of DSP operations can be avoided if one makes sure that all frequency components of the signal to be sampled satisfy the sampling theorem condition,If<fs/2,that is,all tThe only exception is when it falls exactly on the left or right edge of the interval,f=tfs/2. +This differs slightly from a true modulo operation;the latter would bring f into the right-sided Nyquist interval [0,fs]
1.4. SAMPLING OF SINUSOIDS 11 ideal sampler sampled signal analog signal analog signal ideal reconstructor lowpass filter cutoff = f s/2 rate fs f xa x(t) T x(nT) (t) f s -f /2 s/2 0 Fig. 1.4.2 Ideal reconstructor as a lowpass filter. replication property depicted in Fig. 1.3.2. A more mathematical explanation will be given later using Fourier transforms. Given that the sample values x(nT) do not uniquely determine the analog signal they came from, the question arises: What analog signal would result if these samples were fed into an analog reconstructor, as shown in Fig. 1.4.2? We will see later that an ideal analog reconstructor extracts from a sampled signal all the frequency components that lie within the Nyquist interval [−fs/2, fs/2] and removes all frequencies outside that interval. In other words, an ideal reconstructor acts as a lowpass filter with cutoff frequency equal to the Nyquist frequency fs/2. Among the frequencies in the replicated set (1.4.2), there is a unique one that lies within the Nyquist interval.† It is obtained by reducing the original f modulo-fs, that is, adding to or subtracting from f enough multiples of fs until it lies within the symmetric Nyquist interval [−fs/2, fs/2]. We denote this operation by‡ fa = f mod(fs) (1.4.3) This is the frequency, in the replicated set (1.4.2), that will be extracted by the analog reconstructor. Therefore, the reconstructed sinusoid will be: xa(t)= e2πjfat It is easy to see that fa = f only if f lies within the Nyquist interval, that is, only if |f | ≤ fs/2, which is equivalent to the sampling theorem requirement. If f lies outside the Nyquist interval, that is, |f | > fs/2, violating the sampling theorem condition, then the “aliased” frequency fa will be different from f and the reconstructed analog signal xa(t) will be different from x(t), even though the two agree at the sampling times, xa(nT)= x(nT). It is instructive also to plot in Fig. 1.4.3 the aliased frequency fa = f mod(fs) versus the true frequency f . Observe how the straight line ftrue = f is brought down in segments by parallel translation of the Nyquist periods by multiples of fs. In summary, potential aliasing effects that can arise at the reconstruction phase of DSP operations can be avoided if one makes sure that all frequency components of the signal to be sampled satisfy the sampling theorem condition, |f | ≤ fs/2, that is, all †The only exception is when it falls exactly on the left or right edge of the interval, f = ±fs/2. ‡This differs slightly from a true modulo operation; the latter would bring f into the right-sided Nyquist interval [0, fs]
12 1.SAMPLING AND RECONSTRUCTION fa=fmod(f) /2 2 Fig.1.4.3 f mod(fs)versus f. frequency components lie within the Nyquist interval.This is ensured by the lowpass antialiasing prefilter,which removes all frequencies beyond the Nyquist frequency fs/2, as shown in Fig.1.3.5. Example 1.4.1:Consider a sinusoid of frequencyf=10 Hz sampled at a rate offs=12 Hz.The sampled signal will contain all the replicated frequencies 10+ml2Hz,m=0,±l,±2,, or, ,-26,-14,-2,10,22,34,46,. and among these only fa=10 mod(12)=10-12=-2 Hz lies within the Nyquist interval [-6,6]Hz.This sinusoid will appear at the output of a reconstructor as a-2 Hz sinusoid instead of a 10 Hz one. On the other hand,had we sampled at a proper rate,that is,greater than 2f 20 Hz,say at fs 22 Hz,then no aliasing would result because the given frequency of 10 Hz already lies within the corresponding Nyquist interval of [-11,11]Hz. ▣ Example 1.4.2:Suppose a music piece is sampled at rate of 40 kHz without using a prefilter with cutoff of 20 kHz.Then,inaudible components having frequencies greater than 20 kHz can be aliased into the Nyquist interval [-20,20]distorting the true frequency components in that interval.For example,all components in the inaudible frequency range 20 s f s 60 kHz will be aliased with-20 20-40 sf-fs s 60-40=20 kHz,which are audible. Example 1.4.3:The following five signals,where t is in seconds,are sampled at a rate of 4 Hz: -sin(14rt),-sin(6πt),sin(2πt),sin(10πt),sin(18πt) Show that they are all aliased with each other in the sense that their sampled values are the same
12 1. SAMPLING AND RECONSTRUCTION f s/2 f s/2 f s 2f s -fs/2 -fs/2 -fs 0 f f a = f mod(f s ) f true = f Fig. 1.4.3 f mod(fs) versus f . frequency components lie within the Nyquist interval. This is ensured by the lowpass antialiasing prefilter, which removes all frequencies beyond the Nyquist frequency fs/2, as shown in Fig. 1.3.5. Example 1.4.1: Consider a sinusoid of frequency f = 10 Hz sampled at a rate of fs = 12 Hz. The sampled signal will contain all the replicated frequencies 10+m12 Hz, m = 0, ±1, ±2,... , or, ..., −26, −14, −2, 10, 22, 34, 46,... and among these only fa = 10 mod(12)= 10−12 = −2 Hz lies within the Nyquist interval [−6, 6] Hz. This sinusoid will appear at the output of a reconstructor as a −2 Hz sinusoid instead of a 10 Hz one. On the other hand, had we sampled at a proper rate, that is, greater than 2f = 20 Hz, say at fs = 22 Hz, then no aliasing would result because the given frequency of 10 Hz already lies within the corresponding Nyquist interval of [−11, 11] Hz. Example 1.4.2: Suppose a music piece is sampled at rate of 40 kHz without using a prefilter with cutoff of 20 kHz. Then, inaudible components having frequencies greater than 20 kHz can be aliased into the Nyquist interval [−20, 20] distorting the true frequency components in that interval. For example, all components in the inaudible frequency range 20 ≤ f ≤ 60 kHz will be aliased with −20 = 20−40 ≤ f −fs ≤ 60−40 = 20 kHz, which are audible. Example 1.4.3: The following five signals, where t is in seconds, are sampled at a rate of 4 Hz: − sin(14πt), − sin(6πt), sin(2πt), sin(10πt), sin(18πt) Show that they are all aliased with each other in the sense that their sampled values are the same
1.4.SAMPLING OF SINUSOIDS 13 Solution:The frequencies of the five sinusoids are: -7,-3,1,5,9Hz They differ from each other by multiples of fs=4 Hz.Their sampled spectra will be indistinguishable from each other because each of these frequencies has the same periodic replication in multiples of 4 Hz. Writing the five frequencies compactly: fm=1+4m, m=-2,-1,0,1,2 we can express the five sinusoids as: Xm(t)=sin(2πfmt)=sin(2π(1+4m)t),m=-2,-1,0,1,2 Replacing t nT=n/fs=n/4 sec,we obtain the sampled signals: xm(nT)=sin(2π(1+4m)nT)=sin(2π(1+4m)n/4) =sin(2πn/4+2πmn)=sin(2Tn/4) which are the same,independently of m.The following figure shows the five sinusoids over the interval 0 s t s 1 sec. They all intersect at the sampling time instants t=nT =n/4 sec.We will reconsider this example in terms of rotating wheels in Section 1.4.2. Example 1.4.4:Let x(t)be the sum of sinusoidal signals x(t)=4+3cos(Tt)+2cos(2πt)+cos(3πt) where t is in milliseconds.Determine the minimum sampling rate that will not cause any aliasing effects,that is,the Nyquist rate.To observe such aliasing effects,suppose this signal is sampled at half its Nyquist rate.Determine the signal xa(t)that would be aliased with x(t). Solution:The frequencies of the four terms are:fi=0,f2=0.5 kHz,f3 =1 kHz,and f=1.5 kHz (they are in kHz because t is in msec).Thus,fmax=f4=1.5 kHz and the Nyquist rate will be 2fmax =3 kHz.If x(t)is now sampled at half this rate,that is,at fs =1.5 kHz, then aliasing will occur.The corresponding Nyquist interval is [-0.75,0.75]kHz.The frequencies fi and f2 are already in it,and hence they are not aliased,in the sense that fia=fi and f2a=f2.But f3 and fa lie outside the Nyquist interval and they will be aliased with
1.4. SAMPLING OF SINUSOIDS 13 Solution: The frequencies of the five sinusoids are: −7, −3, 1, 5, 9 Hz They differ from each other by multiples of fs = 4 Hz. Their sampled spectra will be indistinguishable from each other because each of these frequencies has the same periodic replication in multiples of 4 Hz. Writing the five frequencies compactly: fm = 1 + 4m, m = −2, −1, 0, 1, 2 we can express the five sinusoids as: xm(t)= sin(2πfmt)= sin(2π(1 + 4m)t), m = −2, −1, 0, 1, 2 Replacing t = nT = n/fs = n/4 sec, we obtain the sampled signals: xm(nT) = sin(2π(1 + 4m)nT)= sin(2π(1 + 4m)n/4) = sin(2πn/4 + 2πmn)= sin(2πn/4) which are the same, independently of m. The following figure shows the five sinusoids over the interval 0 ≤ t ≤ 1 sec. t 0 1 They all intersect at the sampling time instants t = nT = n/4 sec. We will reconsider this example in terms of rotating wheels in Section 1.4.2. Example 1.4.4: Let x(t) be the sum of sinusoidal signals x(t)= 4 + 3 cos(πt)+2 cos(2πt)+ cos(3πt) where t is in milliseconds. Determine the minimum sampling rate that will not cause any aliasing effects, that is, the Nyquist rate. To observe such aliasing effects, suppose this signal is sampled at half its Nyquist rate. Determine the signal xa(t) that would be aliased with x(t). Solution: The frequencies of the four terms are: f1 = 0, f2 = 0.5 kHz, f3 = 1 kHz, and f4 = 1.5 kHz (they are in kHz because t is in msec). Thus, fmax = f4 = 1.5 kHz and the Nyquist rate will be 2fmax = 3 kHz. If x(t) is now sampled at half this rate, that is, at fs = 1.5 kHz, then aliasing will occur. The corresponding Nyquist interval is [−0.75, 0.75] kHz. The frequencies f1 and f2 are already in it, and hence they are not aliased, in the sense that f1a = f1 and f2a = f2. But f3 and f4 lie outside the Nyquist interval and they will be aliased with