DSPRelated.com
Forums

FFT: Zero-padding, Windowing - What order?

Started by Marc Jenkins January 5, 2014
Hi,

I have a question regarding FFT:

If I want to calculate the FFT of a signal I would extend the signal to 
the next power-of-2 length to exploit the properties of the FFT. This 
is done using a simple zero-padding. If I window my signal to reduce 
leakage, when should this be done? Before or after the zero-padding?

Thanks!

Kind regards
Marc

Am 05.01.2014 19:57, schrieb Marc Jenkins:
> Hi, > > I have a question regarding FFT: > > If I want to calculate the FFT of a signal I would extend the signal to > the next power-of-2 length to exploit the properties of the FFT. This is > done using a simple zero-padding. If I window my signal to reduce > leakage, when should this be done? Before or after the zero-padding?
Before.
On 2014-01-05 19:38:59 +0000, sg said:

> Before.
Thank you!
On Sunday, January 5, 2014 1:57:41 PM UTC-5, Marc Jenkins wrote:
> Hi, > > > > I have a question regarding FFT: > > > > If I want to calculate the FFT of a signal I would extend the signal to > > the next power-of-2 length to exploit the properties of the FFT. This > > is done using a simple zero-padding. If I window my signal to reduce > > leakage, when should this be done? Before or after the zero-padding? > > > > Thanks! > > > > Kind regards > > Marc
What "properties" are you looking to exploit? The FFT doesn't require a power of two, although some FFT implementations, mainly embedded/VHDL, are resricted to powers of two. John
On 1/5/14 2:57 PM, Marc Jenkins wrote:
> On 2014-01-05 19:38:59 +0000, sg said: > >> Before. > > Thank you! >
also, Marc, you can (and, in my opinion, should) think of this windowing and zero-padding as one single operations. before the operation you have x[n] for -inf < n < +inf after the operation you have x[n] * w[n] for the same n. both the truncation of x[n] to a specific length and the zero padding can be modeled as zeros in the same w[n]. then it doesn't matter what the order is. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Sunday, January 5, 2014 1:57:41 PM UTC-5, Marc Jenkins wrote:
> Hi, I have a question regarding FFT: If I want to calculate the FFT of a signal I would extend the signal to the next power-of-2 length to exploit the properties of the FFT. This is done using a simple zero-padding. If I window my signal to reduce leakage, when should this be done? Before or after the zero-padding? Thanks! Kind regards Marc
Remember that windowing is only used if your signal length is a subset of a longer signal and you want the best approximation to the Fourier Transform of the longer signal. If your signal is just naturally short (for example, if it's the impulse response of some linear system), then you don't want to apply a window at all; the FFT output represents samples of the continuous Fourier Transform of the signal. There's no concept of speactral leakage in that case. By zero-stuffing you just get more densly-spaced samples of the continuous FT. Bob
On 2014-01-06 03:06:17 +0000, robert bristow-johnson said:

> also, Marc, you can (and, in my opinion, should) think of this > windowing and zero-padding as one single operations. > > before the operation you have x[n] for -inf < n < +inf > > after the operation you have x[n] * w[n] for the same n. > > both the truncation of x[n] to a specific length and the zero padding > can be modeled as zeros in the same w[n]. > > then it doesn't matter what the order is.
But why is there a tremendous difference in the FFT-result when changing the order? Marc
Test
On Tue, 7 Jan 2014 17:06:41 +0100, Marc Jenkins
<marc.jenkins@noreply.com> wrote:

>On 2014-01-06 03:06:17 +0000, robert bristow-johnson said: > >> also, Marc, you can (and, in my opinion, should) think of this >> windowing and zero-padding as one single operations. >> >> before the operation you have x[n] for -inf < n < +inf >> >> after the operation you have x[n] * w[n] for the same n. >> >> both the truncation of x[n] to a specific length and the zero padding >> can be modeled as zeros in the same w[n]. >> >> then it doesn't matter what the order is. > >But why is there a tremendous difference in the FFT-result when >changing the order? > >Marc
If you change the length of the shaped window it'll change the response in the frequency domain. Say that one is padding a length-M data vector up to length-N. Applying a shaped window with length-M to the data portion will yield a different response than if a longer, length-N tapered window is applied to the entire transform. Applying the length-M shaped window provides a frequency response that is the transform of the window convolved with the ideal transform of the data. Applying the length-N shaped window provides a frequency response that is the transform of the length-N shaped window convolved with the transform of a length-M rectangular window convolved with the ideal transform of the data. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On 1/7/14 11:06 AM, Marc Jenkins wrote:
> On 2014-01-06 03:06:17 +0000, robert bristow-johnson said: > >> also, Marc, you can (and, in my opinion, should) think of this >> windowing and zero-padding as one single operations. >> >> before the operation you have x[n] for -inf < n < +inf >> >> after the operation you have x[n] * w[n] for the same n. >> >> both the truncation of x[n] to a specific length and the zero padding >> can be modeled as zeros in the same w[n]. >> >> then it doesn't matter what the order is. > > But why is there a tremendous difference in the FFT-result when changing > the order? >
make sure it's the same w[n]. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."