Spectrogram with log scale
31 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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!
0 Commenti
Risposte (1)
Star Strider
il 12 Ago 2015
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 Commenti
Star Strider
il 13 Ago 2015
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')
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
