resample lacks appropriate lowpass filtering

2 views (last 30 days)
Alain
Alain on 4 Mar 2014
Commented: Greg Dionne on 10 Jun 2014
Surprisingly, resample does not seem to apply appropriate filtering to avoid aliasing. Try: x=randn(10000,1); pwelch(decimate(x,2)); hold on pwelch(resample(x,1,2));
decimate does the right thing, which is to first lowpass filter with a cutoff below the new Nyquist frequency. resample does not. The result is that power above the original Nyquist frequency is aliased into the downsampled signal.
Annoyingly, decimate works only on vectors.
Am I missing something?
Alain

Answers (1)

Greg Dionne
Greg Dionne on 3 Jun 2014
Edited: Greg Dionne on 3 Jun 2014
I think resample has a higher cutoff frequency to admit more of the Nyquist range. If I'm interpreting your plot correctly, DECIMATE has a 3dB point near 0.8 pi rad/s; whereas the 3dB point of RESAMPLE is closer to 1.0 pi rad/s.
To convince yourself that there is (some) alias attenuation try something like:
t = (1:10000)/10000;
x = cos(2*pi*(100*t + 200*t.^2)) + cos(2*pi*(2500*t + 200*t.^2));
pwelch(x)
title('original PSD')
figure
pwelch(decimate(x,2));
hold on;
pwelch(resample(x,1,2));
title('decimated PSD')
Hope this helps a little.
  2 Comments
Alain
Alain on 4 Jun 2014
Thanks, but no it does not help. I'm surprised that matlab got such a basic thing wrong. Alain
Greg Dionne
Greg Dionne on 10 Jun 2014
I did a little more digging. RESAMPLE allows you to take a set of FIR coefficients. You could always try something like (?)
pwelch(resample(x,1,2,fir1(40,.8*1/2)));
I think that will get you a little closer to the behavior of DECIMATE.
Out of curiosity, what are your bandwidth requirements?

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!