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

Sampling

Uploaded by

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

Sampling

Uploaded by

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

Digital Signal Processing

Applications
HETT403

Eng. Matsiya B
brianmatsiya@gmail.com
ANALOG-TO-DIGITAL AND DIGITAL-TO-ANALOG
CONVERSION
Sampling, Quantization & Coding
Elements of a Digital Signal Processing System
Most of the signals encountered in science and engineering are analog in
nature, i.e. the signals are functions of a continuous variable, such as time
or space, and usually take on values in a continuous range.
Such signals may be processed directly by appropriate analog systems
(such as filters or frequency analyzers) or frequency multipliers for the
purpose of changing their characteristics or extracting some desired
information.
In such a case we say that the signal has been processed directly in its
analog form, as illustrated in Fig. 2.1.
Fig 2.1: Analog Signal processing
In Fig 2.1 both the input signal and the output signal are in analog form.
Digital Signal processing System
Digital signal processing provides an alternative method for processing the
analog signal, as illustrated in Fig.2.2.

Fig 2.2: A Block diagram illustration of a digital signal processing system


To perform the processing “digitally”, there is a need for an interface
between the analog signal and the digital processor. This interface is
called a analog-to-digital (A/D) converter or “ADC”.
The output of the A/D converter is a digital signal that is appropriate as an
input to the digital signal processor.

In applications where the digital output from the digital signal processor is to be
given to the user in analog form, such as in speech and visual communications,
we must provide another interface from the digital domain to the analog domain.
Such an interface is called a digital-to-analog (D/A ) converter or DAC.
Application of ADC
 In the modern world of growing technology, we are dependent on digital devices. These digital
devices operate on the digital signal. But not every quantity is in digital form instead they are in
analog form. So an ADC is used for converting analog signals into digital signals.
The applications of ADC are limitless. Some of these applications given below
 Cell phones operate on the digital voice signal. Originally the voice is in analog form, which is
converted through ADC before feeding to the cell phone transmitter.
 Images and videos captured using camera is stored in any digital device, is also converted into
digital form using ADC.
 Medical Imaging like x-ray & MRI also uses ADC to convert images into Digital form before
modification. They are then modified for better understanding.
 Music from the cassette is also converted into the digital form such as CDs and thumb
drives using ADC converters.
 Digital Oscilloscope also contains ADC for converting Analog signal into a digital signal for display
purposes & different other features.
 Air conditioner contains temperature sensors for maintaining the room temperature. This
temperature is converted into digital form using ADC so that onboard controller can read & adjust
the cooling effect
ANALOG-TO-DIGITAL CONVERSION (ADC)

Most signals of practical interest, such as speech, biological signals, seismic signals, radar signals, sonar signals, and
various communications signals such as audio and video signals, are analog. To process these signals “digitally”, it is first
necessary to convert them into digital form. This procedure is called analog-to-digital (A/D) conversion, and the
corresponding devices are called A/D converters (ADCs). Conceptually, we view A/D conversion as a three-step process.
This process is illustrated in Fig. 2.3.

Fig 2.3: Components of an analog to digital convertor (ADC).


Sampling
This is the conversion from a continuous-time signal in to a discrete-time
signal obtained by taking “samples’" of the continuous-time signal at discrete-
time instances.
Thus, if 𝑥𝑎 (𝑡) is the input to the sampler, the output is therefore,
𝑥𝑎 𝑛𝑇 = 𝑥(𝑛), where 𝑇 and is called the sampling interval and 𝑛 is an integer.
Quantization
This is the conversion from a discrete-time continuous-valued signal into a
discrete-time, discrete-valued (digital) signal.
The value of each signal sample is represented by a value selected from a finite set
of possible values.
The difference between the unquantized sample 𝑥(𝑛) and the quantized output
𝑥𝑞 𝑛 is called the quantization error.

Coding
In the coding process, each discrete value 𝑥𝑞 𝑛 is represented by a b-bit
binary sequence.
Although we model the ADC as a sampler followed by a quantizer and
coder, in practice the A/D conversion is performed by a single device
that takes an analog signal 𝑥𝑎 𝑡 and produces a binary-coded number.

