DSPRelated.com
Forums

windowing and zero-padding

Started by Unknown March 7, 2008
On Mar 7, 8:16 am, M.Aram...@verizon.net wrote:
> Suppose I have a sequence of n samples where n is not a power of 2 and > I zero-pad that > sequence up to the next power of 2 number of samples before computing > the FFT of the > resulting padded sequence. > > If I want to apply windowing (e.g. Hamming) before computing the FFT, > should the window > width used to compute the windowing weights be n (the original number > of samples) or > should it be the next power of 2 (i.e. padded) number of samples?
Zero padding is equivalent to applying a rectangular window. A rectangular window may introduce artifacts which cannot be removed by later windowing. However, if a window of the same or shorter extent is applied before (and inside) the rectangular window, then the rectangular window will have no additional effect. So one would generally want the extent of the Hamming/etc. window to be the original n or smaller in extent to stay completely inside the rectangular window introduced by subsequent zero padding. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
"Ron N." <rhnlogic@yahoo.com> wrote in message 
news:bc1bbe96-e40a-4d0c-8d24-8c9994bbddca@e25g2000prg.googlegroups.com...
> > Zero padding is equivalent to applying a rectangular window.
I don't see how..... assuming that the rectangular window has already been applied then what does zero padding do? Zero padding is equivalent to interpolation in the transform domain. Interpolation is equivalent to increasing the sample rate and filtering. If one is talking about zero padding in time then: It's equivalent to repeating the DFT sequence multiple times then multiplying by a rectangular window (actually a lowpass filter) in frequency. A *particular* filter used in this process will yield the zero padding. Fred
On Mar 9, 9:41 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
>... > I don't see how..... assuming that the rectangular window has already been > applied then what does zero padding do? >... > Fred
Does thinking you had a longer data sequence and than applied a rectangular window to part of it help :-)? Dale B. Dalrymple
On Mar 8, 6:57&#4294967295;pm, Jerry Avins <j...@ieee.org> wrote:
> Rune Allnor wrote: > > &#4294967295; &#4294967295;... > > > I am sure arguments can be presented to support either > > approach; ... > > I can't imagine how. What would be the sense od applying a window to the > padded zeros? The edges of the real data would remain abrupt.
Yet another argument to avoid the whole discussion. Rune
On Mar 9, 9:41 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "Ron N." <rhnlo...@yahoo.com> wrote in message > > news:bc1bbe96-e40a-4d0c-8d24-8c9994bbddca@e25g2000prg.googlegroups.com... > > > > > Zero padding is equivalent to applying a rectangular window. > > I don't see how..... assuming that the rectangular window has already been > applied then what does zero padding do?
Zero padding n data samples before a transform is equivalent to applying a rectangular window of length n inside a transform of length greater than n. The zero padding causes zero-valued points to be represented in the longer transform results, same as a rectangular window. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
On Mon, 10 Mar 2008 01:48:17 -0700 (PDT), "Ron N."
<rhnlogic@yahoo.com> wrote:

