You are on page 1of 2

%Name:-Bhamare kishor

%MIS No.141305012
Program of Sampling Theoram in Matlab
clc
n=401;%number of samples
%for input signal
t=-2:0.01:2;
f=input('Enter input frequency=');
w=2*pi*f;
y=sin(w*t);
subplot(2,2,1);
plot(t,y);
xlabel('time(sec)');
ylabel('sin(wt)');
title('Sampling graph for fs<f');
grid on;
%samples
fs=4*f;
t1=-2:(1/fs):2;
y1=zeros(n);
y1=sin(w*t1);
subplot(2,2,2);
axis([-1 1 -2 2]);
stem(t1,y1);
xlabel('time(sec)');
ylabel('sin(wt1)');
grid on;
fs=10*f;
t1=-2:(1/fs):2;
y1=zeros(n);
y1=sin(w*t1);
subplot(2,2,3);
axis([-1 1 -2 2]);

stem(t1,y1);
xlabel('time(sec)');
ylabel('sin(wt1)');
grid on;
fs=25*f;
t1=-2:(1/fs):2;
y1=zeros(n);
y1=sin(w*t1);
subplot(2,2,4);
axis([-1 1 -2 2]);
stem(t1,y1);
xlabel('time(sec)');
ylabel('sin(wt1)');
grid on;

You might also like