100% found this document useful (1 vote)
1K views

4.sampling Theorem Matlab Program

The document verifies the sampling theorem by generating a cosine waveform with a frequency of 1/4 Hz and sampling it at rates below, at, and above twice the highest frequency. When sampled at 1.6/4 Hz, aliasing occurs as seen by the red plotted samples. When sampled at 2/4 Hz, the samples reconstruct the original signal as predicted by the sampling theorem. When sampled at 8/4 Hz, more samples are taken than needed but still reconstruct the original signal.

Uploaded by

rambabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

4.sampling Theorem Matlab Program

The document verifies the sampling theorem by generating a cosine waveform with a frequency of 1/4 Hz and sampling it at rates below, at, and above twice the highest frequency. When sampled at 1.6/4 Hz, aliasing occurs as seen by the red plotted samples. When sampled at 2/4 Hz, the samples reconstruct the original signal as predicted by the sampling theorem. When sampled at 8/4 Hz, more samples are taken than needed but still reconstruct the original signal.

Uploaded by

rambabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SAMPLING THEOREM

AIM: To verify the waveforms of sampling theorem.

APPARATUS

1. Personal computer
2. Matlab2010

PROGRAM

clc;
clear all;
close all;
t=-10:0.01:10;
T=4;
fm=1/T;
x=cos(2*pi*fm*t);
subplot(2,2,1);
plot(t,x);
title('msg signal');
xlabel('time');
ylabel('amplitude');
fs1=1.6*fm;
fs2=2*fm;
fs3=8*fm;
n1=-4:1:4;
x1=cos(2*pi*fm/fs1*n1);
subplot(2,2,2);
stem(n1,x1);
hold on;
subplot(2,2,2);
plot(n1,x1,'r');
title('sampling when fs<2fm');
xlabel('sample');
ylabel('amplitude');
n2=-5:1:5;
x2=cos(2*pi*fm/fs2*n2);
subplot(2,2,3);
stem(n2,x2);
hold on;
subplot(2,2,3);
SAMPLING THEOREM
plot(n2,x2,'r');
title('sampling when fs=2fm');
xlabel('sample');
ylabel('amplitude');
n3=-20:1:20;
x3=cos(2*pi*fm/fs3*n3);
subplot(2,2,4);
stem(n3,x3);
hold on;
subplot(2,2,4);
plot(n3,x3,'r');
title('sampling when fs>2fm');
xlabel('sample');
ylabel('amplitude');

RESULT:

You might also like