[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in IDL's hanning() window-generating function



Jaco van Gorkom wrote:
> 
> David Fanning wrote:
> > Scott Bennett writes after a long analysis of the Hanning function:
> >
> > >      In any case, I think the point Harris made is that a discrete
> > > sampling of a window function should not taper to the same value at
> > > the end that it has at the beginning because to do so would include
> > > the first sample of the *next* period (windowed segment.)  So IDL's
> > > hanning() gets it wrong for both even- and odd-length windows. :-(
> >
> > Uh, huh. And how did RSI respond when you contacted them
> > about it?
> 
> I suspect they would suggest the following workaround:
> 
> function Harris, n, _EXTRA=extra
>    return, (hanning(n+1, _EXTRA=extra))[0:n-1]
> end
> 
> Scott, I've read your post, but I'm not sure I'm getting the point.
> Tapering from zero to zero seems like good idea to me, the symmetry
> sort of "feels good". Besides, it is convenient to have the weight of
> the window at its centre. What exactly is so wrong with it?

Hello,

I think Scott's post underscores the fact that any sort of Fourier analysis is not to be
undertaken lightly without fully understanding how any code used works (or is supposed to
work) and knowing, in some fashion, what the result should look like in advance. The
difference of a point (or a window being a little bit wider etc) can make a *huge*
difference in how one interprets or subsequently uses the results in FFT applications.
While I'm not dismissing your comments about the good vibrations one typically gets from
symmetry (I try to achieve that as much as possible too) I'm going to file Scott's message
under the "READ_THESE_FIRST!!!" sub-directory in my FFT code/work directory.  :o)

paulv

-- 
Paul van Delst           A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP        Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274  There shallow draughts intoxicate the brain,
Fax:(301)763-8545        And drinking largely sobers us again.
                                         Alexander Pope.