Nothing Special   »   [go: up one dir, main page]

Sampling in Matlab

Download as doc or pdf
Download as doc or pdf
You are on page 1of 3

NAVEED MAZHAR,,,,, FA09-BEE-143,,,,,, Sampling,,,,,,,, COMSATS(ATD)

%Q.no.1
clc;clear all;
t=[-10:1/3.3:10];
n=[-10:1/3.3:10];
xc=cos(4000*pi*t);
subplot(221);
plot(t,xc);
%T=1/6000
%(4000*pi/6000)=2*pi/3
xn=cos(2/3*pi*n);
subplot(222);
stem(n,xn);
T=1/6000; f=1/T;
xr=zeros(1,length(t))
for i=1:67
z=f*(t-T*n);
xr=xr+(xn.*sinc(z(i)));
end
subplot(223);
plot(t,xr);

0.5

0.5

-0.5

-0.5

-1
-10

-5

10

-5

10

1
0.5
0
-0.5
-1
-10

-1
-10

-5

10

%Q.no.2
clc;clear all;
t=[-10:1/3.3:10];
n=[-10:1/3.3:10];
xc=cos(4000*pi*t);
subplot(221);
plot(t,xc);
%T=1/3000
%(4000*pi/3000)=4*pi/3
xn=cos(4/3*pi*n);
subplot(222);
stem(n,xn);
T=1/3000; f=1/T;
xr=zeros(1,length(t))
for i=1:67
z=f*(t-T*n);
xr=xr+(xn.*sinc(z(i)));
end
subplot(223);
plot(t,xr);

0.5

0.5

-0.5

-0.5

-1
-10

-5

10

-5

10

1.5
1
0.5
0
-0.5
-1
-10

-1
-10

-5

10

%Q.no.3
clc;clear all;
t=[-10:1/3.3:10];
n=[-10:1/3.3:10];
xc=cos(4000*pi*t);
subplot(221);
plot(t,xc);
%T=1/10000
%(4000*pi/10000)=2*pi/5
xn=cos(2/5*pi*n);
subplot(222);
stem(n,xn);
T=1/10000; f=1/T;
xr=zeros(1,length(t))
for i=1:67
z=f*(t-T*n);
xr=xr+(xn.*sinc(z(i)));
end
subplot(223);
plot(t,xr);

0.5

0.5

-0.5

-0.5

-1
-10

-5

10

-5

10

1
0.5
0
-0.5
-1
-10

-1
-10

-5

10

You might also like