The operations of sampling and quantization can be performed in either


order but in practice, sampling is always performed before quantization .
Sampling Process
 The sampling process is a basic operation in the digital communication.
 It is a processes of converting an analog signal into a sequence of digital values that
can be stored and manipulated by a computer
 So, the continuous-time analog signal is converted into a corresponding sequence
of samples that are usually spaced uniformly in time.
 This process involves taking a series of measurements of the analog signal at discrete
points in time and converting each measurement into a digital value. Sampling is an
important concept in digital signal processing, as it allows analog signals to be
processed and analyzed by a computer.
 It is necessary to choose the sampling rate properly, so the sequence of samples
uniquely defines the original analog signal.
Sampling Process

Let g(t) be a signal whose spectrum is band-limited to fm Hz

Sampling g(t) at a rate of fs Hz (fs samples per second) can be


accomplished by multiplying g(t) by an impulse train δTs(t),
consisting of unit impulses repeating periodically every Ts
seconds, where Ts = 1 / fs
Ts

sampling period

S(t) is band-
limited signal
Sampling Process

This results sampled signal ğ(t) consists of impulses spaced every


Ts seconds.
The nth impulse, located at t=n Ts has a strength g(nTs), the value
of g(t) at t = n Ts
Sampling of Analog signals

There are many ways to sample an analog signal but we limit our
discussion to periodic or uniform sampling, which is the type of
sampling used most often in practice.
Periodic sampling
This is the conversion from a continuous-time signal in to a discrete-time signal
obtained by taking “samples’" of the continuous-time signal at discrete-time instances.

In general, periodic sampling is described by the relation:

(2.1)

Where 𝑥(𝑛) is the discrete-time signal obtained by “taking samples”of


the analog signal 𝑥𝑎 𝑡 every 𝑻 seconds. This procedure is illustrated in
Fig. 2.5.
Fig 2.5: An illustration of periodic sampling of an analog signal
Sampling of Analog Signals
The time interval 𝑻 between successive samples is called the sampling
1
period or sample interval and its reciprocal = 𝐹𝑠 is called the sampling
𝑻
rate (samples per second) or the sampling frequency (hertz).

Periodic sampling establishes a relationship between the time variables 𝒕


and 𝒏 of continuous-time and discrete-time signals, respectively.
These variables are linearly related through the sampling period 𝑻 or,
1
equivalently, through the sampling rate 𝐹𝑠 = as;
𝑻
𝑛
𝑡 = 𝑛𝑇 = (2.2)
𝐹𝑠
As a consequence of the relationship between the time variables 𝒕 and 𝒏,
there exists a relationship between the frequency variable 𝑭 𝑜𝑟 (𝜴) for
analog signals and the frequency variable 𝒇 𝑜𝑟 (𝝎) for discrete-time
signals.
To establish this relationship, consider an analog sinusoidal signal of the form
(2.3)
1
Which, when sampled periodically at a rate 𝐹𝑠 = samples per second, yields:
𝑻

(2.4)
Comparing, (2.4) with:
(2.5)

Which is the expression for a discrete signal, one can note that the frequency variables 𝑭 and 𝒇 are linearly
related as

(2.6)

Or, equivalently, as (2.7)

where; 𝐹𝑠 = Sampling frequency


𝐹 = Frequency of the analog signal
𝑓 = Frequency of the digital signal
The relation in (2.6) justifies the term relative or normalized frequency,
which is sometimes used to describe the frequency variable 𝒇.
The relationship (2.6) implies, 𝒇 can be used to determine the frequency 𝑭
in hertz only if the sampling frequency, 𝑭𝒔 , is known.

The range of the frequency variable 𝑭 or Ω for continuous-time sinusoids


are
(2.8)

However, the situation is different for discrete-time sinusoids.


The range of the frequency variable 𝒇 or ω for discrete-time sinusoids
are;
(2.9)

