Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
60 views

2 - Signal Sampling and Quantization

Uploaded by

meera naaj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

2 - Signal Sampling and Quantization

Uploaded by

meera naaj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 96

Signal Sampling

and Quantization

11-Oct-24 1
Overview
• Digital Signal Processing System
• Analog to Digital Conversion
• Nyquist–Shannon Sampling Theorem
• Aliasing
• Sampling Effect in Time Domain
• Sampling Effect in Frequency Domain
• Anti Aliasing Filter
• Under-sampling
• Sampling of Band Limited Signals
• Over-sampling
• Digital to Analog Conversion

11-Oct-24 2
Analog vs. Digital Signal Processing

Analog input Analog Analog output


Signal x(t) Signal Processor Signal y(t)

Analog Signal Processing

Analog Analog
input output
Signal x(t) Signal y(t)
A/D Digital D/A
converter Signal Processor converter

Digital Signal Processing

11-Oct-24 3
Typical Digital Signal Processing System

11-Oct-24 4
Analog to Digital Conversion
A/D conversion can be viewed as a three-step process

11-Oct-24 5
Analog to Digital Conversion

11-Oct-24 6
Analog to Digital Conversion
Sample & Hold (Sampler)

• Analog signal is continuous in time and continuous in


amplitude.

• It means that it carries infinite information of time and


infinite information of amplitude.

• Analog (continuous-time) signal has some value defined at


every time instant, so it has infinite number of sample
points.

11-Oct-24 7
Analog to Digital Conversion
Sample & Hold (Sampler)

• It is impossible to digitize an infinite number of points.

• The infinite points cannot be processed by the digital signal


(DS) processor or computer, since they require an infinite
amount of memory and infinite amount of processing power
for computations.

• Sampling is the process to reduce the time information or


sample points.

11-Oct-24 8
Analog to Digital Conversion
Sample & Hold (Sampler)

• The first essential step in analog-to-digital (A/D) conversion is


to sample an analog signal.

• This step is performed by a sample and hold circuit, which


samples at regular intervals called sampling intervals.

• Sampling can take samples at a fixed time interval.

• The length of the sampling interval is the same as the


sampling period, and the reciprocal of the sampling period is
the sampling frequency fs.

11-Oct-24 9
Analog to Digital Conversion
Sample & Hold (Sampler)

11-Oct-24 10
Analog to Digital Conversion
Sample & Hold (Sampler)

11-Oct-24 11
Analog to Digital Conversion
Sample & Hold (Sampler)

• After a brief acquisition time, during which a sample is


acquired, the sample and hold circuit holds the sample
steady for the remainder of the sampling interval.
• The hold time is needed to allow time for an A/D converter to
generate a digital code that best corresponds to the analog
sample.
• If x(t) is the input to the sampler, the output is x(nT), where T
is called the sampling interval or sampling period.
• After the sampling, the signal is called “discrete time
continuous signal” which is discrete in time and continuous in
amplitude.

11-Oct-24 12
Analog to Digital Conversion
Sample & Hold (Sampler)

11-Oct-24 13
Analog to Digital Conversion
Sample & Hold (Sampler)
Figure below shows an analog (continuous-time) signal (solid
line) defined at every point over the time axis (horizontal line)
and amplitude axis (vertical line).
Hence, the analog signal contains an infinite number of points.

11-Oct-24 14
Analog to Digital Conversion
Sample & Hold (Sampler)
• Each sample maintains its voltage level during the sampling
interval ࢀ to give the ADC enough time to convert it.
• This process is called sample and hold.

11-Oct-24 15
Nyquist–Shannon Sampling Theorem
The sampling theorem guarantees that an analogue signal
can be perfectly recovered as long as the sampling rate is at
least twice as large as the highest-frequency component of
the analogue signal to be sampled.

11-Oct-24 16
Nyquist–Shannon Sampling Theorem

11-Oct-24 17
Nyquist–Shannon Sampling Theorem
Examples

