Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Spectrogram: nfft vs. window. How's that??

Subject: Spectrogram: nfft vs. window. How's that??

From: Luca

Date: 15 Mar, 2013 13:34:07

Message: 1 of 2

I admit from the beginning that I do not have so much knowledge about stft and the topic.
But anyway I need a "quick and dirty" spectrogram of a signal, and there's something I do not get.
The parameters are :
spectrogram (x,window,noverlap,nfft,.....);
Now...
What's the difference between window and nfft and how (therefore) am I supposed to set these two parameter? It seems pretty obvious to me that they are dependent.
Arent't they?

I quote from the doc:
"window is a Hamming window of length nfft."
"nfft is the FFT length and is the maximum of 256 or the next power of 2 greater than the length of each segment of x. Instead of nfft, you can specify a vector of frequencies, F. See below for more information."

Why should I specify "window" then?
And would it make sens to set it to anything different from fft?

Can anybody shed some light on it?
And BTW... does anybody has a rule of thum on how to set these parameters in a "kinda optimal way" (depending on what I want to analyze)

Subject: Spectrogram: nfft vs. window. How's that??

From: anyone

Date: 15 Mar, 2013 17:15:43

Message: 2 of 2

On Fri, 15 Mar 2013 13:34:07 +0000, Luca wrote:

> I admit from the beginning that I do not have so much knowledge about
> stft and the topic.
> But anyway I need a "quick and dirty" spectrogram of a signal, and
> there's something I do not get.
> The parameters are :
> spectrogram (x,window,noverlap,nfft,.....);
> Now...
> What's the difference between window and nfft and how (therefore) am I
> supposed to set these two parameter? It seems pretty obvious to me that
> they are dependent.
> Arent't they?
>
> I quote from the doc:
> "window is a Hamming window of length nfft."
> "nfft is the FFT length and is the maximum of 256 or the next power of 2
> greater than the length of each segment of x. Instead of nfft, you can
> specify a vector of frequencies, F. See below for more information."
>
> Why should I specify "window" then?
> And would it make sens to set it to anything different from fft?
>
> Can anybody shed some light on it?

"windowing" affects sampled results of your short-time FFT:
Google: fft windowing
About 171,000 results (0.15 seconds)

The first page of that has some useful stuff.

> And BTW... does anybody has a rule of thum on how to set these
> parameters in a "kinda optimal way" (depending on what I want to
> analyze)

Look up "Box Car" window. At one time there were URLs in the Help file, but I haven't looked in a while.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us