By substituting from (2.6) and (2.7) into (2.9), we find that the frequency
1
of the continuous-time sinusoid when sampled at a rate 𝐹𝑠 = must fall
𝑻
in the range.

(2.10)
Or, equivalently.
(2.11)

These relations are summarized in Table 2.1


Table 2.1: Relations among frequency variables
From the relations in Table 2.1 we observe that the fundamental difference
between continuous-time and discrete-time signals is in their range of
values of the frequency variables 𝑭 and 𝒇, or Ω and ω.

Periodic sampling of a continuous-time signal implies a mapping of the


infinite frequency range for the variable 𝑭 (or Ω) into a finite frequency
range for the variable 𝒇 (or ω).

Since the highest frequency in a discrete-time signal is ω = π or = 1/2, it


follows that, with a sampling rate 𝑭𝒔 , the corresponding highest values of
𝑭 and Ω are
(2.11)

Therefore , sampling introduces an ambiguity, since the highest frequency


in a continuous-time signal that can be uniquely distinguished when such
a signal is sampled at a rate of:
Case 1
The implications of these frequency relations can be fully appreciated by
considering the two analog sinusoidal signals;

which are sampled at a rate Fs = 40 Hz; The corresponding discrete-time


signals or sequences are:
5𝜋𝑛 𝜋𝑛 𝜋𝑛
However, cos = cos 2𝜋𝑛 + = cos
2 2 2
Hence 𝑥2 𝑛 = 𝑥1 𝑛 ; Thus the sinusoidal signals are identical and, consequently,
indistinguishable.
In general, the sampling of a continuous-time sinusoidal signal:

with a sampling rate Fs = 1/T results in a discrete-time signal:


𝐹0
Where 𝑓0 = , is the relative frequency of the sinusoid.
𝐹𝑠
𝑭𝒔 𝑭𝒔 𝟏 𝟏
If we assume that − ≤ 𝑭𝟎 ≤ ,
then the frequency f0 of x(n) is in the range − ≤ 𝒇𝟎 ≤
𝟐 𝟐 𝟐 𝟐
which is the frequency range for discrete-time signals.
Aliasing

What happens if we sample the signal at a frequency that is lower that


the
Nyquist rate?
If the Nyquist criterion is not satisfied, the adjacent copies of g(t)
spectrum will overlap, this phenomenon called aliasing
Aliasing

With aliasing :
- Some of the frequencies in the original signal will be lost in the
reconstructed signal
- unwanted components will be presence in the
reconstructed signal. these components were not present
when the original signal was sampled.
In addition,.
Aliasing occurs because signal frequencies will overlap if the
sampling frequency is too low.
Aliasing
Aliasing of a undersampled 1D
sinusoidal signal

Aliasing of a undersampled 2D
image

© 2002 R. C. Gonzalez & R. E. Woods


Aliasing

From the previous case, if we are given the sampled values generated by
𝜋𝑛
𝑐𝑜𝑠 there is some ambiguity as to whether these sampled values
2
correspond to 𝑥1 (𝑡) or 𝑥2 (𝑡).
This is a common problem in digital signal process.
Aliasing in digital signal process

Since 𝑥2 (𝑡) yields exactly the same values as 𝑥1 (𝑡) when the two are sampled at
Fs = 40 samples per second, we say that the frequency F2 = 50 Hz is an alias of the
frequency F1 = 10 Hz at the sampling rate of 40 samples per second.
It is important to note that F2 is not the only alias of F1.

In fact at the sampling rate of 40 samples per second, the frequency F3 = 90 Hz is also an alias
of F1, as is the frequency F4 = 130 Hz, and so on.
All of the sinusoids 𝑐𝑜𝑠2𝜋 𝐹1 + 40𝑘 𝑡, k = 1, 2, 3, 4, .... sampled at 40 samples per second,
yield identical values. Consequently, they are all aliases of F1= 10 Hz.
In general, sampling a continuous-time sinusoidal signal;
𝑥𝑎 𝑡 = 𝐴𝑐𝑜𝑠(2𝜋𝐹0 + 𝜃)
with a sampling rate 𝐹𝑠 , results in a discrete-time signal;
𝑥 𝑛 = 𝐴𝑐𝑜𝑠(2𝜋𝑓0 𝑛 + 𝜃)