11-Oct-24 18
Nyquist–Shannon Sampling Theorem
Example: For the following analog signal, find the Nyquist sampling rate,
also determine the digital signal frequency and the digital signal

11-Oct-24 19
Nyquist–Shannon Sampling Theorem
Example: Find the sampling frequency of the following signal.

So sampling frequency should be

11-Oct-24 20
Nyquist–Shannon Sampling Theorem

Exercise

Determine the Nyquist sampling rate of a signal


x(t) = 3sin(5000t + 17o)

11-Oct-24 21
11-Oct-24 22
Aliasing

How many hertz can the human eye see?

Most don't notice unless it is under 50 or 60 Hz.

Generally, people notice when the frame-rate is less than the refresh rate of the
display.
11-Oct-24 23
Aliasing
• When the minimum sampling rate is not respected,
distortion called aliasing occurs.

• Aliasing causes high frequency signals to appear as lower


frequency signals.

• To be sure aliasing will not occur, sampling is always


preceded by low pass filtering.

• The low pass filter, called the anti-aliasing filter, removes all
frequencies above half the selected sampling rate.

11-Oct-24 24
Aliasing
• Figure illustrates sampling a 40 Hz sinusoid
• The sampling interval between sample points is T = 0.01
second, and the sampling rate is thus fs = 100 Hz.
• The sampling theorem condition is satisfied

11-Oct-24 25
Aliasing
• Figure illustrates sampling a 90 Hz sinusoid
• The sampling interval between sample points is T = 0.01
second, and the sampling rate is thus fs = 100 Hz.
• The sampling theorem condition is not satisfied

11-Oct-24 26
Aliasing

11-Oct-24 27
Sampling Effect in Time Domain

Example of Aliasing in the


time domain of various
sinusoidal signals ranging
from 10 kHz to 80 kHz with a
sampling frequency Fs = 40
kHz.

11-Oct-24 28
Time & Frequency Domains
• There are two complementary signal descriptions.
• Signals seen as projected onto time or frequency domains.

11-Oct-24 29
Time & Frequency Domains

11-Oct-24 30
Frequency Range of Analog & Digital Signals

• For analog signals, the frequency range is from -∞ Hz to ∞ Hz

• For digital signals, the frequency range is from 0 Hz to Fs/2 Hz

11-Oct-24 31
Sampling theorem in the frequency domain
In practice this can help us to:

1. Design the anti-aliasing filter (a lowpass filter that will


reject high frequencies that cause aliasing) to be applied
before sampling,

2. And the anti-image filter (a reconstruction lowpass filter


that will smooth the recovered sample-and-hold voltage
levels to an analog signal) to be applied after the digital-to-
analog conversion (DAC)

11-Oct-24 32
Sampling theorem in the frequency domain

Pulse train is a periodic signal with impulses centered at integers


multiples of a sampling period T

11-Oct-24 33
Sampling theorem in the frequency domain

Fourier series

Fourier Transform
Original spectrum

Shifted versions (replicas)


(HW)

11-Oct-24 34
Sampling theorem in the frequency domain

11-Oct-24 35
(reconstruction)

݂‫ ݏ‬− ‫ܤ > ܤ‬
ࢌ࢙ > ૛࡮

11-Oct-24 36
 If applying a lowpass reconstruction filter to obtain exact reconstruction of the
original signal spectrum, the following condition must be satisfied:

Shannon sampling theorem


Summary:

 Sampling theorem establishes a minimum sampling rate for sampling a


given band limited analog signal with the highest frequency component
of fmax

 If the sampling condition is satisfied, then the analog signal can be


recovered via its sampled values

 The half of the sampling frequency = Nyquist frequency (Nyquist limit) =


folding frequency

11-Oct-24 37
Review of Fourier series and FT

Considering a real signal x(t), (x(t) is not a


complex function)

11-Oct-24 38
Example:

