![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/343249/image.png)
Sampling signal in Time domain
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Antonio Ciociola
am 7 Aug. 2020
Bearbeitet: Antonio Ciociola
am 8 Aug. 2020
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/343249/image.png)
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 Kommentare
Antonio Ciociola
am 14 Aug. 2020
It seems quite different from the starting question...Could you send the entire code?
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!