If we assume that − 𝐹𝑠ൗ2 ≤ 𝐹0 ≤ 𝐹𝑆ൗ2, then the frequency 𝑓0 is in the range;


− 1Τ2 ≤ 𝑓0 ≤ 1Τ2

In this case, the relationship between 𝐹0 and 𝑓0 is one-to-one, and hence it is possible to
reconstruct the analog signal 𝑥𝑎 𝑡 from the sample 𝑥 𝑛 .
On the other hand, if the sinusoids

where

are sampled at a rate 𝐹𝑠 , it is clear that the frequency 𝐹𝑘 is outside the


fundamental frequency range −𝐹𝑠/2 ≤ 𝐹 ≤ 𝐹𝑠/2 .
Consequently, the sampled signal is:

Thus an infinite number of continuous-time sinusoids is represented by the same


discrete-time signal.
Since 𝐹𝑠/2. which corresponds to 𝜔 = 𝜋, is the highest frequency that can
be represented uniquely with a sampling rate 𝐹𝑠.

To determine the mapping of any (alias) frequency above 𝐹𝑠/2 (𝜔


= 𝜋) in to the equivalent frequency below 𝐹𝑠/2, we can use 𝐹𝑠/2 or 𝜔
= 𝜋 as the pivotal point and reflect or “fold” the alias frequency to the
range 0 ≤ 𝜔 ≤ 𝜋.

Since the point of reflection is 𝐹𝑠/2 (𝜔 = 𝜋), the frequency 𝐹𝑠/2 (𝜔


= 𝜋) is called the folding frequency
Practice Example 2.1
a. Consider the analog signal;
Determine the minimum sampling rate required to avoid aliasing
b. Suppose the signal is sampled at a rate 𝐹𝑠 = 200𝐻𝑧. What is the
discrete-time signal obtained after sampling?
c. Suppose the signal is sampled at a rate 𝐹𝑠 = 75 𝐻𝑧. What is
the discrete-time signal obtained after sampling?
𝐹𝑠
d. What is the frequency 0 < 𝐹 < of a sinusoid that yields
2
samples identical to those obtained in part c. ?
Solution 2.1
Solution 2.1
Sampling Theorem

Given any analog signal, how should we select the sampling period T or, equivalently, the sampling rate 𝑭𝒔 ?
To answer this question, we must have some information about the characteristics of the signal to be sampled.
In particular, we must have some general information concerning the frequency content of the signal.
Sampling Theorem
The information content of such signals is contained in the amplitudes, frequencies, and
phases of the various frequency components, but detailed knowledge of the characteristics of
such signals is not available to us prior to obtaining the signals.
In fact, the purpose of processing the signals is usually to extract this detailed information.

However, if we know the maximum frequency content of the general class of signals (e.g.. the
class of speech signals, the class of video signals, etc.). we can specify the sampling rate
necessary to convert the analog signals to digital signals.

For example, we know generally that the major frequency components of a speech signal fall
below 3200Hz.
On the other hand, television signals, in general, contain important frequency components up
to 5MHz.
Sampling Theorem
Let us suppose that any analog signal can be represented as a sum of sinusoids of different
amplitudes, frequencies, and phases, that is;

Where N denotes the number of frequency components. All signals, such as speech and
video, lend themselves to such a representation over any short time segment.
The amplitudes, frequencies, and phases usually change slowly with time from one time
segment to another.
However, suppose that the frequencies do not exceed some known frequency, say 𝑭𝒎𝒂𝒙 . For
example,𝑭𝒎𝒂𝒙 = 𝟑𝟐𝟎𝟎 𝑯𝒛 for speech signals and 𝑭𝒎𝒂𝒙 = 𝟓𝑴𝑯𝒛 for television signals.
Sampling Theorem
From our knowledge of 𝑭𝒎𝒂𝒙 , we can select the appropriate sampling rate. We know that the
highest frequency in an analog signal that can be unambiguously reconstructed when the signal
is sampled at a rate 𝐹𝑠 = 1/𝑇 𝑖𝑠 𝐹𝑠/2. Any frequency above Fs/2 or below -Fs/2 results in
samples that are identical with a corresponding frequency in the range −𝐹𝑠/2 ≤ 𝐹 ≤ 𝐹𝑠/2.

