Wavelet display problem - marked difference in frequency content between 'contour' and 'imagec'
조회 수: 2 (최근 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!