Sampling signal in Time domain
17 次查看(过去 30 天)
显示 更早的评论
Dear all,
i have a vector of [1 -1 1 -1 1 -1...] with length of 500. how can i oversample this signal and see the effect of the oversampling in the frequency domain?
i am confused between upsampling and interp? what is the difference?
thanks,
0 个评论
回答(1 个)
Antonio Ciociola
2020-8-7
编辑:Antonio Ciociola
2020-8-8
It seems that your data has been taken by sampling a sinusoid using a sampling frequency that is only two time the frequency of the sine. Unfortunately, if you want to respect the Nyquist's theorem, you have to respect the following equation.
Anyway, try to run the following example:
close all
N = 500;
fsin = 100;
fsample = 10*fsin;
tsin = 1/fsin;
t = 0:1/fsample:N/fsample;
s =sin(2*pi*t*fsin);
upsampling = 10;
figure; plot(s)
title('Original Signal')
faxis = -0.5*fsample:fsample/N:0.5*fsample-1/N;
sF = (1/length(s))*(fft(s));
sFPad = [sF(1:round(0.5*length(sF))) zeros(1,(upsampling-1)*length(sF)) sF(round(0.5*length(sF))+1:end) ];
ss = (length(sFPad))*(ifft((sFPad)));
tss = t(end)*linspace(0,1,length(ss));
figure; plot(ss)
title('Signal after upsampling')
As you can see, after the padding the anti-transformed signal it's the oversampled version of the original signal.
After the zero padding, there is more "distance" (in the frequency domain) between the two peak of the original tone. This is the same effect that you get if you try to increase the sampling frequency of the original signal.
Now you can get the same result if you keep the same sampling frequency and try to put a zero between every sample of the original signal (zero interleaving) and then try to do a filtering in time domain.
So upsampling in frequency domain (zero padding with filtering) <--> upsampling in time domain (zero interleaving with filtering).
You can find other useful information here: https://www.dsprelated.com/freebooks/sasp/Upsampling_Downsampling.html
5 个评论
Antonio Ciociola
2020-8-14
It seems quite different from the starting question...Could you send the entire code?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!