EXPERIMENT - 11
AIM
To Demonstrate Nyquist–Shannon sampling theorem.
THEORY
In the field of digital signal processing, the sampling theorem is a fundamental bridge between continuous-time signals (often called "analog signals") and discrete-time signals (often called "digital signals"). It establishes a sufficient condition for a sample rate that permits a discrete sequence of samples to capture all the information from a continuous-time signal of finite bandwidth.
According to the theorem , The Sampling frequency must be at least 2 times the maximum frequency contained in the signal for perfect reconstruction and prevent aliasing.
.
In the experiment , we have sampled a sinusoidal signal at and where the Nyquist frequency () is . It is clearly visible when sampled at , there is aliasing and they original signal is cannot be reproduced.
MATLAB COMMANDS USED
* plot(x,y,color,properties)
* sin(t);
* stem(x);
* hold on;
MATLAB CODE
f=1000;
%signal frequency
fs=5e5;
%Initially oversampled to produce a smooth plot
nCyl=5;
t=0:1/fs:nCyl*1/f;
y=sin(2*pi*f*t);
subplot(3,1,1);
plot(t,y,'b');
title('Continuous sinusoidal signal of frequency=1000Hz');
xlabel('Time(sec)');
ylabel('Amplitude Y(t)');
axis([0 nCyl/f -1.1 1.1])
%Undersampling
fs1=1500;
t1=0:1/fs1:nCyl*1/f;
y1=sin(2*pi*f*t1);
%OverSampling
fs2=4000;
t2=0:1/fs2:nCyl*1/f;
y2=sin(2*pi*f*t2);
subplot(3,1,2)
plot(t,y,'r');
hold on;
plot(t1,y1,':');
hold on;
stem(t1,y1,'b','filled')
title('Continuous sinusoidal signal sampled
at 1500Hz < Nq i.e. 2000Hz (If
you look carefully there seem
2.5 cycles instead of 5) ');
xlabel('Time(sec)');
ylabel('Amplitude Y(t)');
axis([0 nCyl/f -1.1 1.1])
subplot(3,1,3)
plot(t,y,'r');
hold on;
plot(t2,y2,':');
hold on;
stem(t2,y2,'b','filled')
title('Continuous sinusoidal signal
sampled at 4000Hz > Nq ');
xlabel('Time(sec)');
ylabel('Amplitude Y(t)');
axis([0 nCyl/f -1.1 1.1]);
print('sampling','-dpng');
%Use this to print the png of
the graph plotted.
RESULT
The Nyquist–Shannon sampling theorem has been demonstrated .