Why is the output for undersampling and oversampling of a CT signal same?
6 views (last 30 days)
Show older comments
I am writing a code to observe the effects of undersampling and oversampling on a signal and intrestingly I notice that the oversampled signal and the undersampled signal produce the same DT output and its DFT is also same. Could anyone pls explain why this is happening?
I have attached the code and outputs for reference below.
clear;
clc;
f = [10,30,50];
fs = 60;
Ts = 1/fs;
n=0:100;
figure(1)
xn1 = 3*sin(2*pi*f(1)*n*Ts);
subplot(2,1,1)
stem(n,xn1);
title('Oversampled DT signal')
Xk1 = abs(dft_calc(xn1));
subplot(2,1,2);
stem(n,Xk1);
title('DFT of oversampled signal')
figure(2)
xn2 = 3*sin(2*pi*f(2)*n*Ts);
subplot(2,1,1)
stem(n,xn2);
title('Nyquist sampled DT signal')
subplot(2,1,2);
Xk2 = abs(dft_calc(xn2));
stem(n,Xk2);
title('DFT of Nyquist sampled signal')
figure(3)
xn3 = 3*sin(2*pi*f(3)*n*Ts);
subplot(2,1,1)
stem(n,xn3);
disp(xn3)
title('Undersampled DT signal')
Xk3 = abs(dft_calc(xn3));
subplot(2,1,2)
stem(n,Xk3);
title('DFT of undersampled signal')
function X = dft_calc(x)
N = length(x);
X=zeros(1,N);
for k=1:N
for n=1:N
X(k) = X(k) + x(n)*exp(-2*pi*1i*(n-1)*(k-1)/N);
end
end
end
Thank you!
0 Comments
Accepted Answer
Paul
on 14 Feb 2022
Edited: Paul
on 14 Feb 2022
I'm not sure if this explains it clearly but .... in DT frequency defines an angle around the unit circle. In the oversampled case, the DT frequency stays on the top half of the unit circle. In the Nyquist sampled case, the DT frequency is the angle pi. In the undersampled case, the frequency keeps going around the lower half of the unit circle. So when the CT sine wave is sampled we end up with
f = sym([10 30 50]);
fs = sym(60);
Ts = 1/fs;
syms n integer
xn = sin(2*sym(pi)*f*n*Ts)
xn = simplify(xn)
For any value of n we have xnf1(n) = -xnf3(n), which is as shown in the plots. So the DFT of xnf1 will be the negative of the DFT of xnf3. And xnf1 = xnf4 if we let f4 = 70. Such is the nature of sampling I suppose.
0 Comments
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

