You are on page 1of 3

# Isra University

## Faculty of Engineering, Science & Technology

Department of Electrical Engineering
Digital Signal Processing Lab 2

## Students Roll no: __________________________________ Name: __________________

Date of: Conduct: ___________ Grade: _____________ Teachers Signature: _________

SAMPLING
OBJECTIVES:
1) To understand and verify the process of sampling and sampling rate selection.
2) To understand the consequences of non-band-limited signals on sample rate selection.
3) To observe the effect of increased observation interval on the amplitude-densityspectrum of non-band-limited signals.
DISCUSSION:
The sampling theorem, attributed to Nyquist, Shannon, Kotelnikov and Whittaker, is useful, but
often misused and misunderstood by students and engineers alike when calculating the sampling
frequency required for use in the Analogue-to-Digital converter.
The theorem states that if we have a continuous-time signal that is perfectly band limited within the
upper limit of frequency , then we can collect all the information available in it by sampling, as
long as the sampling frequency is twice of the upper limit i.e. 2x or more.
The foremost difficulty with the sampling theorem is the requirement that the continuous-time
signal has to be perfectly band limited. This is unfortunate because no real world signal is truly and
perfectly band limited. In fact, if a signal were to have absolutely no energy outside of some finite
frequency band it must extend infinitely in time. Remember, a band-limited signal is time-unlimited
and vice versa. This means that going by the sampling theorem, no system that samples data from
the real world can do so perfectly, unless we're willing to wait an infinite amount of time for our
results.
However, we can properly sample the continuous-time signal by first trying to band-limit the signal
of interest by using an analog low pass filter and using a sampling frequency that is much greater
than twice maximum frequency of the analog signal.
In this lab we will use Matlab to resolve the ambiguities regarding the sampling theorem by
observing the effects of sampling in time and frequency domains.

Process of Sampling:
Suppose we have a continuous-time signal given mathematically as, = )(sin (2), where
= 1 represents the frequency and t the time.
From our knowledge of the Sampling theorem, we know that this signal can be represented in
discrete-time as samples by sampling it by at least twice its maximum frequency component, that

## 2x1 = 2 . This means that the sampling instant is = = 0.5

So, the discrete-time signal after sampling at instant T is given as, = sin (2). Having
come up with this digital signal analytically, we now need to create a piece of Matlab code to
generate this signal and subsequently plot it.

f1=1;
f2=5;
f3=10;
Fs=2*f3;
Ts=1/Fs;
phase=pi/3;
t=linspace(0,3,500);
m=0:Ts:3;
X=sin(2*pi*f1*t)+sin(2*pi*f2*t)+sin(2*pi*f3*t+phase);
Xs=sin(2*pi*f1*m)+sin(2*pi*f2*m)+sin(2*pi*f3*m+phase);
plot(t,X);
hold on;
stem(m,Xs,'--red');
hold off;
xlabel('sampling interval m')
ylabel('strength of the Samples')
title('sampled signal Xs=sin(2*pi*f1*m)+sin(2*pi*f2*m)+sin(2*pi*f3*m+phase)')
grid;
What do you observe from the graphs? Do you think that sampling at twice the maximum frequency
component gives you the exact representation of the signal?

Lab Task 1: Change the sampling rate and observe the differences in the time and frequency domain
graphs. Explain the observations in your own words
Lab Task 2: Increase the observation time from 0:T:5 to 0:T:50 and check the frequency
domain graph. You should observe that the by the increasing the observation time for the signal, the
amplitude density spectrum (ADS) has become from compact. In fact, as we continue to increase the
observation time, the ADS will resemble that of a bandlimited signal.
Lab Task 3: Generate the following signal in Matlab. Plot it in time-domain and show it spectral
contents in frequency domain.
= (2)

= 2, 20, 30

Lab Task 4: Generate the following composite signal in Matlab. Plot it in time-domain and show it
spectral contents in frequency domain.
= (2 )+ 2(2 )+ 3(2 )
= 4, = 20, = 35