Solution: Amplitude = 5, f = 1 kHz


a- Since the analog signal is sinusoid with a peak value of 5 and frequency of 1000 Hz,
we can write the sine wave using Euler’s identity:

The Fourier series coefficients

11-Oct-24 39
The spectrum of original frequency:

b- After the analog signal is sampled at the rate of 8000 Hz, the sampled signal
spectrum and its replicas centered at the frequencies ±kfs, each with the scaled
amplitude being 2.5/T

Must be removed, since they convey no additional information


11-Oct-24 40
Example:

The two-sided
amplitude
spectrum for
the sinusoid

11-Oct-24 41
11-Oct-24 42
11-Oct-24 43
Practical consideration for signal sampling
Design of the Anti-Aliasing Filter
• Anti-aliasing filters are analog filters.
• They process the signal before it is sampled.
• In most cases, they are also low-pass filters unless band-
pass sampling techniques are used.

11-Oct-24 44
Design of the Anti-Aliasing Filter

The shape of each replica in the sampled signal spectrum is the same as that of
the anti-aliasing filter magnitude frequency response.

 To control the aliasing noise level:

 A higher-order lowpass filter (i.e. Butterworth filter)


 Increasing the sampling rate.

11-Oct-24 45
Example: Butterworth Filter
• The Butterworth magnitude frequency response with an order of n is given by:

• For a second-order Butterworth lowpass filter with the unit gain, the transfer
function and its magnitude frequency response are given by:

11-Oct-24 46
Second-order unit-gain Sallen-Key lowpass filter

11-Oct-24 47
i1

Vo
i=0
i i2 Vo ࢏ = ࢏ ૚ + ࢏૛

ܸ௜௡ − ܸ
݅=
Assume the ܴଵ
voltage at ܸ − ܸ௢
this node is V ݅ଵ =
ܼ௖ଶ

ܸ − ܸ௢ ܸ ܸ௢ ܴଶ + ܼ௖ଵ
݅ଶ = = = ≫≫ ܸ = ܸ௢
ܴଶ ܴଶ + ܼ௖ଵ ܼ௖ଵ ܼ௖ଵ

࢏ = ࢏ ૚ + ࢏૛

૚ ࢂ࢏࢔ − ࢂ ࢂ − ࢂ࢕ ࢂ − ࢂ࢕
ࢆࢉ = = +
࢙࡯ ࡾ૚ ࡾ૛ ࢆࢉ૛

ࡾ૛ + ࢆࢉ૚ ࡾ + ࢆࢉ૚ ࡾ + ࢆࢉ૚


ࢂ࢏࢔ − ࢂ࢕ ࢂ࢕ ૛ − ࢂ࢕ ࢂ࢕ ૛ − ࢂ࢕
ࢆࢉ૚ ࢆࢉ૚ ࢆࢉ૚
= +
ࡾ૚ ࡾ૛ ࢆࢉ૛
11-Oct-24 48
11-Oct-24 49
Assuming a sampling rate of 8000 Hz is used, and the anti-aliasing filter is a second-
order Butterworth lowpass filter with a cutoff frequency of 3.4 kHz:

(a) Determine the percentage of aliasing level at the cutoff frequency.


(b) Determine the percentage of aliasing level at the frequency of 1000 Hz

11-Oct-24 50
Assuming a sampling rate of 16,000 Hz is used, and the anti-aliasing filter is a
second-order Butterworth lowpass filter with a cutoff frequency of 3.4 kHz:

11-Oct-24 51
Given the DSP system with a sampling rate of 40,000 Hz is used, the antialiasing filter is the
Butterworth lowpass filter with a cutoff frequency 8 kHz, and the percentage of aliasing level
at the cutoff frequency is required to be less than 1%, determine the order of the anti-aliasing
lowpass filter

11-Oct-24 52
11-Oct-24 53
Signal Reconstruction
Review : A block diagram for a DSP system

11-Oct-24 54
Zero-order Hold Circuit (ZOH)

