How to choose Spectrogram parameter ?

6 ビュー (過去 30 日間)
omar thamer
omar thamer 2013 年 10 月 28 日
コメント済み: Jeremy 2013 年 10 月 29 日
I have a signal with 3Hz frequency and runs from 0:10 second. The signal is zeroed everywhere except from 2 to 4 and 7 to 8 second in the signal as per the image below. I tried to to get the spectrogram but it didn't give correct representation and accurate one. When i surf the spectrogram i can see the 3 signal but the time is shifted. How to choose the correct parameters for spectrogram ? My code:
t=0:1/50:10;
x=sin(2*pi*t*3);
x[1:100]=0;
x[200:350]=0;
x[400:501]=0;
[s,ff,tt,p]=spectrogram(x,50,25,2048,50);
surf(tt,ff,(p),'edgecolor','none'); axis tight; view(0,90);
Thank you
  1 件のコメント
omar thamer
omar thamer 2013 年 10 月 28 日
another question: Below is the spectrogram for my signal. Ohnestly I can't do the interpretation. This signal is different and it runs from (1:1:515 Sec) and fs=1 and max freq is 0.5. the signal is triangular and have a mean of near zero.

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

採用された回答

Jeremy
Jeremy 2013 年 10 月 28 日
編集済み: Jeremy 2013 年 10 月 28 日
Where you set it to zero, you should be using parentheses and not brackets. not really sure what you were plotting since that syntax should just throw an error.
This should create what you would expect to see, two pulses at around 3 Hz
t=0:1/50:10;
x=sin(2*pi*t*3);
x(1:100)=0;
x(200:350)=0;
x(400:501)=0;
[s,ff,tt,p]=spectrogram(x,50,25,2048,50);
surf(tt,ff,(p),'edgecolor','none'); axis tight; view(0,90);
  1 件のコメント
omar thamer
omar thamer 2013 年 10 月 29 日
Jeremy I got the spectrogram correct i was segmenting the signal incorrectly. Now how do you choose nfft (based on Length of total signal or length of each segment? ). More important, How do you make interpretation for the spectrogram above ? This is not for the signal am asking about ? Can you see any pattern recognition ?

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

その他の回答 (1 件)

Wayne King
Wayne King 2013 年 10 月 29 日
NFFT is based on the length of the segment, not the length of the signal. Choosing the segment length is the most important parameter in the spectrogram because that determines and fixes your frequency resolution. Picking a value of NFFT greater than the segment length only provides an interpolation of the DFT estimates at the fundamental (Fourier) frequencies, it does not improve your frequency resolution.
  4 件のコメント
omar thamer
omar thamer 2013 年 10 月 29 日
Jeremy your example is clear. Can you explain the spectrogram i attached above ? How is the frequency changing as a function of time ?
Jeremy
Jeremy 2013 年 10 月 29 日
your spectrogram is very odd. it would appear there is something like a burst of a square wave with a consistent duration starting at random intervals. I'm not sure about the blue stripes, they are are consistent over time when there is no signal, they might be side lobes due to zero padding. There is also a DC component to the signal; it is not zero when there is no square wave.

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

カテゴリ

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