decimate shifts frequency

I used decimate.m in order to down sample my data and applied it to wavelet to see time-frequency map.
ex)
downdata = decimate(data,2,500,'FIR') or decimate(data,2)
waveletdata = cwt(downdata,scale);
When I compare it with original data, I realized the frequency was shifted.
Are there any way to fix it?
Thanks

2 Kommentare

Walter Roberson
Walter Roberson am 15 Jun. 2012
Was it the phase that was shifted? I am not clear on what it would mean for the frequency to be shifted.
scally12
scally12 am 15 Jun. 2012
Please see the Wayne's answer.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Wayne King
Wayne King am 15 Jun. 2012

1 Stimme

You have not shown us what your scale vector is for the cwt, but if you decimate the data, then you are changing the scale at which a given frequency occurs. So the energy in the CWT coefficients is going to shift in scale.
You should construct an appropriate scale vector for your "new" sampling rate and the expected frequencies in your input.
You can also use scal2frq to get an approximate frequency vector from your scale vector.

Weitere Antworten (2)

Wayne King
Wayne King am 15 Jun. 2012

0 Stimmen

Here is an example:
Fs = 1e4;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*500*t).*(t<0.5)+cos(2*pi*1000*t).*(t>=0.5);
scales1 = 1:0.25:30;
cfs1 = cwt(x,scales1,'morl');
freq1 = scal2frq(scales1,'morl',1/Fs);
surf(t,freq1,abs(cfs1),'edgecolor','none');
view(0,90);
Now decimate by 2.
y = decimate(x,2,500,'fir');
Fsnew = Fs/2;
scales2 = 1:0.01:15;
cfs2 = cwt(y,scales2,'morl');
freq2 = scal2frq(scales2,'morl',1/Fsnew);
tnew = 0:1/Fsnew:1-(1/Fsnew);
surf(tnew,freq2,abs(cfs2),'edgecolor','none');
view(0,90)
scally12
scally12 am 15 Jun. 2012

0 Stimmen

Wayne, you are right! The CWT coefficients was shift in frequency (I transferred it with scl2frq). It was my mistake. I didn't update the sampling rate in scal2frq.
Thank so much.

Kategorien

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by