Mat lab program to illustrate sampling theorem
%program illustriating sampling theoremclc;
clear all;
close all;
t=0:0.000005:0.5;
f=16;
t2=0:1/(1.3*f):0.5;
s=cos(2*pi*f*t);
sp=cos(2*pi*f*t2);
subplot(3,1,1)
plot(t,s,'b',t2,sp,'r*-');
hold on;
stem(t2,sp,'g');
title('under sampling plot')
ns=0:1/(2*f):0.5;
ni=cos(2*pi*f*ns);
subplot(3,1,2)
plot(t,s,'b',ns,ni,'r*-')
hold on;
stem(ns,ni,'g');
title('nyquist sampling plot')
os=0:1/(6*f):0.5;;
ow=cos(2*pi*f*os);
subplot(3,1,3)
plot(t,s,'b',os,ow,'r*-')
hold on;
stem(os,ow,'g');
title('Over sampled plot')
legend('analog signal','reconstructed signal','sampled signal');
Comments
Post a Comment