Wavelet display problem - marked difference in frequency content between 'contour' and 'imagec'

1 visualizzazione (ultimi 30 giorni)
Dear all, I analyze a test signal containing two sinus waves of 100Hz and 300 Hz with an wavelet transformation (code attachted). When I display the result with the 'contour' plot, the centre frequencies appear correctly at 100Hz and 300Hz, while when I display the same variables with the imagec command the centre frequencies appear at around 125Hz and 350Hz. Where does such difference stem from and how can I force the imagec to display the frequency content correctly? Looking forward to your explanation. Best, Peter
WaveT='morl';
fs = 2e4;
t = 0:1/fs:2-1/fs;
x = 2*cos(2*pi*100*t).*(t<0.500)+3*cos(2*pi*300*t).*...
(t>0.500 & t <1)+randn(size(t));
dt = 1/fs;
figure
subplot(3,1,1)
title('signal')
plot(t,x);
subplot(3,1,2)
fc = centfrq(WaveT);
dt=1/fs;
minscale = centfrq(WaveT)/(300*dt);
maxscale = centfrq(WaveT)/(100*dt);
scales = minscale-10:maxscale+10;
Coeffs = cwt(x,scales,WaveT);
F = scal2frq(scales,WaveT,1/fs);
contour(t,F,abs(Coeffs));
xlabel('Time'); ylabel('Frequency');
axis xy
title('contour')
subplot(3,1,3)
imagesc(t,F,abs(Coeffs));
xlabel('Time'); ylabel('Frequency');
axis xy
title('imagec')

Risposta accettata

Wayne King
Wayne King il 17 Mag 2013
Modificato: Wayne King il 17 Mag 2013
Unfortunately I don't have a lot of time at the moment to look into this, but how about just using surf()
WaveT='morl';
fs = 2e4;
t = 0:1/fs:2-1/fs;
x = 2*cos(2*pi*100*t).*(t<0.500)+3*cos(2*pi*300*t).*...
(t>0.500 & t <1)+randn(size(t));
dt = 1/fs;
figure
subplot(3,1,1)
title('signal')
plot(t,x);
subplot(3,1,2)
fc = centfrq(WaveT);
dt=1/fs;
minscale = centfrq(WaveT)/(300*dt);
maxscale = centfrq(WaveT)/(100*dt);
scales = minscale-10:maxscale+10;
Coeffs = cwt(x,scales,WaveT);
F = scal2frq(scales,WaveT,1/fs);
contour(t,F,abs(Coeffs));
xlabel('Time'); ylabel('Frequency');
axis xy
title('contour')
subplot(3,1,3)
surf(t,F,abs(Coeffs),'EdgeColor','none'); view(0,90);
axis tight;
Or simply just view this and you'll see the axes are correct
surf(t,F,abs(Coeffs),'EdgeColor','none'); view(0,90);
axis tight; xlabel('Seconds'); ylabel('Pseudo-Frequency (Hz)');

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by