Communication Systems Lab Lab 6: To Study The Sampling Theorem Using Matlab
Communication Systems Lab Lab 6: To Study The Sampling Theorem Using Matlab
Introduction
The theory of sampling is provides a clear mathematical understanding of the interface between
our analog world and the discrete world of digital computers, portable audio player and a number
of everyday use devices. The purpose of this lab is to expose us to the practical side of this theory
by presenting some simple examples in MATLAB.
Generate an analog sinusoid and sample it. Notice that our initial signal which we create using
the provided function makecos() is already sampled but at a very high sampling rate. We consider
this a virtually analog signal since we don't want to use symbolic variables in order to create
continuous-time signals.
Now we will sample this signal with an adequate sampling frequency. We know that our initial
signal is a cosine with frequency 20 Hz. This means that the Nyquist rate for this signal is
2*20=40Hz. In the first sampling scenario we use a sampling rate of 50Hz which is more than
enough for perfect reconstruction. This is the case of oversampling. So we have:
Page 1 of 4
Notice that the discrete plots featuring arrows denote the integral of the Dirac delta function.
Now we will sample the same analog signal but with a sampling rate less than the Nyquist rate.
This is the case of undersampling and we choose 30Hz.
% Now sample our original signal with the new sampling rate
ms2 = sampleit1(t,m,ts2);
According to the theory using the first sampled signal ms1 we should be able to reconstruct the
original whereas using the second ms2 aliasing should occur. Let's now reconstruct using the
function interpsinc() that we provide you with and plot the waveforms in both time and frequency
in order to verify the sampling theory.
Notice how the first reconstructed cosine has the same frequency as the original while the second
has a different frequency. Clearly in the second reconstructed signal we don't have perfect
reconstruction.
Verify the frequency of the original and the two reconstructed signals, notice the aliasing.
Page 2 of 4
Result of Experiment # 6 (Each student has to write his/her own
conclusion)
Page 3 of 4
Page 4 of 4