Time-Frequency Reassignment using Spectrogram Function

7 ビュー (過去 30 日間)
Alejandro Delgado-Castro
Alejandro Delgado-Castro 2017 年 3 月 21 日
コメント済み: Star Strider 2017 年 3 月 21 日
Dear Colleagues. I'm trying to obtain the reassigned version of a spectrogram using Matlab's built-in function spectrogram. Instead of plotting the reassigned version automatically, which works fine, I'm interested in assigning the modified spectrogram to a variable, using the following command:
Reassigned_Spec = spectrogram(In_Sig,Win,F_Size-H_Size,F_Size,fs,'reassign','yaxis');
The problem is that the data that I'm getting into the output variable is not the reassigned spectrogram, it is just the normal spectrogram. Any idea why this is happening? Thanks.
  1 件のコメント
Alejandro Delgado-Castro
Alejandro Delgado-Castro 2017 年 3 月 21 日
Well, I have solved the problem myself and wanted to share the solution I found in case someone else is trapped into the same situation. The key thing is that Matlab returns the reassigned spectrogram in the same structure used to return the normal power spectrogram, which is a different structure in the sequence of output variables. So, the command I finally used looks like this:
[~,~,~,Reassigned_Spec] = spectrogram(Ori_Sig,Win,F_Size-H_Size,F_Size,fs,'power','reassigned');
The returned matrix is equivalent to the one automatically plotted when no output variable is specified.

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

採用された回答

Star Strider
Star Strider 2017 年 3 月 21 日
You most likely have to get the data from the figure itself. It took some handle-spelunking to find this (in R2017a, I’m still reading the Release Notes). I never needed to do this, so it was something of an education.
This is from one of the examples in the documentation for the spectrogram function. It seems to provide the information in the plot that spectrogram produces.
The Example Code
Fs = 1000;
t = 0:1/Fs:2;
y = chirp(t,100,1,200,'quadratic');
figure(1)
spectrogram(y,kaiser(128,18),120,128,Fs,'reassigned','yaxis')
Ch = get(gca, 'Children')
Xd = Ch.XData;
Yd = Ch.YData;
Cd = Ch.CData;
figure(2)
surf(Xd, Yd, Cd)
grid on
  2 件のコメント
Alejandro Delgado-Castro
Alejandro Delgado-Castro 2017 年 3 月 21 日
Thanks for your answer. I also found a way to extract the reassigned spectrogram directly from the function by rearranging the order of the output variables.
Star Strider
Star Strider 2017 年 3 月 21 日
My pleasure.
I saw your solution in the documentation, but did not test it in my code.

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

その他の回答 (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