11-Oct-24 55
Practical consideration of signal reconstruction
Hold transfer function

Frequency Response

11-Oct-24 56
Sample-and-hold lowpass filtering effect

The magnitude frequency


response of the sampled and
hold signal

11-Oct-24 57
• The magnitude frequency response acts like lowpass filtering and shapes the
sampled signal spectrum of Ys(f ). This shaping effect distorts the sampled signal
spectrum Ys(f ) in the desired frequency band.

• The spectral images are attenuated due to the lowpass effect of sin(x)/x. This
sample-and-hold effect can help us design the anti-image filter.

• Since the magnitude frequency response of the sampled signal using an ideal
sampler is T|Ys(f )|, therefore, the spectral distortion at the recovery stage can
be derived as

 The percentage of distortion in the desired frequency band is given by

11-Oct-24 58
11-Oct-24 59
Example:

11-Oct-24 60
11-Oct-24 61
11-Oct-24 62
Under Sampling
• If the sampling rate is lower than the required Nyquist rate,
that is fS < 2W, it is called under sampling.

• In under sampling images of high frequency signals


erroneously appear in the baseband (or Nyquist range) due
to aliasing.

11-Oct-24 63
Sampling of Band Limited Signals
Signals whose frequencies are restricted to a narrow band of
high frequencies can be sampled at a rate similar to twice the
Bandwidth (BW) instead of twice the maximum frequency.

Fs ≥ BW

11-Oct-24 64
Sampling of Band Limited Signals
• While this under-sampling is normally avoided, it can be
exploited.
• For example, in the case of band limited signals all of the
important signal characteristics can be deduced from the
copy of the spectrum that appears in the baseband through
sampling.
• Depending on the relationship between the signal
frequencies and the sampling rate, spectral inversion may
cause the shape of the spectrum in the baseband to be
inverted from the true spectrum of the signal.

11-Oct-24 65
Sampling of Band Limited Signals

Figure: Signal recovered


From Nyquist range are
Base band versions of the
Original signal. Sampling rate is
Important to make sure no aliasing
and spectral inversion occurs.

(a) Fs = 80 kHz, signal spectrum


is Inverted in the baseband.

(b) Fs = 100 kHz, the lowest


Frequencies In the signal alias
to the highest frequencies.

(c) Fs = 120 kHz, No spectral


Inversion occurs.

11-Oct-24 66
Over Sampling

• Oversampling is defined as sampling above the minimum


Nyquist rate, that is, fS > 2fmax.

• Oversampling is useful because it creates space in the


spectrum that can reduce the demands on the analog anti-
aliasing filter.

11-Oct-24 67
Over Sampling
• In the example below, 2x oversampling means that a low order analog
filter is adequate to keep important signal information intact after
sampling.
• After sampling, higher order digital filter can be used to extract the
information.

11-Oct-24 68
Over Sampling
• The ideal filter has a flat pass-band and the cut-off is very
sharp, since the cut-off frequency of this filter is half of that
of the sampling frequency, the resulting replicated spectrum
of the sampled signal do not overlap each other. Thus no
aliasing occurs.
• Practical low-pass filters cannot achieve the ideal
characteristics.
• Firstly, this would mean that we have to sample the filtered
signals at a rate that is higher than the Nyquist rate to
compensate for the transition band of the filter

11-Oct-24 69
Spectra of Sampled signals

Figure: Signal ‘s Spectra


(i) Over sampled
(ii) Nyquist Rate
(iii) Under Sampled

11-Oct-24 70
Sampling Low Pass Signals

11-Oct-24 71
Exercise
Exercise-1: If the 20 kHz signal is under-sampled at 30 kHz, find the
aliased frequency of the signal.

Exercise-2: A voice signal is sampled at 8000 samples per second.


i. What is the time between samples?
ii. What is the maximum frequency that will be recovered from the
signal?

Exercise-3: An analog Electromyogram (EMG) signal contains useful


