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? -Michael

# windowing and zero-padding

Started by ●March 7, 2008

Reply by ●March 7, 20082008-03-07

On Mar 7, 11: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? > > -MichaelMichael, The window should be the same length as the data, not rounded up to the next power of 2. Also, you want to use the definition of the window where the 1st and last point are the same. For 'n' data points, and an 'n' point FFT, the 2nd point and the last point are usually the same. The first window is symmetric, the second is implied symmetric when you consider the implied periodicity of the data being FFT'ed. Dirk

Reply by ●March 7, 20082008-03-07

M.Aramini@verizon.net wrote in news:dde1bcd3-767e-4d52-a511- 244731ef086f@y77g2000hsy.googlegroups.com:> 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? > > -MichaelFor many FFT alogrithms, a power of 2 is no longer necessary. -- Scott Reverse name to reply

Reply by ●March 7, 20082008-03-07

The sequence of operations is: Step 1 : First multiply data with window coefficients. Step 2 : Zero pad to next power of 2. Step 3 : Perform FFT. Regards Bharat Pathak Arithos Designs www.Arithos.com

Reply by ●March 7, 20082008-03-07

On Mar 7, 8:44 am, dbell <bellda2...@cox.net> wrote:> > ... > Also, you want to use the definition of the window where the 1st and > last point are the same. For 'n' data points, and an 'n' point FFT, > the 2nd point and the last point are usually the same. The first > window is symmetric, the second is implied symmetric when you consider > the implied periodicity of the data being FFT'ed. > > DirkActually, with the FFT you want to use the window symmetry where the first point and the point after the last point are the same, and sometimes zero. (Yes, this makes the second and last the same, but the explanation makes more sense with the first and next after last.) This is sometimes refered to as 'FFT-even' symmetry where 'even' means that real input produces real transform output. See the explanation in section II of: http://www.signumconcepts.com/download/paper001.pdf which is a portion of fred harris proceedings paper on windows. Dale B. Dalrymple http://dbdimages.com

Reply by ●March 7, 20082008-03-07

On Mar 7, 12:24�pm, dbd <d...@ieee.org> wrote:> On Mar 7, 8:44 am, dbell <bellda2...@cox.net> wrote: > > > > > ... > > Also, you want to use the definition of the window where the 1st and > > last point are the same. �For 'n' data points, and an 'n' point FFT, > > the 2nd point and the last point are usually the same. The first > > window is symmetric, the second is implied symmetric when you consider > > the implied periodicity of the data being FFT'ed. > > > Dirk > > Actually, with the FFT you want to use the window symmetry where the > first point and the point after the last point are the same, and > sometimes zero. (Yes, this makes the second and last the same, but the > explanation makes more sense with the first and next after last.) This > is sometimes refered to �as 'FFT-even' symmetry where 'even' means > that real input produces real transform output. > See the explanation in section II of:http://www.signumconcepts.com/download/paper001.pdf > which is a portion of fred harris proceedings paper on windows. > > Dale B. Dalrymplehttp://dbdimages.comI like "next after last"; technically the point after the last point would then be the last point. :-) Seriously, the point after the last point, would be an implied definition. I didn't think the OP would get it. If he is using equations to define the windows (I am reasonably sure he is) my description would let him know if he had the right definition or not. Just trying to be helpful. Dirk

Reply by ●March 7, 20082008-03-07

On Mar 7, 9:35 am, dbell <bellda2...@cox.net> wrote:> On Mar 7, 12:24 pm, dbd <d...@ieee.org> wrote: > > > > > On Mar 7, 8:44 am, dbell <bellda2...@cox.net> wrote: > > > > ... > > > Also, you want to use the definition of the window where the 1st and > > > last point are the same. For 'n' data points, and an 'n' point FFT, > > > the 2nd point and the last point are usually the same. The first > > > window is symmetric, the second is implied symmetric when you consider > > > the implied periodicity of the data being FFT'ed. > > > > Dirk > > > Actually, with the FFT you want to use the window symmetry where the > > first point and the point after the last point are the same, and > > sometimes zero. (Yes, this makes the second and last the same, but the > > explanation makes more sense with the first and next after last.) This > > is sometimes refered to as 'FFT-even' symmetry where 'even' means > > that real input produces real transform output. > > See the explanation in section II of:http://www.signumconcepts.com/download/paper001.pdf > > which is a portion of fred harris proceedings paper on windows. > > > Dale B. Dalrymplehttp://dbdimages.com> > I like "next after last"; technically the point after the last point > would then be the last point. :-)I should have added 'in the window'.> > Seriously, the point after the last point, would be an implied > definition. I didn't think the OP would get it. If he is using > equations to define the windows (I am reasonably sure he is) my > description would let him know if he had the right definition or not. > > Just trying to be helpful. > > DirkWe agree, your version is a good 'how' for the OP; mine is directed to a 'why' if the OP wants to know that, too. Dale B. Dalrymple

Reply by ●March 8, 20082008-03-08

On Mar 7, 5:16�pm, 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?I am not sure I understand. You start with a data sequence of length N? You zero-pad this 'unwindowed' sequence to some length M > N? If you want to apply a window to this zero padded sequence, should the window be length N or length M? If this is the question, I would suggest to use an N-length window first and then zero-pad, if for no other reason than to avoid various issues about symmetry: How do you match an M-length window with an N-length data sequence? Should you center the original data series before applying the M-length window in order to preserve a symmetrical scaling of the (original) data? Or should you accept the zero-paddes sequence as is and apply an unsymmetrical window to the (original) data? I am sure arguments can be presented to support either approach; it is still easiest to use the N-length window and avoid the whole issue. Rune

Reply by ●March 8, 20082008-03-08

Rune Allnor wrote: ...> 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. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●March 8, 20082008-03-08

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