How to plot spectrogram with actual time?

I've tried a plenty of time now, awaring that there are many solution on the web, but none of them were working fine for my Issue.
Say I have the data
[y,fs] = audioread('path');
In order to prepare it for spectrogram:
y = y(:,1);
If I plot it now in a spectogram with same setting as on the Matlab-side:
spectrogram(y,128,120,128,1e3,'yaxis')
I'm getting a time-span of hours, even if the Signal is 140 seconds long.
Any solutions? The spectogram looks fancy, but not in that scale.

1 件のコメント

Niklas Kurz
Niklas Kurz 2021 年 1 月 19 日
attached data. It's a compressed example

サインインしてコメントする。

回答 (1 件)

Niklas Kurz
Niklas Kurz 2021 年 1 月 19 日
編集済み: Niklas Kurz 2021 年 1 月 19 日

0 投票

gosh,
spectrogram(y,128,120,128,fs,'yaxis')
% colormap(jet); (optional optic)
if your Data is really large and scaled in minutes you can use:
[~,F,T,P] = spectrogram(y,128,120,128,fs,'yaxis');
imagesc(T, F, 10*log10(P+eps)) % add eps like pspectrogram does
axis xy
ylabel('Frequency (Hz)')
xlabel('Time (s)')
h = colorbar;
h.Label.String = 'Power/frequency (dB/Hz)';
According to Stack exchange. Thank you documentations!

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

タグ

質問済み:

2021 年 1 月 19 日

編集済み:

2021 年 1 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by