frequencies up to 3000 Hz.
i. Determine the minimum required sampling rate to avoid aliasing.
ii. Suppose that we sample this signal at a rate of 6500 samples/s.
what is the highest frequency that can be represented uniquely at
this sampling rate?

11-Oct-24 72
Exercise
Exercise-4: Humans can hear sounds at frequencies between 0 and 20
kHz. What minimum sampling rate should be chosen to permit perfect
recovery from samples?

Exercise-5: An ECG signal is sampled at 250 samples per second.


i. What is the time between samples?
ii. What is the maximum frequency that will be recovered from the
signal?

Exercise-6: An ultrasound signal ranging in frequency from 900 kHz to


900.5 kHz is under-sampled at 200 kHz. If a 200 Hz target appears in
the baseband, what is the actual frequency of the target?

11-Oct-24 73
11-Oct-24 74
Analog to Digital Conversion (ADC)

11-Oct-24 75
Analog to Digital Conversion
There are several ways to implement ADC. The most common ones are
Successive
Feature Flash ADC Sigma-Delta ADC
Approximation ADC
Converts analog input into digital
Converts analog input into digital
output by using a comparator array Iteratively approximates the input
output by oversampling and
Operating Principle that directly compares the input voltage by successively narrowing
using a feedback loop to
voltage with multiple reference down the possible output values.
continuously adjust the output.
voltages simultaneously.
Relatively slow due to
Very fast, usually in the range of 1 Moderate speed, suitable for a oversampling and filtering,
Conversion Speed
to 10 nanoseconds. wide range of applications. typically measured in
milliseconds.
High resolution, typically ranging High resolution, commonly Extremely high resolution, often
Resolution
from 8 to 16 bits. ranging from 8 to 24 bits. exceeding 24 bits.
High accuracy, as all reference High accuracy, with each bit
Excellent accuracy due to
Accuracy voltages are compared to the input decision based on the previous
oversampling and noise shaping.
simultaneously. bit's result.
High complexity, requiring a large Moderate complexity, requiring a Moderate complexity but
Complexity number of comparators and digital-to-analog converter (DAC) requires digital filtering and a
precise voltage references. and a comparator for each bit. high-precision analog front end.
Typically, higher power
Moderate power consumption, as
consumption due to the Lower power consumption
Power Consumption it operates in a sequential
simultaneous comparison of many compared to other ADC types.
manner.
reference voltages.
Commonly used in applications
Used in applications where speed
Versatile and suitable for general- that prioritize high-resolution
and high resolution are crucial,
purpose applications, including measurements and can tolerate
Applications such as high-speed
microcontrollers and data slower sampling rates, such as
communications, radar, and high-
acquisition systems. precision sensors and audio
end instrumentation.
equipment.
11-Oct-24 76
2-bit Flash ADC
Assume input voltage = 3 V

11-Oct-24 77
Analog to Digital Conversion

• The A/D converter chooses a quantization level for each


analog sample.
• Number of levels of quantizer is equal to L = 2N
• An N-bit converter chooses among 2N possible quantization
levels.
• So 3 bit converter has 8 quantization levels, and 4 bit
converter has 8 quantization levels.

11-Oct-24 78
Analog to Digital Conversion
• The quantization step size or the ADC resolution (Δ): is the distance between
two successive quantization levels, (it is also defined as Vmin (minimum
detectable voltage) or the LSB value of the ADC)

Full scale
ࢄ࢓ࢇ࢞ − ࢄ࢓࢏࢔ analogue range
∆=
૛࢓
• Xmax and Xmin are the maximum value and minimum values, respectively,
of the analog input signal X , and m is the number of bits used by the
converter.

i : is an index corresponding to the binary code.


Xq: indicates the quantization level (voltage).

11-Oct-24 79
Example:
If a 3-bit ADC channel accepts analog input ranging from 0 to 5V, determine the following:

(a) Number of quantization levels


