Wavelet display problem - marked difference in frequency content between 'contour' and 'imagec'
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Wayne King
2013-5-17
编辑:Wayne King
2013-5-17
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!