Hi - mea culpa - as pointed out by a colleague (and documented in the help document for "hanning" in Matlab), this function produces the same window, but without the first and last zero-weighted samples.

Cheers -- Ariel

On Tue, Feb 9, 2010 at 4:58 PM, Ariel Rokem wrote:
Hi everyone,

Mystery solved (I think)! It turns out that matlab has two functions, one called "hann" and the other called "hanning". They both purport to produce the hanning window, but they produce two (slightly) different things. Only one of these (the one given by "hann") actually produces the hanning window as it is defined in the standard reference on this (Harris 1978. And also Wikipedia ;D). When using the "hann" function in Matlab in this little experiment, the difference between the python and the matlab results, is on the order of %10e-6. I think I am willing to live with that.

The only mystery that remains (I think) is - what is Matlab's "hanning" supposed to be doing? Are there two different windows: hann and hanning (not "hamming" - I know that's a different one)?

Cheers,

Ariel

On Mon, Feb 8, 2010 at 9:32 AM, Ariel Rokem wrote:
Hi -

the maximal difference in this case is of about 6 (units?), which is an approximately 50% difference. This is in one point in the spectrum which has a relatively small value - the maximal peaks in the spectra are on the order of 1200, so in the grand scheme of things, not that horrible. Other large differences are on the order of 4, which is approximately 5% or less of those points.

Thanks - Ariel

PS for some reason, matplotlib-devel will not get your email unless you hit "reply all", so they have been getting my emails, but not yours. I am not sure whether that is what you intended, so I thought I would mention it.

On Mon, Feb 8, 2010 at 1:24 AM, Ludwig Schwardt wrote:
Hi,

On Mon, Feb 8, 2010 at 5:25 AM, Ariel Rokem <arokem@berkeley.edu> wrote:
> I don't think that the cause of the discrepancy is because of the
> hamming/hanning window difference. I do set the window in the matlab part to
> also be a hanning window of length nfft.

I suspected you gave the same window to both, but I was just
checking... :-) To find those smaller discrepancies might be a bit
harder then, requiring a careful comparison of the various steps
involved. Just for interest's sake, how big are the differences we are

Regards,
Ludwig

--
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel

--
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel

--
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel