フィルターのクリア

How can I change the time axis unit in a spectrogram from minutes to seconds?

6 ビュー (過去 30 日間)
Deborah Müller
Deborah Müller 2017 年 8 月 4 日
回答済み: Christos Saragiotis 2017 年 8 月 4 日
Using spectrogram everything works fine, but the x-axis is displayed in minutes. Is there a way to change this generally? I changed the x-tick labels but this is very uncomfortable.

回答 (2 件)

Adam
Adam 2017 年 8 月 4 日
編集済み: Adam 2017 年 8 月 4 日
How are you creating the spectogram? Its axes will be whatever come from your input data, by default, but if you just create the spectogram outputs and plot them yourself you can set them to whatever you want.
Or if you let spectogram do the plot for you make sure you keep its handle:
h = spectogram(...)
then you can set
h.XData = ...
to be whatever you want.
  2 件のコメント
Deborah Müller
Deborah Müller 2017 年 8 月 4 日
Thank you for your answer. I didn't use the handle. But I'm not sure how to change the XData. I tried to look at it with get(h, XData) but that didn't work.
Adam
Adam 2017 年 8 月 4 日
編集済み: Adam 2017 年 8 月 4 日
Ah yes, I was giving that off the top of my head. The single output argument syntax for spectrogram just returns the STFT matrix.
Generally I always plot it myself from the outputs of spectrogram, then I have control over what is actually being plotted and can interpret the result more sensibly.
e.g.
[S, F, T, P] = spectrogram( ... );
figure; imagesc( hAxes, F1, T1, P1 );
The frequency and time axes can be altered as you wish though, e.g.
figure; imagesc( hAxes, F1, T1 * 60, P1 );
Alternatively you can query the 'Children' property of the axes onto which the spectrogram plotted and retrieve the image and then change the XData that way.

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


Christos Saragiotis
Christos Saragiotis 2017 年 8 月 4 日
Deborah, you might want to give us your code, then everything will be much simpler.

カテゴリ

Help Center および File ExchangeTime-Frequency Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by