Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
1K views

Sampling in Matlab

This document contains MATLAB code that performs sampling on a cosine signal with different sampling frequencies. It generates a cosine signal, samples it using different sampling frequencies corresponding to different ratios of the original signal frequency, and plots the original, sampled, and reconstructed signals. It contains 3 sections that sample the cosine signal at frequencies corresponding to ratios of 2/3, 4/3, and 2/5 of the original signal frequency.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF or read online on Scribd
0% found this document useful (0 votes)
1K views

Sampling in Matlab

This document contains MATLAB code that performs sampling on a cosine signal with different sampling frequencies. It generates a cosine signal, samples it using different sampling frequencies corresponding to different ratios of the original signal frequency, and plots the original, sampled, and reconstructed signals. It contains 3 sections that sample the cosine signal at frequencies corresponding to ratios of 2/3, 4/3, and 2/5 of the original signal frequency.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF or read online on Scribd
You are on page 1/ 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