MATLAB Hanning & Hamming Windows in MATLAB: Why the Discrepancy?

  • Thread starter Thread starter truva
  • Start date Start date
  • Tags Tags
    Matlab Window
AI Thread Summary
The Hanning window is defined as 0.5 + 0.5*cos(2*pi*n/N) for n in the range [-(N-1)/2, (N-1)/2], where N is an odd number. Users have noted discrepancies between this definition and MATLAB's "hanning" and "hann" functions, which produce slightly different results. It is suggested that the issue arises from the formula used in MATLAB, where replacing N with (N-1) in the denominator aligns the results with MATLAB's output. This discrepancy also applies to the Hamming window. The discussion highlights the importance of understanding these differences for accurate digital signal processing.
truva
Messages
18
Reaction score
1
Hi all

As far as I know Hanning window is defined as the following:
.5+.5*cos(2*pi*n/N) and n is between [-(N-1)/2,(N-1)/2] here N is odd number.

MATLAB functions "hanning" with symetric or periodic options or "hann" do not match with the results of the above formula. There is always a slight annoying difference !

Do you know the problem?

(Same thing for Hamming window)
 
Physics news on Phys.org
As I understand the book is wrong (Notes On Digital Signal Processing by C. Britton Rorabaugh). If I replace the N by (N-1) in the denumerator of the formulation which is 5+.5*cos(2*pi*n/(N-1)), the results coincide exactly with that of MATLAB.

Thank you for the link.
 

Similar threads

Back
Top