Experiment 4 Sampling and Reconstruction of Continuous Time Signals Interpolation and Decimation
Experiment 4 Sampling and Reconstruction of Continuous Time Signals Interpolation and Decimation
1
1 Introduction
It is often desired to analyze and process continuous-time signals using a com-
puter. However, in order to process a continuous-time signal, it must first be
digitized. This means that the continuous-time signal must be sampled and
quantized, forming a digital signal that can be stored in a computer. Analog
systems can be converted to their discrete-time counterparts, and these digi-
tal systems then process discrete-time signals to produce discrete-time outputs.
The digital output can then be converted back to an analog signal, or recon-
structed, through a digital-to-analog converter. Figure 1 illustrates an example,
containing the three general components described above: a sampling system,
a digital signal processor, and a reconstruction system.When designing such
a system, it is essential to understand the effects of the sampling and recon-
struction processes. Sampling and reconstruction may lead to different types of
distortion, including low-pass filtering, aliasing, and quantization. The system
designer must insure that these distortions are below acceptable levels, or are
compensated through additional processing.
2 Overview of Sampling
2.1 Theory :
Sampling is simply the process of measuring the value of a continuous-time signal
at certain instants of time. Typically, these measurements are uniformly sep-
arated by the sampling period, Ts. . If x(t) is the input signal, then the sampled
signal, y[n] is as follows: y[n] = x(t) at t = nTs
2
distortion, known as aliasing, that will prevent a perfect reconstruc-
tion of X(f ). The 1⁄2Ts “cutoff frequency” is known as the Nyquist
frequency.
To prevent aliasing, most sampling systems first low pass filter the incoming
signal to ensure that its frequency content is below the Nyquist frequency.
The magnitude of the frequency response of the N-th order Butterworth fil-
ter is given by
—Hb(f)— = 1/(1+(f/fc)N )
T hecompletemagnituderesponseof thesample−and−holdsystembycombiningtheef f ectsof Butterworthf ilter
|H(f )| = (1/(1 + (f /f c)N ))|sinc(f /f s)|
3
3.2 Results:
PART 1 - A
3.2.1 Plot1:
3.2.2 Code1:
4
PART 1 - B
3.2.3 Plot2:
3.2.4 Code2:
5
3.3 Discussion:
In Part1 - B it just seems like fundamental component of square wave whereas
in the Part1-A it seems like a square wave . As the no.of samples increases then
it becomes more like a square wave and the aliasing might increase then it will
be hard to reconstruct the analog signal .
The magnitude response of the complete system has its peak at its origin
and gradually reduces to zero after a distance of 0.6 units from origin.
In the case of high-quality CD Player , we can assume that the sample and
hold system circuit takes sample of its input signal and it will hold these samples
in its output for some period of time.The samples are taken at a uniform time
intervals that means the sampling rate of the circuit can be determined . To
make it precise and high quality , we can increase the sampling rate fs, to prevent
loss of the signal or aliasing effect occuring due to incorrect set of sampling rate
. If the sampling rate is too low, the Nyquist-Shannon sampling theorem is not
observed and thus the measurement signal is not acuquired correctly.
6
4 Sampling and Reconstruction with an Impulse
Generator
4.1 Theory :
In this section, we will experiment with the sampling and reconstruction of
signals using a pulse generator. This pulse generator is the combination of an
ideal impulse generator and a perfect zero-order-hold device
4.2.1 Results:
Pulse Width = 0.3 Input/Output Plots :
7
Plot of Output Signal and its frequency spectrum :
8
Discussion:
In the case of Pulse width = 0.3 it’s closer in some sense to zero order hold
as most of the energy is where it should be that is at 0.1Hz . But, when we
reduce the pulse width to 0.1 we are basically making the sinc function wider
which is causing more aliasing . So, these aliased components carry more energy
now.The total energy is same.
9
Plot of Output Signal and its frequency Spectrum :
Discussion:
The fundamental component of frequency is at 0.1Hz . It is sampled below the
Nyquist frequency . The no.of samples are less and the aliased component has
as much energy as fundamental and all sense of the original signal is lost .The
aliased has more energy .
10
Simulink diagram :
11
Plot of Output Signal and its frequency Spectrum :
Discussion :
As Butterworth filter is a Band limited filter . So it filters out the path perfectly
without aliasing . So,we get perfect sine wave
12
4.3 Sampling and Reconstruction with Sample and Hold
4.3.1 Theory :
In this section, we will sample a continuous-time signal using a sample-and-hold
and then reconstruct it. We already know that a sample-and-hold followed by
a low-pass filter does not result in perfect reconstruction. This is because a
sample-and-hold acts like a pulse generator with a pulse duration of one sam-
pling period. This “pulse shape” of the sample-and-hold is what distorts the
frequency spectrum
13
4.5 Results :
Plots :
PART 1 :
Plot of Magnitude Response,Phase Response and Impulse Response
:
14
4.6 Simulink diagram :
4.7 Results :
Plots :
Plot of Magnitude Response,Phase Response and Impulse Response :
15
4.8 Discrete Time Interpolation :
4.8.1 Simulink diagram :
4.8.2 Results :
Plots :
PART 1 :
16
Scope Plot :
PART 2 :
17
Scope :
18
5.2 MATLAB CODE:
5.3 Discussion :
We compared the magnitude response of the system with and without of the
sample and hold circuit . Then, we reconstructed the signal with the help
of impulse generator , then by using sample and hold and finally with the
interpolation method.Finally, we observe the change in the sampling rate of the
signal and its impact on the system.
19