You are here: Home » Content » SIGNAL SAMPLING

SIGNAL SAMPLING

Module by: Nguyen Huu Phuong

SIGNAL SAMPLING

Analog signals, in general, are continuous in time. In digital signal processing, we do not use the whole analog signal but replace it by its amplitudes taken at regular intervals. This is sampling. The problem is we must sample the signal so that the samples represent correctly the signal, i.e. from the samples we can reconstruct the original analog signal perfectly.

Sampling of continuous-time signals

Sampling a continuous-time signal turns it into a correspond discrete-time signal so that it can be processed on digital systems. Actually, the sampling is followed by two other operations, quantization and binary encoding. In reality, the analog-to-digital converters (abbreviated ADC or A/D) do all the three steps.
Figure 1: Sampling of signal at sampling interval (period) T
Figure 1depicts the sampling of a signal at regular interval (period) t = nT s t = nT s size 12{t= ital "nT" rSub { size 8{s} } } {} where n is an integer, positive and negative. This is uniform sampling that we use routinely. Rarely, nonuniform sampling is mentioned. We denote the samples of the signal x(t) as a x ˆ x ˆ size 12{ {x} cSup { size 8{ widehat } } } {} ( t ) ( t ) size 12{ \( t \) } {} or x ( nT s ) x ( nT s ) size 12{x \( ital "nT" rSub { size 8{s} } \) } {} .Figure 2 shows the sampling process. It turns out that sampling is just a multiplication of the analog signal x(t) with a sampling signal (or function) s(t):
xˆt=x(nTs)=x(t)s(t)xˆt=x(nTs)=x(t)s(t) size 12{ { {x}} \( t \) =x \( ital "nT" rSub { size 8{s} } \) =x \( t \) s \( t \) } {}(1)
Figure 2: The principle of sampling (a)Multiplying; (b)Switching
The sampling signal s(t) is a regular sequence of narrow pulses δ ( t ) δ ( t ) size 12{δ \( t \) } {} of amplitude 1 (Figure 3) when multiplying s(t) with the signal x(t) we obtain the instantaneous values of x(t) which are the samples. An electric switch (Figure 2b) is a way to implement the sampling: When the contact closes in a short time, the signal passes; and when the contact opens, no output signal appears.
Figure 3: Sampling by a sequence of narrow pulse δ ( t ) δ ( t ) size 12{δ \( t \) } {}
The time distance TsTs size 12{T rSub { size 8{s} } } {} is called sampling interval or sampling period, fs=1/Tsfs=1/Ts size 12{f rSub { size 8{s} } =1/T rSub { size 8{s} } } {} is sampling frequency (Hz or samples/sec), also called sampling rate. The samples were written as x(nTs)x(nTs) size 12{x \( ital "nT" rSub { size 8{s} } \) } {} but TsTs size 12{T rSub { size 8{s} } } {} is usually taken as 1, hence the samples will be denoted universally, unless otherwise specified, as x(n). The integer n is just an index, it can represent sample, time, space, but we will often call it time index, or just index, or sample.
When looking at Figure 1 and Figure 3 we may ask if the sampling is appropriate, that is the samples are too close or too far away or just right. This is really a big question and will be answered soon. For the time being, let’s examine the sampling of a sinewave (Figure 4) having period TxTx size 12{f rSub { size 8{s} } } {} and frequency F x = 1 / T x F x = 1 / T x size 12{F rSub { size 8{x} } =1/Talignl { stack { rSub { size 8{x} {} # } rSub { {} # } } } {} at the sampling rate fsfs size 12{f rSub { size 8{s} } } {}. Different authors use different symbols, this cause certain difficulty for readers. The figure shows the same sinewave but with 3 different sampling frequency fsfs size 12{f rSub { size 8{s} } } {}. In the first case f s = 8F x f s = 8F x size 12{f rSub { size 8{s} } =8F rSub { size 8{x} } } {} , the samples are quite close and represent very well the signal (from the samples we can reconstruct the signal). In the second case f s = 4F x f s = 4F x size 12{f rSub { size 8{s} } =8F rSub { size 8{x} } } {} , still the samples can represent the signal (imagine that we connect the successive sample values to get a triangular wave which is then passed through an analog lowpass filter to smooth out the waveform). In the last case f s = 2F x f s = 2F x size 12{f rSub { size 8{s} } =4F rSub { size 8{x} } } {} , the sampling rate is equal twice the signal frequency. This is the critical case: The samples may or may not represent the signal depending on positions of sampling points.
Figure 4: Sampling a sinewave of frequency f F x = 1 / T x F x = 1 / T x size 12{F rSub { size 8{x} } =1/Talignl { stack { rSub { size 8{x} {} # } rSub { {} # } } } {} at different sampling rates fsfs size 12{f rSub { size 8{s} } } {}

The sampling theorem

Let’s consider a certain continuous-time signal x(t) rpresenting certain information such as voice. Its magnitude frequency spectrum is assumed to be as in Figure 5.a where FMFM size 12{f rSub { size 8{s} } } {} is its maximum frequency.
Figure 5: Two-sided frequency spectrum of (a) the analog signal, (b) the samples when f s > F M f s > F M size 12{f rSub { size 8{s} } >F rSub { size 8{M} } } {} , (c) the samples when f s = 2F M f s = 2F M size 12{f rSub { size 8{s} } =2F rSub { size 8{M} } } {} , (d) the samples when f s < 2F M f s < 2F M size 12{f rSub { size 8{s} } <2F rSub { size 8{M} } } {}
The signal is sampled by a sequence of narrow pulses δ ( t ) δ ( t ) size 12{δ \( t \) } {} of amplitude 1 as before. The Fourier series expansion (see section 3.1) of this sampling function is
st=δtT+2δtTm=1cosmfstst=δtT+2δtTm=1cosmfst size 12{s left (t right )= { {δt} over {T} } +2 { {δt} over {T} } Sum cSub { size 8{m=1} } cSup { size 8{ infinity } } {"cos"2π ital "mf" rSub { size 8{s} } t} } {}(2)
Hence the samples are
xˆt=xtst=δtTxt+2δtTm=1xtcosmfstxˆt=xtst=δtTxt+2δtTm=1xtcosmfst size 12{ { hat {x}} left (t right )=x left (t right )s left (t right )= { {δt} over {T} } x left (t right )+2 { {δt} over {T} } Sum cSub { size 8{m=1} } cSup { size 8{ infinity } } {x left (t right )"cos"2π ital "mf" rSub { size 8{s} } t} } {}(3)
Where x(t)x(t) size 12{ { {x}} \( t \) } {} denotes the samples its Fourier frequency spectrum is X(F)X(F) size 12{ { {X}} \( F \) } {}). Thus the spectrum of the sampled signal consists of that of the analog signal (with a multiplying factor δ(t / T δ(t / T size 12{δt/T} {} ) and its shifted versions to ± 2f s , ± 3f s ± 2f s , ± 3f s size 12{ +- 2f rSub { size 8{s} } , +- 3f rSub { size 8{s} } } {} … This spectrum ca also obtain using the Fourier transform (see section 3.2) instead of the Fourier series.
In Figure 5.b the spectrum bands do not overlap so we can recover the analog signal by lowpass filtering the central band, or bandpass filtering any other bands. All the bands contain the same information but at different frequencies. In Figure 5.c we still can recover the signal but with a precise filter. In Figure 5.d the bands overlap and we are in no way to recover the analog signal. So the limiting case is Figure 5.c. From this observation, the sampling theorem states as follows.
In order the samples represent correctly the analog signal, the sampling frequency must be greater than twice the maximum frequency of the analog signal:
fs2FMfs2FM size 12{f rSub { size 8{s} } >= 2F rSub { size 8{M} } } {}(4)
The limiting frequency 2FM2FM size 12{2F rSub { size 8{M} } } {} is called Nyquist rate, and the central frequency interval f s / 2, f s / 2 f s / 2, f s / 2 size 12{ left [ - f rSub { size 8{s} } /2,f rSub { size 8{s} } /2 right ]} {} is called the Nyquist interval.
For example if a waveform contains the fundamental frequency of 1 kHz and a second harmonic 2kHz, then the sampling rate must be greater than 2 x 2 kHz = 4 kHz, say 5 kHz or more. Another example is for the voice in the telephone system. The voice is limited by a high quality analog filter at FMFM size 12{f rSub { size 8{s} } } {} = 3.4 kHz, then the sampling frequency must be greater than 2 x 3.4 = 6.8 kHz, say 8 kHz or more.
In the case of Figure 5.d there is a phenomenon called aliasing that will be discussed next.

Aliasing

We would like to know what happens when the signal is sampled below the Nyquist rate, i.e. the sampling theorem is not satisfied. Look at Fig.1.19. The low-frequency signal x1x1 size 12{f rSub { size 8{s} } } {}(t) is sampled 4 times at S1, S2, S3 and S4 in a period of the signal, i.e fs = 4Fx1. From these samples we would be able to recover x1x1 size 12{f rSub { size 8{s} } } {}(t). For the high-frequency signal x2x2 size 12{f rSub { size 8{s} } } {}(t) there are the same 4 samples S1, S2, S3 and S4 in its 9 cycles, so the sampling frequency is just (4/9) F x2 F x2 size 12{F rSub { size 8{x2} } } {} i.e. under the Nyquist rate. From these sample points of x2x2 size 12{f rSub { size 8{s} } } {}(t) we will recover x1x1 size 12{f rSub { size 8{s} } } {}(t) and not the correct x2x2 size 12{f rSub { size 8{s} } } {}(t). Thus the high frequency signal when undersampled will be recovered as a low-frequency signal. This phenomenon is called aliasing, and the recovered low frequency, which is false, is called the alias of the original high-frequency signal.
Figure 6: The low-frequency signal x1x1 size 12{f rSub { size 8{s} } } {}(t) and the high-frequency signal x2x2 size 12{f rSub { size 8{s} } } {}(t)are sampled at the same points S1S1 size 12{f rSub { size 8{s} } } {}, S2S2 size 12{f rSub { size 8{s} } } {}, S3S3 size 12{f rSub { size 8{s} } } {} , S4S4 size 12{f rSub { size 8{s} } } {} , S5S5 size 12{f rSub { size 8{s} } } {}
To avoid the aliasing there are two approaches: One is to raise the sampling frequency to satisfy the sampling theorem, the other is to filter off the unnecessary high-frequency component from the continuous-time signal. We limit the signal frequency by an effective lowpass filter, called antialiasing prefilter, so that the remained highest frequency is less than half of the intended sampling rate. If the filter is not perfect we must give some allowance. For example in voice processing, if the lowpass filter still allows frequencies above 3.4 kHz go through even at small amplitude, the sampling frequency should be 10 kHz or more instead of 8 kHz.
The aliasing phenomenon can be shown mathematically. Let’s consider a complex exponential signal at frequency F which is sampled at interval TsTs size 12{f rSub { size 8{s} } } {} to yield the samples x ( nT s ) x ( nT s ) size 12{x \( ital "nT" rSub { size 8{s} } \) } {} :
Now consider other signals at frequency F±mfsF±mfs size 12{F +- ital "mf" rSub { size 8{s} } } {}, m = 0, 1, 2 … sampled to give x m ( nT ) x m ( nT ) size 12{x rSub { size 8{m} } \( ital "nT" \) } {} :
x m ( t ) = e j2π ( F ± mF s ) x m ( t ) = e j2π ( F ± mF s ) size 12{x \( t \) =e rSup { size 8{j2π ital "Ft"} } } {} size 12{ drarrow } {} x m ( nT s ) = e j2π ( F ± mf s ) nT s x m ( nT s ) = e j2π ( F ± mf s ) nT s size 12{x rSub { size 8{m} } \( ital "nT" rSub { size 8{s} } \) =e rSup { size 8{j2π \( F +- ital "mf" rSub { size 6{s} } \) ital "nT" rSub { size 6{s} } } } } {}
Because
f s T s = 1 f s T s = 1 size 12{f rSub { size 8{s} } T rSub { size 8{s} } =1} {} and e j2π mf s nT s = e j2π mn = 1 e j2π mf s nT s = e j2π mn = 1 size 12{e rSup { size 8{j2π ital "mf" rSub { size 6{s} } ital "nT" rSub { size 6{s} } } } =e rSup {j2π ital "mn"} size 12{ {}=1}} {} {}
then
x m ( nT s ) = e j2π ( F ± mF s ) = e j2π fnT s e j2π mF s nT s = e j2π FnT s = x ( nT ) x m ( nT s ) = e j2π ( F ± mF s ) = e j2π fnT s e j2π mF s nT s = e j2π FnT s = x ( nT ) size 12{x rSub { size 8{m} } \( ital "nT" rSub { size 8{s} } \) =e rSup { size 8{j2π \( F +- ital "mF" rSub { size 6{s} } \) } } =e rSup {j2π ital "fnT" rSub { size 6{s} } } size 12{e rSup {j2π ital "mF" rSub { size 6{s} } ital "nT" rSub { size 6{s} } } } size 12{ {}=e rSup {j2π ital "FnT" rSub { size 6{s} } } } size 12{ {}=x \( ital "nT" \) }} {} (5)
This result means that the two signals xm(t) and x(t) at different frequencies have the same samples. When we recover the signals from those common samples then those signals lie within the Nyquist interval f s / 2, f s / 2 f s / 2, f s / 2 size 12{ left [ - f rSub { size 8{s} } /2,f rSub { size 8{s} } /2 right ]} {} (Figure 5.b) are recovered correctly, whereas the signals having frequencies outside the Nyquist interval may be aliased into this interval. In general, for an analog signal of frequency F sampled at the sampling rate fsfs size 12{f rSub { size 8{s} } } {} , first we add and subltract frequencies as follows:
f 0 = F ± mf s m = 0, 1, 2, . . .