Heaven’s light is our guide
RAJSHAHI UNIVERSITY OF ENGINEERING & TECHNOLOGY
Department of Mechatronics Engineering
Lab Report
Experiment No: 03
Experiment Title: Analyzing the Sampling Theorem.
Course No. : MTE 2206
Course Title : Sensors and Instrumentations Sessional.
Submitted By:
Mamun Or Rashid
ID: 2008025
2nd Year, Even Semester
Department of Mechatronics Engineering
Rajshahi University of Engineering & Technology, Rajshahi-6204.
Submitted To:
Md. Firoj Ali Md. Faisal Rahman Badal
Assistant Professor Lecturer
Department of Mechatronics Department of Mechatronics
Engineering Engineering
Rajshahi University of Engineering & Rajshahi University of Engineering &
Technology, Rajshahi-6204. Technology, Rajshahi-6204.
Date Of Submission: 26 November 2023
Experiment No: 03
Experiment Title: Analyzing the Sampling Theorem.
Objectives:
1. To understand the fundamental principles of the Sampling Theorem in signal processing.
2. To learn about signal sampling and reconstruction.
3. To perform signal processing and reconstruction through MATLAB.
4. To use MATLAB for practical experimentation and visualization of sampled signals.
Theory:
The sampling theorem, also known as the Nyquist-Shannon sampling theorem, is a fundamental
concept in signal processing and communication theory. It is a fundamental concept in signal
processing that deals with the conversion of an analog signal into a discrete form by taking the
sampling frequency as twice the input analog signal frequency. The theorem states that a
continuous signal or an analog signal can be represented in the digital version in the form of
samples, where these samples are also called as discrete points. The output of this technique
represents the discrete version of its analog signal.
The theorem has three conditions: Nyquist, aliasing, and low pass. The Nyquist condition states
that the sampling frequency should be more than twice of the input analog signal frequency. If
this condition satisfies, the analog signal is perfectly represented in discrete form, else the analog
signal may be losing its amplitude values for certain time intervals. The aliasing condition states
that the sampling frequency should be less than half of the input analog signal frequency. The
low pass condition states that the input signal should be band-limited.
The theorem has several applications, including digital signal processing, data compression, and
digital audio. The theorem is also used in the design of digital filters and in the reconstruction of
signals from their samples.
Code:
clc
clear all
% Continuous Time Signal
A = 2;
f = 5;
theta = 0;
t = 0: 0.01: 2;
x = A*sin(2*pi*f*t + theta);
subplot(3, 1, 1);
plot(t,x)
xlabel('Time');
ylabel('x');
title('Continuous Time Signal');
%Digital Signal
Fs = 10*f;
ts = 1/Fs;
td = 0: ts: 2;
xd = A*sin(2*pi*f*td + theta);
subplot(3, 1, 2);
stem(td,xd);
xlabel('Sample Time');
ylabel('xd');
title('Digital Time Signal');
%Reconstruction
subplot(3, 1, 3);
plot(td,xd);
xlabel('Time');
ylabel('xd');
title('Reconstruction Time Signal');
Result:
Continuous Time Signal
2
0
x
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time
Digital Time Signal
2
xd
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Sample Time
Reconstruction Time Signal
2
xd
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time
Figure 3.1: Different Types of Signals
Discussion:
In the experiment, the impact of sampling rates on the accuracy of signal reconstruction was
observed. Sampling below the Nyquist rate was noted to have the potential to result in aliasing,
causing distortion in the reconstructed signal. Conversely, sampling at or above the Nyquist rate
was expected to ideally lead to accurate reconstruction. A hands-on understanding of the
Sampling Theorem was provided by the experiment, highlighting the importance of proper
sampling in digital signal processing applications. Additionally, the experiment allowed for the
exploration of the limitations and challenges associated with practical implementations of the
Sampling Theorem.
Conclusion:
In this experiment, insights into the sampling theory and the significance of frequency in signal
sampling were gained. The experiment was conducted utilizing MATLAB software. Due to the
sensitivity of the coding process, meticulous attention was required, as the absence of a single
semicolon could disrupt the entire code. Ultimately, the experiment was executed flawlessly, and
the desired output was achieved. This experiment contributes valuable insights into the practical
application of the Sampling Theorem, enriching understanding of fundamental concepts in signal
processing.
References:
[1] Nyquist, H. (1928). Certain topics in telegraph and telephone theory. Transactions of the
American Institute of Electrical Engineers, 47(2), 617-641.
[2] Shannon, C. E. (1949). Communication in the presence of noise. Proceedings of the Institute
of Radio Engineers, 37(1), 10-21.