How to plot actual amplitude on the colorbar using STFT (spectrogram)

24 ビュー (過去 30 日間)
Jan Ali
Jan Ali 2021 年 5 月 8 日
コメント済み: Bjorn Gustavsson 2021 年 5 月 12 日
I am using built in spectrogram function and it automatically plots the power/frequency (dB/Hz) values on the colorbar on the right.
Does anyone know how to plot actual amplitude/magnitude of a signal (A or V) on the colorbar using STFT (spectrogram)?
Thanks in advance,
  3 件のコメント
Jan Ali
Jan Ali 2021 年 5 月 11 日
In order to present the signal actual amplitude. Otherwise, what is the reference for power/frequency? power/frequency is more confusing.
Asvin Kumar
Asvin Kumar 2021 年 5 月 12 日
I'm not sure if that's possible but I can say that replacing the colorbar range with Amplitude values would not be meaningful. That would be like comparing apples with oranges. This is because the plot that you get from spectrogram is actually information about the same signal in the frequency domain.
Power/frequency shows the amount of energy per unit time for each frequency. You might recall from Parseval's theorem that energy in time domain is equal to the energy in frequency domain. I would recommend reading more about Power Spectral Density (PSD) if that's confusing. Here's a wikipedia article to get you started: Spectral Density

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

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 5 月 12 日
If you read the help for spectrogram you'll find this:
[...] = spectrogram(...,SPECTRUMTYPE) uses the window scaling
algorithm specified by SPECTRUMTYPE when computing the power spectral
density matrix P.
SPECTRUMTYPE can be set to 'psd' or 'power':
'psd' - returns the power spectral density.
'power' - scales each estimate of the PSD by the equivalent noise
bandwidth of the window (in Hz). Use this option to
obtain an estimate of the power at each frequency.
The default value for SPECTRUMTYPE is 'psd'.
So just call spectrogram with its outputs and plot yourself:
[S,F,T,P] = spectrogram(your,inputs,sampling,frequency,and,window,etc);
pcolor(T,F,P),shading flat,colorbar
You can then chose whether get power spectral density or power.
HTH
  2 件のコメント
Jan Ali
Jan Ali 2021 年 5 月 12 日
編集済み: Jan Ali 2021 年 5 月 12 日
Tusen takk Bjørn! Setter stor pris på det :)
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 5 月 12 日
Bare hyggelig!

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

その他の回答 (0 件)

カテゴリ

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