Chapter 2
Sampling of Continuous-Time Signals
• Introduction
• Periodic Sampling of Analog Signals
• Aliasing
• The Sampling Theorem and Reconstruction
• Changing the Sampling-Rate Using Discrete-time Processing
• Quantization of Continuous-Amplitude Signals
• Coding of Quantized Samples
• Digital-to-Analog Converters
Introduction
• Most signals of practical interest, such as speech, biological signals, seismic
signals, communication signals such as audio and video signals are analog.
• To process analog signals by digital means, its first necessary to convert them into
digital form.
• Sampling:
✓Conversion of continuous-time signal into a discrete-time signal by taking
“samples” of the continuous-time signal at discrete-time instants.
✓If 𝑥𝑎 (t) is the input to the sampler, the o/p is 𝑥𝑎 (nT) =x[n], where T is
sampling interval.
• Quantization:
✓Conversion of a discrete-time continuous-valued signal into a discrete-time,
discrete-valued (digital) signal.
Introduction
✓The difference between the un quantized sample x[n] and the quantized o/p
𝑥𝑞 [n] is called quantization error.
• Coding:
✓Each discrete valued 𝑥𝑞 n is represented by a b-bit binary sequence.
Fig: on Basic parts of Analog-to-Digital Converter below
ADC
---------------------------------------------------
𝑥[𝑛] 𝑥𝑞 n 01011… … .
𝑥𝑎 (t) Sampler Quantizer Coder
--------------------------------------------------- Digital signal
Analog signal discrete-time signal quantized signal
Sampling of Analog Signals
✓ Periodic or uniform sampling:
x[n] = 𝑥𝑎 nT , -∞ < 𝑛 < ∞
✓ x[n] is a discrete-time signal obtained by “taking samples” of the
analog signal 𝑥𝑎 (𝑡) at every T seconds.
Sampling of Analog Signals
✓ T is time interval between successive samples
✓Sampling period
1
✓𝐹𝑠 = , sampling frequency
𝑇
𝑛
✓ t = nT = time-variable of discrete-time
𝐹𝑠
Time variable of continuous-time
• Continuous-time sinusoidal signal:
𝑥𝑎 (t) = Acos(Ω𝑡 + θ), -∞ < 𝑡 < ∞
✓ Is characterized by three parameters:
➢Amplitude (A), Ω (frequency in 𝑟𝑎𝑑 Τ𝑠), and the phase (θ in radians).
Ω = 2πF
Sampling of Analog Signals
• Exponential signal:
x𝑎 (t) = Aej(Ωt+θ)
𝑒 𝑗ϕ = cos ϕ +jsin ϕ
A j(Ωt+θ) A −j(Ωt+θ)
✓ x𝑎 (t) = Acos(Ω𝑡 + θ)= e + e
2 2
✓A sinusoidal signal can be obtained by adding two equal –amplitude
complex-conjugate exponential signals.
Discrete-time sinusoidal signals
• 𝑥 𝑛 = 𝐴 cos 𝜔𝑛 + 𝜃 , -∞ < 𝑛 < ∞:discrete-time sinusoidal
signal
n: an integer variable (sample number)
ω: frequency (𝑟𝑎𝑑Τ𝑠ample)
ω = 2πf
• x[n] = 𝑥 𝑛 = 𝐴 cos 2πf𝑛 + 𝜃 , -∞ < 𝑛 < ∞
f: frequency (dimension: cycles per sample)
Discrete-time Sinusoidal Signals
• A discrete-time sinusoid is periodic only if its frequency f is a
rational number.
x[n +N] =x[n], for Ɐn (periodic with period N)
✓ The small value of N is called the fundamental period.
• For a sinusoid with a frequency 𝑓0 to be periodic
cos(2π𝑓0 (N+n)+θ] = cos(2π𝑓0 n+θ)
✓ This is true if and only if there exists an integer k
Such that: 2π𝑓0 N = 2𝑘π
k
𝑓0 =
N
Discrete-time Sinusoidal Signals
• i.e., a discrete-time sinusoid is periodic if its frequency 𝑓0 can be expressed as the
ratio of two integers( i.e., 𝑓0 is rational)
• Discrete-time sinusoids whose frequencies are separated by an integer multiple
of 2π are identical.
cos(ω0 +2π)n+θ) = cos(𝜔0 𝑛 + 2𝜋𝑛 + 𝜃) = cos(𝜔0 𝑛 + 𝜃)
cos (𝜔0 𝑛 + 𝜃 + 2𝜋𝑛) = cos(𝜔0 𝑛 + 𝜃) cos 2𝜋𝑛 - sin (ω0 n + θ) sin2πn
= cos(𝜔0 𝑛 + 𝜃)
• Consider analog sinusoidal signal
𝑥𝑎 t = A cos(2𝜋𝑓𝑡 + 𝜃)
1
Sampled periodically at a rate 𝐹𝑠 = samplesΤsec
𝑇
Discrete-time Sinusoidal Signals
𝑥𝑛 (nT) = x[n] = Acos(2π𝐹𝑛T+θ)
2π𝑛𝐹
= Acos( +θ)
𝐹𝑠
• Frequency of analog signal F(Ω) and frequency of discrete-time signal f(or ω)
are linearly related as:
𝐹
f= or equivalently ω = ΩT
𝐹𝑠
ω = 2πf
• The range of the frequency variable F or Ω for continuous-time sinusoidal is:
-∞ < 𝐹 < ∞ (Ω = 2πf) 𝐹𝑠 :sampling frequency
-∞ < Ω < ∞ 𝑟𝑎𝑑 Τ𝑠 F: frequency of analog signal
f:frequency of digital signal Ω:relative or normalized frequency
Discrete-time Sinusoidal Signals
1 1
• For discrete-time sinusoids: − <𝑓 <
2 2
−π < ω < π
Relations Among frequency variables
Continuous-time signals discrete-time signals
Ω = 2πF ω = 2πf
𝑟𝑎𝑑𝑠 𝑐𝑦𝑐𝑙𝑒𝑠
Hz ൗ𝑠𝑎𝑚𝑝𝑙𝑒 ൗ𝑠𝑎𝑚𝑝𝑙𝑒𝑠
F
ω = Ω T; f = −π ≤ ω ≤ π
Fs
− 1Τ2 ≤ 𝑓 ≤ 1Τ2
-∞ ≤ 𝐹 ≤ ∞ Ω = ωΤ𝑇 ;F = [Link] − πΤ𝑇 ≤ Ω ≤ πΤ𝑇
-∞ ≤ Ω ≤ ∞ −Fs Τ2 ≤ 𝐹 ≤ Fs Τ2
Discrete-time Sinusoidal Signals
• The fundamental difference between continuous-time and discrete-
time signals is in their range of values of the frequency variables F and
f, Ω and ω.
• Periodic sampling of a continuous-time signal implies a mapping of the
infinite frequency range for the variable F (or Ω) into a finite
frequency range for the variable f (or ω).
1
• Since the highest frequency in a discrete-time signal is ω = π or f = ,
2
with a sampling range 𝐹𝑠 ,
𝐹𝑠 1
𝐹𝑚𝑎𝑥 = =
2 2𝑇
π
Ω𝑚𝑎𝑥 = π𝐹𝑠 =
𝑇
✓Therefore, sampling introduces an ambiguity.
Discrete-time Sinusoidal Signals
Example: consider two analog sinusoidal signals
𝑥1 (𝑡) =cos 2π(10)t
𝑥2 (𝑡) =cos 2π(50)t which are sampled at 𝐹𝑠 = 40Hz
✓corresponding discrete-time sequence
10 π
𝑥1 [𝑛] =cos 2π( )n = cos 𝑛
40 2
50 5π
𝑥2 [𝑛] =cos 2π( )n = cos 𝑛
40 2
5π π𝑛 π𝑛
✓cos 𝑛 = cos(2π𝑛 + ) = cos
2 2 2
✓𝑥2 [𝑛] = 𝑥1 [𝑛]
✓Thus, the sinusoidal signals are identical and consequently
indistinguishable.
Aliasing
π
• If we are given the sampled values generated by cos( )n, there is some
2
ambiguity as to whether these sampled values corresponds to 𝑥1 (t) or 𝑥2 (t) .
Aliasing:
✓An effect that causes different signals to become indistinguishable (or alias of
one another) when sampled.
✓For the previous example:
𝑥1 (𝑡) =cos 2π()t
𝑥2 (𝑡) =cos 2π(50)t
✓Since 𝑥2 (𝑡) yields exactly the same value as 𝑥1 (𝑡) when the two sampled at
𝐹𝑠 =40 samples per second we say that the frequency 𝐹2 = 50Hz is an alias of
the frequency 𝐹1 = 10Hz at sampling rate of 40 samples per second.
Aliasing …
✓ 𝐹2 is not the only alias of 𝐹1 ,at the sampling rate of 40 samples per
second.
✓ The frequency 𝐹3 = 90Hz, is also an alias of 𝐹1 ,as is the frequency 𝐹4
=130Hz and so on.
✓All of the sinusoids cos 2π( 𝐹1 +40k)t, k = 1, 2, 3, 4, . . . Sampled at 40
samples per second yield identical values.
• In general, the sampling of a continuous-time sinusoidal signal:
𝑥𝑎 (𝑡) = cos(2π 𝐹0 𝑡 +θ)
With a sampling rate of 𝐹𝑠 = 1Τ𝑇 results in a discrete-time signal:
𝐹0
𝑥𝑛 [𝑛] = cos 𝐴(2π 𝑓0 n +θ) where 𝑓0 = ൗ 𝐹𝑠,is the relate frequency of the
sinusoid.
Aliasing …
𝐹𝑠 𝐹𝑠
✓ If we assume that − 2 ≤ 𝐹0 ≤ ൗ2, the frequency 𝑓0 of x[n] is in the range
ൗ
− 1Τ2 ≤ 𝑓0 ≤ 1Τ2, which is the frequency range of the discrete-time signals.
✓ If the sinusoids 𝑥𝑎 (𝑡) = Acos(2π 𝐹𝑘 t +θ)
where 𝐹𝑘 = 𝐹0 + k 𝐹𝑠 , k =±1, ±2, . . .are sampled at a rate of the 𝐹𝑠 , its clear that
the frequency 𝐹𝑘 is outside the fundamental frequency range 𝐹𝑠ൗ2 ≤ 𝐹𝑜 ≤ 𝐹𝑠ൗ2
𝐹0 +𝑘𝐹𝑠
✓ The sampled signal: x[n] = 𝑥𝑎 (𝑛𝑇) = Acos(2π n +θ)
𝐹𝑠
𝐹0
= Acos(2π n +θ + 2πkn)
𝐹𝑠
= Acos(2π𝑓0 n +θ)
✓The frequencies 𝐹𝑘 = 𝐹0 + k 𝐹𝑠 , -∞ < 𝑘 < ∞ (k is an integer) are
indistinguishable from the frequency 𝐹0 after sampling and hence they are alias of
𝐹0 .
Aliasing …
• Fig: Illustration of aliasing
The sampling theorem and Reconstruction
• If the highest frequency contained in an analog signal 𝑥𝑎 (t) is 𝐹𝑚𝑎𝑥 =B and
the signal is sampled at a rate 𝑭𝒔 ≥2𝑭𝒎𝒂𝒙 =2B, then 𝑥𝑎 (t) can be exactly
recovered from its sample values by interpolation function.
sin 2π𝐵𝑡
g(t) =
2π𝐵𝑡
Thus
∞ 𝑛 𝑛
𝑥𝑎 (t) = σ𝑛=−∞ 𝑥𝑎 ( )g(t- )
𝐹𝑠 𝐹𝑠
𝑛
Where 𝑥𝑎 ( ) = 𝑥𝑎 (nT) = x[n] are the samples of 𝑥𝑎 (t).
𝐹𝑠
✓ When the sampling 𝑥𝑎 (t) is performed at the minimum sampling rate 𝐹𝑠 =
2B, the reconstruction formula becomes:
𝑛
∞ 𝑛 sin 2π𝐵(𝑡−2𝐵)
𝑥𝑎 (t) = σ𝑛=−∞ 𝑥𝑎 ( ) 𝑛
2𝐵 2π𝐵(𝑡− )
2𝐵
The Sampling Theorem and Reconstruction
• The sampling rate 𝐹𝑁 =2B = 2𝐹𝑚𝑎𝑥 is called the Nyquist rate.
Examples 1: consider the analog signal given as
𝑥𝑎 (t) =3cos 50π𝑡 + 10sin 300π𝑡- cos 100π𝑡 what is the Nyquist rate for this
signal?
Solution: The frequencies present in the signal above are: 𝐹1 =25Hz, 𝐹2 =150Hz,
𝐹3 =50Hz thus, 𝐹𝑚𝑎𝑥 =150Hz and 𝐹𝑠 ≥ 2𝐹𝑚𝑎𝑥 =300Hz
✓The Nyquist rate is FN =300Hz = 2𝐹𝑚𝑎𝑥
✓ Note: It should be observed that the signal component 10sin 300π𝑡 sampled at
the Nyquist rate FN = 300Hz, results in the samples 10sin π𝑡 which are identical
to zero.
✓We are sampling the analog signal at its zero-crossing points and hence we miss
the signal component completely.
The Sampling Theorem and Reconstruction
• This situation would not occur if the sinusoid is offset in phase by some
amount θ.
✓10sin(300π𝑡+ θ) sampled at the Nyquist rate 𝐹𝑁 =300 samples per
second yields:
10sin(π𝑛+ θ)
= 10(sin π𝑛 cos θ+ cos π𝑛 sin θ)
=10 sinθcosπ𝑛
=(−1)𝑛 10 sinθ
✓ Thus, if θ ≠ 0,or π, the samples of the sinusoids taken at the Nyquist
rate are not all zero.
The Sampling Theorem and Reconstruction
• Example 2: consider the analog signal given by:
𝑥𝑎 (t)=3cos2000πt +5sin6000 πt + 10cos12000πt
a). What is the Nyquist rate for this signal
b). Assume now that we sample this signal using a sampling rate
𝐹𝑠 =5000𝑠𝑎𝑚𝑝𝑙𝑒𝑠Τ𝑠𝑒𝑐. What is the discrete-time signal obtained after sampling?
c). What is the analog signal 𝑦𝑎 (t) we can reconstruct from the samples if we use
ideal interpolation?
Solution:
a). The frequencies existing in the analog signals are: 𝐹1 =1kHz, 𝐹2 =3kHz,
𝐹3 =6kHz thus, 𝐹𝑚𝑎𝑥 =6kHz and 𝐹𝑠 ≥2𝐹𝑚𝑎𝑥 = 12kHz.
✓ the Nyquist rate is: 𝐹𝑁 =12kHz
The Sampling Theorem and Reconstruction
𝐹𝑠
b). Since we have chosen 𝐹𝑠 =5kHz, the folding frequency is =2.5kHz and this is
2
the max frequency that can be represented uniquely by the sampled signal.
𝑛
X[n] = 𝑥𝑎 (nT) = 𝑥𝑎 ( )
𝐹𝑠
1 3 6
= 3cos 2π 𝑛 + 5sin 2π 𝑛 +10cos 2π 𝑛
5 5 5
1 2 1
= 3cos 2π 𝑛 + 5sin 2π 1 − 𝑛 +10cos 2π 1 + 𝑛
5 5 5
1 2 1
= 3cos 2π 𝑛 + 5sin 2π − 𝑛 +10cos 2π 𝑛
5 5 5
✓ Note:cos(θ + α)= cos θcos α – sinθsinα
sin(θ + α) = sin θcos α + sinαcosθ
1 2
✓Finally, we obtain: x[n] = 13cos 2π 𝑛 − 5sin 2π 𝑛
5 5
The Sampling Theorem and Reconstruction
𝐹𝑠
✓ On the other hand since 𝐹𝑠 =5kHz, the folding frequency is = 2.5kHz. The
2
𝐹𝑠
frequency 𝐹1 is less than and thus its not affected by aliasing. However, the
2
other two frequencies are above the folding frequency and they will be
changed by the aliasing effect
,
𝐹2 = 𝐹2 -𝐹𝑠 = -2kHz
,
𝐹3 = 𝐹3 -𝐹𝑠 =1kHz
1 2 1
𝑓1 = , 𝑓 =- and 𝑓3 =
5 2 5 5
c). Since only the frequency components at 1kHz and 2kHz are present in the
sampled signal (b) the analog signal we can recover is:
𝑦𝑎 (t)=13cos2000πt -5sin4000 πt which is obviously different from the
original 𝑥𝑎 (t). This is caused by the aliasing effect due to the low sampling
rate.
Changing the Sampling Rate using Discrete-time
processing
• We have seen that a continuous-time signal 𝑥𝑐 (𝑡) can be represented by a
discrete-time signal consisting of sequence of samples,
x[n] = 𝑥𝑐 (𝑛𝑇)
• Alternatively, even if x[n] was not obtained originally by sampling, we can
always use the band limited interpolation formula to find a continuous-time
band limited signal 𝑥𝑟 (𝑡) whose samples are x[n] = 𝑥𝑐 𝑛𝑇 .
• Its often necessary to change the sampling rate of a discrete-time signal.
I. Sampling rate reduction by an integer factor
𝑥𝑑 [𝑛] = x[nM] = 𝑥𝑐 𝑛𝑀𝑇
M
𝑥[𝑛] 𝑥𝑑 𝑛𝑇 =𝑥[𝑛𝑀]
Sampling
period T Sampling period
T’ = MT
Changing the Sampling Rate using Discrete-Time
Processing
✓ 𝑥𝑑 [𝑛] is identical to the sequence that would be obtained from 𝑥𝑐 (𝑛) by
sampling with period 𝑇 ′ =MT
• The sampling rate can be reduced by a factor of M without aliasing if the original
sampling rate was at least M times the Nyquist rate or if the bandwidth of the
sequence is first reduced by a factor of M by discrete-time filtering.
• Down sampling also known as decimation removes samples from a signal.
𝑓𝑠
= D> 1 so that 𝑓𝑠 > 𝑓𝑠𝑛𝑒𝑤 where D: is an integer
𝑓𝑠𝑛𝑒𝑤
𝑓𝑠 : is the old sampling rate (number 𝑓𝑠𝑛𝑒𝑤 : is the new sampling rate)
• Increasing the sampling rate involves operation analogous to D/C conversion.
• Consider x[n] is a signal whose sampling rate we wish to increase by a factor of
L.
Changing the Sampling Rate Using Discrete-Time
Processing
𝑥𝑖 [𝑛] = 𝑥𝑐 (𝑛𝑇 ′ )
Where:𝑥𝑐 𝑡 : the underlying continuous-time signal
𝑇 ′ =𝑇Τ𝐿
X[n] =𝑥𝑐 (𝑛T)
𝑛
𝑥𝑖 [𝑛] =x[ ]= 𝑥𝑐 (𝑛 𝑇Τ𝐿), n = 0, ±𝐿, ±2𝐿, . . . .
𝐿
LPF
L Gain = L
𝑥[𝑛] 𝑥𝑒 [𝑛] π 𝑥𝑖 [𝑛]
Cutoff =
𝐿
Sampling sampling sampling
period T period 𝑇 ′ =𝑇Τ𝐿 period 𝑇 ′ =𝑇Τ𝐿
Changing the Sampling Rate Using Discrete-Time
Processing
• The system on the left on the above block diagram is called sampling rate
expander. Its output is
𝑛
𝑥𝑒 [𝑛] = x[ ], n = 0, ±𝐿, ±2𝐿, . . . .
𝐿
0, otherwise
• The new sampling frequency is greater than the old sampling frequency:
𝑓𝑠𝑛𝑒𝑤 > 𝑓𝑠
Where 𝑓𝑠 is the old sampling frequency and 𝑓𝑠𝑛𝑒𝑤 is the new sampling frequency.
• Also, the new sampling frequency has to be an integer multiple of the original
sampling frequency:
𝑓𝑠𝑛𝑒𝑤 Τ𝑓𝑠 =D > 1 where D is an integer.
Continued ….
Quantization of Continuous-Amplitude Signals
• A digital signal is a sequence of numbers (samples) in which each number
represented by a finite number of digits (finite precision).
Quantization:
• The process of converting a discrete-time continuous-amplitude signal into a
digital signal by expressing each sample value as a finite number of digits.
• The error introduced in represented the continuous-valued signal by a finite set of
discrete value levels is called quantization error.
𝑥𝑞 [𝑛] = Q[x[n]]
Where: 𝑥𝑞 [𝑛] :the sequence of quantized samples at the output of the quantizer
Q[x[n]]: the quantizer operation
x[n]: the sampled sequence
Continued …
Continued …
𝑒𝑞 [𝑛] =𝑥𝑞 [𝑛] –x[n]
𝑒𝑞 [𝑛] =the quantization error
• Let us consider the discrete-time signal.
x[n]= 0.9𝑛 ,n≥ 0
0< 0
• x[n] is obtained by sampling the analog exponential signal 𝑥𝑎 (𝑡) = 0.9𝑡 t≥ 0
With the sampling frequency 𝐹𝑠 =1Hz.
Rounding:
• Assigns each sample of x[n] to the to the nearest quantization level
Continued …
Truncation:
• Assigns each sample of x[n] to the quantization level below it.
∆ ∆
• The quantization error 𝑒𝑞 [𝑛] in rounding is limited to the range of − to , i.e.,
2 2
∆ ∆
− ≤ 𝑒𝑞 [𝑛] ≤
2 2
• Quantization step size or reduction.
𝑥𝑚𝑎𝑥 −𝑥𝑚𝑖𝑛
∆=
𝐿−1
✓ Where 𝑥𝑚𝑎𝑥 𝑎𝑛𝑑 𝑥𝑚𝑖𝑛 represents the max and min value of quantization levels.
Continued …
• Dynamic range: 𝑥𝑚𝑎𝑥 − 𝑥𝑚𝑖𝑛
✓ If the dynamic range is fixed, increasing the quantization levels results
in decrease of the quantization step size which decreases the
quantization error and increases the quantization accuracy.
• Quantization of analog signals always results in a loss of information
and hence its irreversible.
Coding of Quantized Samples
• The coding process in an ADC assigns a unique binary number to each
quantization level.
• If we have L levels, we need at least L different binary numbers.
• With a word length of b digits (bits) we can create 2𝑏 different binary
numbers.
✓2b ≥ 𝐿, or b≥ log 2 𝐿
✓ Thus, the number of bits required in the coder is the smallest integer
greater than or equal to log 2 𝐿.
• In general, the higher the sampling speed and the finer the quantization,
the more expensive the device becomes commercially.
Digital-to-Analog Conversion (DAC)
• Used to convert a digital values into an analog voltage
• Performs inverse operation of ADC
• Vout α Digital Value
• DAC task is to interpolate between samples.
DAC : Performance Specifications
• Resolution
• Reference Voltages
• Settling Time
• Linearity
• Speed
• Error
Thank You!