Wavelet display problem - marked difference in frequency content between 'contour' and 'imagec'
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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')
0 Kommentare
Akzeptierte Antwort
Wayne King
am 17 Mai 2013
Bearbeitet: Wayne King
am 17 Mai 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)');
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Continuous Wavelet Transforms finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!