You are on page 1of 53

Biomedical Digital Signal

Processing BDSP-513
Lecture 2

Signal Sampling - A/D and D/A conversion


Dr. Mahbubunnabi Tamal

1
Overview
› Digital Signal Processing System

› Analog to Digital Conversion

› Nyquist–Shannon Sampling Theorem

› Aliasing

› Anti Aliasing Filter

› Sampling of Band Limited Signals

› Over-sampling

› Digital to Analog Conversion


2
Sampling of continuous signal
› 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).

3
Sampling of continuous signal
› An analog (continuous-time) signal defined at every point over the time
axis and amplitude axis.

› An analog signal contains an infinite number of points  It is impossible


to digitize an infinite number of points  the infinite points are not
appropriate to be processed by the digital signal (DS) processor or
computer  since they require infinite amount of memory and infinite
amount of processing power for computations.

› Sampling can solve such a problem by taking samples at the fixed time
interval T (represents the sampling interval or sampling period in
4
Sampling of continuous signal: Sample & hold
› 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.

5
Nyquist–Shannon Sampling Theorem
› If an analog signal is not appropriately sampled, aliasing will occur, which
causes unwanted signals in the desired frequency band.

› 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.

Where is the maximum-frequency component of the analog signal to be


sampled.
6
Nyquist–Shannon Sampling Theorem
› For a given sampling interval T, which is defined as the time span
between two sample points, the sampling rate is therefore given by:

samples per second (Hz)

› For example: if a sampling period is T = 125 microseconds, the sampling


rate is determined as :

= 1/125 8,000 samples per second (Hz).

7
Nyquist–Shannon Sampling Theorem
› Examples:

8
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.

Analog signal

9
Nyquist–Shannon Sampling Theorem
Example: Find the sampling frequency of the following signal.

So sampling frequency should be


10
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
Aliasing
› Figure illustrates sampling a 40 Hz sinusoid
› The sampling interval between sample points is T = 0.01s
and the sampling rate is thus fs = 100 Hz.
› The sampling theorem condition is satisfied

12
Aliasing
› Figure illustrates sampling a 90 Hz sinusoid

› The sampling interval between sample points is T = 0.01 s, and the


sampling rate is thus fs = 100 Hz.

› The sampling theorem condition is not satisfied

13
Sampling Low Pass Signals

14
Example 1

15
Solution 1

16
Solution 1

17
Example 2

18
Solution 2

19
Solution 2

20
Anti-aliasing Filtering

› In practice, the analog signal to be digitized may contain other frequency

components in addition to the folding frequency, such as high-frequency

noise.

› To satisfy the sampling theorem condition, we apply an anti-aliasing filter

to limit the input analog signal, so that all the frequency components are

less than the folding frequency (half of the sampling rate).

21
Anti-Aliasing Filtering

Due to nonzero attenuation of the magnitude frequency response of the anti- aliasing lowpass filter, the
aliasing noise from the adjacent replica still appears in the baseband.

We can also control the aliasing noise level by either using a higher-order lowpass filter or
increasing the sampling rate.
22
Aliasing noise level %
› According to Figure in Slide 22, we can derive the percentage of the
aliasing noise level using the symmetry of the Butterworth magnitude
function (which will be discussed in Chapter 8) and its first replica. It
follows that
Butterworth magnitude function

Using the above equation, we can estimate the aliasing noise level, or
choose a higher-order anti-aliasing filter to satisfy the requirement for the
percentage of aliasing noise level. 23
Example 1
Given the DSP system shown in Figures 2.16 to 2.18, where a sampling rate
of 8,000 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 1,000 Hz.

24
Solution 1

25
Example 2
› Given the DSP system, where 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, determine the percentage of aliasing level at
the cutoff frequency.

26
Solution 2

27
Example 3
› Given the DSP system shown in Figure 2.16, where a sampling rate of
40,000 Hz is used, the anti-aliasing filter is a Butterworth lowpass filter
with a cutoff frequency of 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.

28
Solution 3

29
Anti-Image Filter

The DAC unit converts the processed digital signal y(n) to a sampled signal y s(t), and then the hold
circuit produces the sample-and-hold voltage yH (t). The transfer function of the hold circuit can be
derived to be:

30
Distortion %
› The magnitude and phase responses are given by:

› 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, as illustrated in Figure 2.21. On the other hand, 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.

31
A/D, D/A conversion and quantization

32
Quantization
› After the sampling, the discrete time continuous signal still carry infinite
information (can take any value) in terms of amplitude.

› Quantization is the process to reduce infinite information of the amplitude.

› Quantizer do the conversion of discrete time continuous valued signal into


a discrete-time discrete-value signal.

› The value of each signal sample is represented by a value selected from a


finite set of possible values.

The process of converting analog signal with infinite precision to finite


precision is called the quantization process. 33
Quantization

› The A/D converter chooses a quantization level for each analog sample.

› Number of levels of quantizer is equal to L = 2m

› An m-bit converter chooses among 2m possible quantization levels.

› Example: If the DP has only a 3-bit word, the amplitude can be converted

into 8 quantization levels.


34
Quantization
› Two type of quantizer:

– Unipolar: deals with analog signal ranging from 0 to a + reference.

– Bipolar: deals with analog signal ranging from – reference to a + reference.

35
Quantization
The quantization step size or resolution is calculated as:

Δ= Where,

R is the full scale range of the analog signal (i.e. Xmax - Xmin)

m is the number of bits used in ADC


L= 2m the number of quantization level
Resolution of a quantizer Δ is the distance between two successive quantization levels.
) is the index corresponding to the binary code
for i= 0,1,2,……………………………………..L-1, where indicate the quantization level

› More quantization levels, a better resolution!

The strength of the signal compared to that of the quantization errors is measured by
36
dynamic range and signal-to-noise ratio.
Quantization: Example
Example: Analog pressures are recorded using a pressure transducer as voltages between
0 and 3 V. The signal must be quantized using a 3-bit digital code. Indicate how the
analog voltages will be covered to digital values.

The quantization step size is = 0.375 V

The half of quantization step is


0.1875 V

37
Quantization: example

38
Solution

39
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 Δ .
40
Quantization Error

When DAC outputs the analog amplitude with finite precision, it

introduces the quantization error, defined as:

The quantization errors is bounded by half of the step size that is:

41
Quantization Error

Based on the theory of probability and random variables, the power of

quantization noise is related to the quantization step and given by:

The ratio of signal power to quantization noise power SNR due to

quantization can be expressed as:


› where,  root mean square

42
Three-bit A/D Conversion

43
Quantization Error
Quantization error can be reduced, however, if the number of quantization
levels is increased as illustrated in the figure

44
Quantization error: example
› Using the previous Example, determine the quantization error when the
analog input is 3.2 volts.

› Solution:

45
Quantization error: example

Solution
2A/2m

46
Quantization error: example

Solution

47
Digital-to-Analog (D/A) Conversion
Block Diagram of 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.
48
Digital-to-Analog (D/A) Conversion

› 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 M Hz.

› These signals are removed with a smoothing analog low pass filter, the
last step in D/A conversion. 49
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.

50
Summary

› Analog signal: continuous in time and can assume an infinite No. of

values in a given range (continuous in time and value)

› Discrete (digital) signal: signal that is discrete in time and can assume

only a limited number of values (maintains a constant level and then

changes to another constant level).

51
Summary

52
Summary

53

You might also like