>On Mar 9, 9:41 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> >wrote: >> "Ron N." <rhnlo...@yahoo.com> wrote in message >> >> news:bc1bbe96-e40a-4d0c-8d24-8c9994bbddca@e25g2000prg.googlegroups.com... >> >> >> >> > Zero padding is equivalent to applying a rectangular window. >> >> I don't see how..... assuming that the rectangular window has already been >> applied then what does zero padding do? > >Zero padding n data samples before a transform is equivalent >to applying a rectangular window of length n inside a >transform of length greater than n. The zero padding >causes zero-valued points to be represented in the >longer transform results, same as a rectangular window. > >IMHO. YMMV.
I agree completely and this is why I claim that the FFT has "inherent" rectangular windowing; if you watch the behavior of the sidelobes as you analyse the effects of the rectangular window from say 4:1 oversampled from zero-padding down to a few samples zero-padded then down to no zero-padding, the resampling of the sidelobes follows a steady, predictable, analyzable trend. Interpreting zero-padding as shortening the length of the rectangular window relative to the length of the transform aperture is completely consistent with the sidelobe behavior and relevant analysis. From that perspective it then becomes fairly obvious that any window function to be applied beyond the inherent rectangular window is applied only to the non-padded data. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org
On Mar 9, 8:41 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "Ron N." <rhnlo...@yahoo.com> wrote in message > > Zero padding is equivalent to applying a rectangular window. > > I don't see how..... assuming that the rectangular window has already been > applied then what does zero padding do? > > Zero padding is equivalent to interpolation in the transform domain.
Which, for a perfect bandlimiting interpolation filter, is equivalent to Sinc interpolation (or Dirichlet in the sampled data case). And, given that the transform of a rectangular window is a Sinc, Sinc interpolation in the frequency domain is identical to a using longer transform with a rectangular window in the time domain. IMHO. YMMV.
"Eric Jacobsen" <eric.jacobsen@ieee.org> wrote in message 
news:2amat35pooks5ri7928bbpocsfj30bnoqj@4ax.com...
> On Mon, 10 Mar 2008 01:48:17 -0700 (PDT), "Ron N." > <rhnlogic@yahoo.com> wrote: > >>On Mar 9, 9:41 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> >>wrote: >>> "Ron N." <rhnlo...@yahoo.com> wrote in message >>> >>> news:bc1bbe96-e40a-4d0c-8d24-8c9994bbddca@e25g2000prg.googlegroups.com... >>> >>> >>> >>> > Zero padding is equivalent to applying a rectangular window. >>> >>> I don't see how..... assuming that the rectangular window has already >>> been >>> applied then what does zero padding do? >> >>Zero padding n data samples before a transform is equivalent >>to applying a rectangular window of length n inside a >>transform of length greater than n. The zero padding >>causes zero-valued points to be represented in the >>longer transform results, same as a rectangular window. >> >>IMHO. YMMV. > > I agree completely and this is why I claim that the FFT has "inherent" > rectangular windowing; if you watch the behavior of the sidelobes as > you analyse the effects of the rectangular window from say 4:1 > oversampled from zero-padding down to a few samples zero-padded then > down to no zero-padding, the resampling of the sidelobes follows a > steady, predictable, analyzable trend. > > Interpreting zero-padding as shortening the length of the rectangular > window relative to the length of the transform aperture is completely > consistent with the sidelobe behavior and relevant analysis. > > From that perspective it then becomes fairly obvious that any window > function to be applied beyond the inherent rectangular window is > applied only to the non-padded data. > > Eric Jacobsen > Minister of Algorithms > Abineau Communications > http://www.ericjacobsen.org
We have no disagreement with the math. This is about symantics. I was looking at it from a functional / procedural / operational point of view. To me, "zero padding" implies "adding" zeros to an existing function. I have a little trouble saying this: "I'm going to take this function and *zero pad* it by multiplying it by a shorter gate function." I don't think that's what "zero padding" means or is intended to mean. So, I don't see how the *operation* "zero padding" can have a multiply involved. And, thus my comment. Fred
"Ron N." <rhnlogic@yahoo.com> wrote in message 
news:1689cc09-fe71-4950-9dfe-e627ecdedc90@s12g2000prg.googlegroups.com...
> On Mar 9, 9:41 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > wrote: >> "Ron N." <rhnlo...@yahoo.com> wrote in message >> >> news:bc1bbe96-e40a-4d0c-8d24-8c9994bbddca@e25g2000prg.googlegroups.com... >> >> >> >> > Zero padding is equivalent to applying a rectangular window. >> >> I don't see how..... assuming that the rectangular window has already >> been >> applied then what does zero padding do? > > Zero padding n data samples before a transform is equivalent > to applying a rectangular window of length n inside a > transform of length greater than n. The zero padding > causes zero-valued points to be represented in the > longer transform results, same as a rectangular window.
We agree on the math but not on the words. When is 2+2 not 1+1+1+1 ?? How many clocks does each take? etc. etc. Zero padding n data samples before a transform adds zeros - presumably where there is no other information. There is *no* multiplication involved here from an operational point of view. And, there is no multiplication from a signal processing / linear systems point of view. Applying a rectangular window of length n inside a transform of length greater than n throws away information. And, here is where there's a multiplication. I have a hard time saying that these are functionally the "same" - even though I know that the resulting transforms will be identical. It's a "system" kind of thing. I'd like to hear the lecture that goes through the zero padding steps and argues that there's an implied multiplication in time. I can imagine: "it's as if" but that's all. I hope this makes the intent clearer. Fred
On Mar 10, 11:32 am, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:

> ... > I was looking at it from a functional / procedural / operational point of > view. > To me, "zero padding" implies "adding" zeros to an existing function. > > I have a little trouble saying this: > "I'm going to take this function and *zero pad* it by multiplying it by a > shorter gate function." I don't think that's what "zero padding" means or > is intended to mean. > > So, I don't see how the *operation* "zero padding" can have a multiply > involved. > And, thus my comment. > > Fred
Perhaps the problem stems from thinking that the functional and operational viewpoints are the same. They aren't. When a long sequence has a shorter window applied, the windowed elements are multiplied by a weight. If the result is placed in an array of greater length than the window size, the function performed is the same as that of weighting a longer sequence with some of the weights zero. The operations performed are different. The multiplies by zero can be performed more efficiently by simply loading a zero into the location and saving the expense of a multiply. We can also be more efficient by not generating the samples we would multiply by zero. If the window was rectangular, the function can be performed more efficiently by the operation of loading the elements into the array without a multiplication than by using a multiplication by one, but the function is the same as windowing. The operations are different only because of a special properties of the values of the window coefficients. Windowing and zero-padding are functions that can be usefully defined as processes that use multiplies. They can be efficiently performed by operations not performing trivial multiplies. Dale B. Dalrymple