Spectrogram with log scale
이전 댓글 표시
Recently, I'm trying to make a spectrogram image with log scale of Y-axis. Linear scale of spectrogram works well, but I'm in trouble with this log scale. I've checked so many answers of here and web pages as well, but every single tip was not helpful.
Here's my code for spectrogram with log scale.
------------------------------------------------------------------------------
[s,f,t,p] = spectrogram(raw,WINDOW,OVERLAP,N,Fs,'yaxis');
imagesc(t,f,10*log10(p), [1 100]);
set(gca,'YScale','log')
colormap(jet)
ylim([1, 1e2]);
axis xy
colorbar
---------------------------------------------------------------------------
When run this set of code, I can see that Y-axis is displayed in log scale, but nothing is displayed in spectrogram area. Only I can see is a white-blank space.
I can tell you guys; I really do all things that I got! But nothing solves my problem.
Even I tried "ax = gca; ax.YScale = 'log';" which is found in Matlab help, but it doesn't work.
Please someone help me!
Have a nice day. Thanks!
답변 (1개)
Star Strider
2015년 8월 12일
The imagesc function may not be appropriate. Use surf instead:
t = 0:0.001:2;
x = chirp(t,100,1,200,'quadratic');
[s,f,t,p] = spectrogram(x,128,120,128,1e3);
figure(1)
surf(p)
view(0, 90)
axis tight
set(gca, 'YScale', 'log')
댓글 수: 2
Jinhyung Kim
2015년 8월 13일
Star Strider
2015년 8월 13일
It is easy to turn off the grid lines:
t = 0:0.001:2;
x = chirp(t,100,1,200,'quadratic');
[s,f,t,p] = spectrogram(x,128,120,128,1e3);
figure(1)
sh = surf(p)
view(0, 90)
axis tight
set(gca, 'YScale', 'log')
set(sh, 'LineStyle','none')
카테고리
도움말 센터 및 File Exchange에서 ARM Cortex-R Processors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
