<p dir="auto">Hi,<br>
In testing the <code class="notranslate">hann</code> function (and a few others), odd length windows are the same for both symmetrical and periodic types. For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from scipy.signal import hann
w1 = hann(5,True) #array([ 0. ,  0.5,  1. ,  0.5,  0. ])
w2 = hann(5, False) #array([ 0. ,  0.5,  1. ,  0.5,  0. ])"><pre class="notranslate"><code class="notranslate">from scipy.signal import hann
w1 = hann(5,True) #array([ 0. ,  0.5,  1. ,  0.5,  0. ])
w2 = hann(5, False) #array([ 0. ,  0.5,  1. ,  0.5,  0. ])
</code></pre></div>
<p dir="auto">I think the cause is the N-1 denominator which is not adjusted for odd lengths when periodic.</p>
<p dir="auto">I believe this issue was brought up <a href="http://lists.ipython.scipy.org/pipermail/numpy-discussion/2014-September/071270.html" rel="nofollow">here</a></p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1665" rel="nofollow">http://projects.scipy.org/scipy/ticket/1665</a> on 2012-05-30 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/endolith/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/endolith">@endolith</a>, assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/cournape/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/cournape">@cournape</a>.</em></p>
<p dir="auto">The window functions in scipy.signal have a <code class="notranslate">sym</code> option for producing symmetric windows or periodic windows, but if you create a periodic window of an odd size, it gives identical output to a symmetric window.  This is in the code, but is it right?  It doesn't match Matlab's behavior, as described [https://ccrma.stanford.edu/~jos/sasp/Matlab_Hamming_Window.html here].</p>
<p dir="auto">If it's right, it should be documented why it works this way</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt; hamming(3) % same in Matlab and Octave
ans =
    0.0800
    1.0000
    0.0800
&gt;&gt; hamming(3,'symmetric') % Matlab only
ans =
    0.0800
    1.0000
    0.0800
&gt;&gt; hamming(3,'periodic') % Matlab only
ans =
    0.0800
    0.7700
    0.7700
&gt;&gt; hamming(4) % same in Matlab and Octave
ans =
    0.0800
    0.7700
    0.7700
    0.0800"><pre class="notranslate"><code class="notranslate">&gt;&gt; hamming(3) % same in Matlab and Octave
ans =
    0.0800
    1.0000
    0.0800
&gt;&gt; hamming(3,'symmetric') % Matlab only
ans =
    0.0800
    1.0000
    0.0800
&gt;&gt; hamming(3,'periodic') % Matlab only
ans =
    0.0800
    0.7700
    0.7700
&gt;&gt; hamming(4) % same in Matlab and Octave
ans =
    0.0800
    0.7700
    0.7700
    0.0800
</code></pre></div>
<p dir="auto">SciPy:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [2]: hamming(3)
Out[2]: array([ 0.08,  1.  ,  0.08])

In [3]: hamming(3,sym=True)
Out[3]: array([ 0.08,  1.  ,  0.08])

In [4]: hamming(3,sym=False)
Out[4]: array([ 0.08,  1.  ,  0.08])

In [5]: hamming(4)
Out[5]: array([ 0.08,  0.77,  0.77,  0.08])

In [6]: hamming(4, sym=True)
Out[6]: array([ 0.08,  0.77,  0.77,  0.08])

In [7]: hamming(4, sym=False)
Out[7]: array([ 0.08,  0.54,  1.  ,  0.54])"><pre class="notranslate"><code class="notranslate">In [2]: hamming(3)
Out[2]: array([ 0.08,  1.  ,  0.08])

In [3]: hamming(3,sym=True)
Out[3]: array([ 0.08,  1.  ,  0.08])

In [4]: hamming(3,sym=False)
Out[4]: array([ 0.08,  1.  ,  0.08])

In [5]: hamming(4)
Out[5]: array([ 0.08,  0.77,  0.77,  0.08])

In [6]: hamming(4, sym=True)
Out[6]: array([ 0.08,  0.77,  0.77,  0.08])

In [7]: hamming(4, sym=False)
Out[7]: array([ 0.08,  0.54,  1.  ,  0.54])
</code></pre></div>