To avoid the ambiguities resulting from aliasing, we must select the sampling rate to be
sufficiently high. That is, we must select Fs/2 to be greater than 𝑭𝒎𝒂𝒙 . Thus to avoid the
problem of aliasing, Fs is selected so that;
𝐹𝑠 > 2𝑭𝒎𝒂𝒙

The sampling rate 𝐹𝑁 = 2𝐹𝑚𝑎𝑥 is called the Nyquist rate.


Sampling Theorem
Where 𝑭𝒎𝒂𝒙 is the largest frequency component in the analog signal. With
the sampling rate selected in this manner, any frequency component, say
|𝑭𝒊 | < 𝑭𝒎𝒂𝒙 , in the analog signal is mapped into a discrete-time sinusoid
with a frequency;

Or equivalently;
Practice Example 2.2
Consider the analog signal;
𝑥𝑎 𝑡 = 3𝑐𝑜𝑠50𝜋𝑡 + 10𝑠𝑖𝑛300𝜋𝑡 − 𝑐𝑜𝑠100𝜋𝑡;
What is the Nyquist rate for the signal?
Solution 2.2
Practice Example 2.3
Consider the analog signal;
𝑥𝑎 𝑡 = 3𝑐𝑜𝑠2000𝜋𝑡 + 5𝑠𝑖𝑛6000𝜋𝑡 + 10𝑐𝑜𝑠12000𝜋𝑡;

a. What is the Nyquist rate for the signal?

b. Assume we sample this signal using 𝐹𝑠 = 5000 𝑠𝑎𝑚𝑝𝑙𝑒𝑠/𝑠𝑒𝑐.What is


the discrete-time signal obtained after sampling?

c. What is the analog signal discrete-time signal, 𝑦𝑎 𝑡 , we can


reconstruct from the samples if we use ideal interpolation?
Solution 2.3
finally we obtain
(c)
Exercise
Compare the signals 𝑥𝑎 𝑡 and 𝑦𝑎 𝑡 and explain their differences/similarities.
END OF LECTURE 2
Practical
Practical Appreciation : Seting Up the
Enviroment
1. Download Spyder IDE:
a. Visit the official downloads page for Spyder IDE
b. Select the version of Spyder IDE that is compatible with your operating system
c. Follow the instructions to install Spyder IDE on your computer

2. Open Spyder IDE


a. Launch Spyder IDE from your applications
b. b. Create a new project
c. c. Start coding!

3. Create a Basic Signal Plot


a. Import the necessary libraries for signal plotting, such as matplotlib
b. Create a signal variable with a range of values
c. Create a plot of the signal variable using the matplotlib library
d. Customize the plot by adding labels, titles, and other features
e. Save the plot to a file
Practice Example 2.2
Consider the analog signal;
𝑥𝑎 𝑡 = 3𝑐𝑜𝑠50𝜋𝑡 + 10𝑠𝑖𝑛300𝜋𝑡 − 𝑐𝑜𝑠100𝜋𝑡;
What is the Nyquist rate for the signal?
Solution 2.2
Practical 1.
Consider the analog signal;
4𝑐𝑜𝑠60𝜋𝑡+15𝑠𝑖𝑛400𝜋𝑡 −𝑐𝑜𝑠120𝜋𝑡
1. Plot the analog signal x(t)
2. Plot the discrete signal x(n)
3. Plot the graph for Fs = 80 Hz
4. Plot the graph for Fs =1khz
5. Plot the graph for the Nyquist rate
6. What can you deduct from your observation

You might also like