Forums

Has any one seen this window function?

Started by Cedron 4 days ago10 replieslatest reply 9 hours ago126 views
Here is the definition:

\( w[n] = 4 \sin \left( \frac{n}{N}\pi \right) \sin \left( \frac{n+1}{N}\pi \right) \)

It's special, because it ensures that

$$ w[0] =  w[N-1] = 0 $$

And it centers the window function on the samples (end to end) rather than the frame.

The derivation can be found here:

Why could window function help to get more accurate specific frequency amplitude?

I can't match it to any in the classic harris paper:

"On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform. FREDRIC J. HARRIS"

or here:

en.wikipedia.org/wiki/Window_function


Did I miss it as a special case of one of the parameterized equations?

Of course, the Sine terms could also be raised to powers for a wider stance on the DFT.

Do any of the windows experts in the house care to give it an objective independent evaluation, ala the wiki treatment?

Thanks in advance.
[ - ]
Reply by rbjAugust 1, 2020

maybe you could float this at the dsp.stackexchange

[ - ]
Reply by CedronAugust 1, 2020

Follow the link, it sort of is.  I wanted a more slow paced, discussion oriented forum.

[ - ]
Reply by kazAugust 1, 2020

it looks same (or very close) as hanning window scaled by 4

[ - ]
Reply by CedronAugust 1, 2020

It is, very close.  I would call it the Discrete VonHann (I consider the term hanning erroneous even if it is commonly used).


$$ \lim_{N \to \infty} w[n] = VonHann[n] $$


The scaling factor popped out of the derivation and I left it as it is immaterial.

It isn't new to me, implicit in my frequency formula.


[ - ]
Reply by kazAugust 1, 2020

And I assume any vector that goes up then comes down is defined as window but it needs a name. The only difference is the boxcar window which is not a window!!


[ - ]
Reply by CedronAugust 1, 2020
Agreed about the boxcar window not being a window.


If this window function is "new", then the best name IMO, as I mentioned, is "The Discrete VonHann". 


Follow the derivation link at top.  I framed it as a weighted average of DFT bins with a weighting of:

$$ ( -e^{i\omega}, e^{i\omega}+ e^{-i\omega},-e^{-i\omega} ) $$

and that is the window function when

$$ \omega = \frac{2\pi}{N} $$

The window function family can also be expressed in this near VonHonn form:

$$ \cos ( \omega) - \cos \left( \frac{n}{N}2\pi + \omega \right) $$

I'll whip up some numbers but I wanted nice charts and official numbers.

[ - ]
Reply by Rick LyonsAugust 3, 2020

Hi kaz. Whether or not a boxcar (rectanglar) sequence is a window depends on your definition of the word "window".

[ - ]
Reply by CedronAugust 4, 2020
I think the whole window thing is easily understood from a definitional basis.

Compare how the (1/N) DFT is related to its continuous counter parts, the FT and DTFT, are defined on the same interval.

The DFT:

\( \frac{1}{N} \sum_{n=0}^{N-1} x[n] e^{-i\frac{2\pi}{N}kn} \)

The FT:

\( \int_{-\infty}^{\infty} w(t) x(t) e^{-i2\pi t f } dt \)

The DTFT

\( \frac{1}{N} \sum_{n=-\infty}^{\infty} w[n] x[n] e^{-i\omega n} \)

\( \omega = \frac{k}{N}2\pi \)

Where the window functions are, and their respective required nature, should be obvious to the eye.
[ - ]
Reply by Rick LyonsAugust 3, 2020

Hi Cedron. I've not seen that w[n] window sequence before. It's frequency-domain behavior is super-similar to the Von Hann (hanning) window if we ignoring w[n]'s zero Hz gain factor. My guess is, in practice there will be very little difference between using your w[n] window compared to using a Von Hann window.

[ - ]
Reply by CedronAugust 3, 2020
Hi Rick, thanks for your reply.  

For any N more than fingers and a few toes, I totally agree, no functional difference beyond a gnat hair.  This is more of a theoretical thing.

Perhaps, "The Discrete VonHann" is too strong of a claim.  The VonHonn is at the base of a lot of families.


It is derived, not contrived.  Natural so to speak.


I am now thinking "Dipped and Shifted Von Hann" as that quite matches the cosine version.  Thus, DSVH is my working acronym.

The most concise behavior description I can come up with is "The VonHann is slightly lowered and shifted by a half sample so $w[0]=w[N-1]=0$.  This also shifts the peak of the window function one half sample to the mean of the endpoints not the center of the frame."

So, centered on the samples instead of centered on the frame, yet still a genuine VonHann.  (My rescaling is still arbitrary at this point.)

Here's a comparison of the two window functions for some fairly small N.

------------------------------------

      VonHann     DSVH

Eleven
  0   0.00000     0.00000
  1   0.00722     0.01385
  2   0.02657     0.03714
  3   0.05192     0.06250
  4   0.07522     0.08185
  5   0.08907     0.08907
  6   0.08907     0.08185
  7   0.07522     0.06250
  8   0.05192     0.03714
  9   0.02657     0.01385
 10   0.00722     0.00000

Twelve 
  0   0.00000     0.00000
  1   0.00558     0.01078
  2   0.02083     0.02946
  3   0.04167     0.05103
  4   0.06250     0.06971
  5   0.07775     0.08049
  6   0.08333     0.08049
  7   0.07775     0.06971
  8   0.06250     0.05103
  9   0.04167     0.02946
 10   0.02083     0.01078
 11   0.00558     0.00000
------------------------------------

A more formal analysis on the differences at low N might be more interesting to some one besides me.

Here's some starter code for those who want to to get started.

#---- Build the VonHann Windows

        theNormed  = np.zeros( N )
        theVonHann = np.zeros( N )
        theDSVH    = np.zeros( N )

        for n in range( N ):
          theNormed[n] = RN

          theVonHann[n] = 0.5 * ( 1.0  - np.cos( theBeta * n ) )\
                        * RN

          theDSVH[n]  = np.sin (   n       * theBeta * 0.5 ) \
                      * np.sin ( ( n + 1 ) * theBeta * 0.5 ) \
                      * RN

          theDSVH2 = ( np.cos( theBeta * 0.5 )           \
                     - np.cos( theBeta * ( n + 0.5 ) ) ) \
                   * 0.5 * RN

          print( "%3d  %8.5f    %8.5f    %8.5f" % \
                 ( n, theVonHann[n], theDSVH[n], theDSVH2 ) )

I'm studying it more, works well in the math.  I'll be putting that in a blog article and adding a link here (or not... for a while).

(All: I'm holding off any spoiliers I find, and if you have any of your own, please post only links here with a whispy description for those who wish to follow after taking a stab at it on their own.)


Thanks.