(b) Step size of quantizer or resolution
(c) Quantization level when the analog voltage is 3.2V
(d) Binary code produced by the ADC.

Solution

a)

b)

c)

d)

11-Oct-24 80
Quantization Error

• The error caused by representing a continuous-valued signal


(infinite set) by a finite set of discrete-valued levels.
• The larger the number of quantization levels, the smaller
the quantization errors.
• The quantization error is calculated as the difference
between the quantized level and the true sample level.
• Most quantization errors are limited in size to half a
quantization step Q or Δ .

11-Oct-24 81
Quantization Error
• The quantization error is calculated as the difference between the quantized
level and the true sample level.

• Most quantization errors are bounded in size to half a quantization step (Δ).

Example: Determine the quantization error when the analog input is 3.2V

Solution

The quantization error is less than


the half of the step size, that is

11-Oct-24 82
Analog to Digital Conversion
• Let's consider the signal which is to be quantized.

In the figure, we can see that there is a difference between the original signal (Blue
Line) and the quantized signal (Red Lines). This is the error produced while
quantization
11-Oct-24 83
Analog to Digital Conversion
Quantization error can be reduced, however, if the number of quantization levels is
increased as illustrated in the figure

11-Oct-24 84
Analog to Digital Conversion

Bipolar quantizer: Unipolar quantizer:


Deals with analog signals ranging from negative Deals with analog signals ranging from 0V to
to a positive reference voltages. a positive reference voltage.

11-Oct-24 85
Three-bit A/D Conversion

11-Oct-24 86
Dynamic Range
• Quantization errors can be determined by the quantization step.
• Quantization errors can be reduced by increasing the number of bits
used to represent each sample.
• Unfortunately, these errors can not be entirely eliminated, and their
combined effect is called quantization noise.

• The dynamic range of the quantizer is the number of levels it can


distinguish in noise.

• It is a function of the range of signal values and the range of error


values, and is expressed in decibels, dB.

ࢄ࢓ࢇ࢞ ି ࢄ࢓࢏࢔
ࡰ࢟࢔ࢇ࢓࢏ࢉ ࡾࢇ࢔ࢍࢋ = ૛૙࢒࢕ࢍ = 20log (2m) = 6.02 x m dB

11-Oct-24 87
Signal-to-Quantization-Noise Ratio
Assuming that eq is a uniformly distributed random variable which has a range within
a quantized interval Δ and has the following probability density function, f(eq)

The quantized noise power can be derived as

11-Oct-24 88
Signal-to-Quantization-Noise Ratio
The ratio of signal power to quantization noise power (SNR) due to quantization
can be expressed as

The SNR in terms of decibels (dB):

11-Oct-24 89
Example:

11-Oct-24 90
Digital-to-Analog (D/A) Conversion
Block Diagram of D/A Conversion

11-Oct-24 91
Digital-to-Analog (D/A) Conversion
• Once digital signal processing is complete, digital-to-analog
(D/A) conversion must occur.
• This process begins by converting each digital code into an
analog voltage that is proportional in size to the number
represented by the code.
• This voltage is held steady through zero order hold until the
next code is available, one sampling interval later.

• This creates a staircase-like signal that contains frequencies


above W Hz.

• These signals are removed with a smoothing analog low pass


filter, the last step in D/A conversion.

11-Oct-24 92
Digital-to-Analog (D/A) Conversion
• In the frequency domain, the high frequency elements
present in the zero-order hold signal appear as images,
copies of the original signal spectrum situated around
integer multiples of the sampling frequency.

• The smoothing analog filter removes these images and so is


given the name of Anti-Imaging Filter.

• Only the frequencies in the baseband, between 0 and fS/2


Hz, remain.

11-Oct-24 93
Digital-to-Analog (D/A) Conversion
Three bit D/A Conversion

11-Oct-24 94
Summary

11-Oct-24 95
Summary

11-Oct-24 96

You might also like