How to plot spectrogram on log frequency scale?

조회 수: 13 (최근 30일)
Petrina
Petrina 2014년 8월 27일
편집: alexis 2015년 6월 8일
I've just starting using the spectrogram function, but I can not get it to plot on a log scale for the frequency axis that mimics the plot generated by logy.
Here's the basic spectrogram I am running:
%%Wv is wave signal of the word shore
% fs = 14700;
% framelen_samples = (20/1000)*fs;
% noverlap = 0.3* framelen_samples;
% NFFT = 2^nextpow2(framelen_samples);
% spectrogram(Wv,hamming(framelen_samples),floor(noverlap),NFFT,fs,'yaxis');
% colorbar;
Any suggestions?
  댓글 수: 1
alexis
alexis 2015년 6월 8일
편집: alexis 2015년 6월 8일
set(gca,'Yscale','log')

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2014년 8월 27일
편집: Star Strider 2014년 8월 28일
You have to get the data spectrogram produces and plot it separately:
T = 0:0.001:2;
X = chirp(T,100,1,200,'q');
[S,F,T] = spectrogram(X,128,120,128,1E3,'yaxis');
figure(1)
surf(T,F,abs(S))
view([0 90])
axis tight
xlabel('Time')
ylabel('Frequency')
set(gca,'YScale','log')
title 'Quadratic chirp'
This is the chirp signal from the spectrogram documentation. See the ‘Examples’ section for the linear scale of the same signal.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by