Recent from talks
Nothing was collected or created yet.
Hann function
View on Wikipedia
The Hann function is named after the Austrian meteorologist Julius von Hann. It is a window function used to perform Hann smoothing or hanning.[1][2] The function, with length and amplitude is given by:
For digital signal processing, the function is sampled symmetrically (with spacing and amplitude ):
which is a sequence of samples, and can be even or odd. It is also known as the raised cosine window, Hann filter, von Hann window, Hanning window, etc.[2][3][4]
Fourier transform
[edit]
The Fourier transform of is given by:
Using Euler's formula to expand the cosine term in we can write:
which is a linear combination of modulated rectangular windows:
Transforming each term:
Discrete transforms
[edit]The discrete-time Fourier transform (DTFT) of the length, time-shifted sequence is defined by a Fourier series, which also has a 3-term equivalent that is derived similarly to the Fourier transform derivation:
The truncated sequence is a DFT-even (aka periodic) Hann window. Since the truncated sample has value zero, it is clear from the Fourier series definition that the DTFTs are equivalent. However, the approach followed above results in a significantly different-looking, but equivalent, 3-term expression:
An N-length DFT of the window function samples the DTFT at frequencies for integer values of From the expression immediately above, it is easy to see that only 3 of the N DFT coefficients are non-zero. And from the other expression, it is apparent that all are real-valued. These properties are appealing for real-time applications that require both windowed and non-windowed (rectangularly windowed) transforms, because the windowed transforms can be efficiently derived from the non-windowed transforms by convolution.[5][c][d]
Name
[edit]The function is named in honor of von Hann, who used the three-term weighted average smoothing technique on meteorological data.[6][2] However, the term Hanning function is also conventionally used,[7] derived from the paper in which the term hanning a signal was used to mean applying the Hann window to it.[4][8] It is distinct from the similarly-named Hamming function, named after Richard Hamming.
See also
[edit]Page citations
[edit]- ^ Nuttall 1981, p 84 (3)
- ^ Nuttall 1981, p 86 (17)
- ^ Nuttall 1981, p 85
- ^ Harris 1978, p 62
References
[edit]- ^ Essenwanger, O. M. (Oskar M.) (1986). Elements of statistical analysis. Elsevier. ISBN 0444424261. OCLC 152410575.
- ^ a b c
Kahlig, Peter (1993), "Some aspects of Julius von Hann's contribution to modern climatology", in McBean, G.A.; Hantel, M. (eds.), Interactions Between Global Climate Subsystems: The Legacy of Hann, Geophysical Monograph Series, vol. 75, American Geophysical Union, pp. 1–7, doi:10.1029/gm075p0001, ISBN 9780875904665, retrieved 2019-07-01,
Hann appears to be the inventor of a certain data smoothing procedure, now called "hanning" ... or "Hann smoothing" ... Essentially, it is a three-term moving average (running mean) with unequal weights (1/4, 1/2, 1/4).
- ^ Smith, Julius O. (Julius Orion) (2011). Spectral audio signal processing. Stanford University. Center for Computer Research in Music and Acoustics., Stanford University. Department of Music. [Stanford, Calif.?]: W3K. ISBN 9780974560731. OCLC 776892709.
- ^ a b Blackman, R. B.; Tukey, J. W. (1958). "The measurement of power spectra from the point of view of communications engineering — Part I". The Bell System Technical Journal. 37 (1): 273. doi:10.1002/j.1538-7305.1958.tb03874.x. ISSN 0005-8580.
- ^ US patent 6898235, Carlin, Joe; Collins, Terry & Hays, Peter et al., "Wideband communication intercept and direction finding device using hyperchannelization", published 1999-12-10, issued 2005-05-24, also available at https://patentimages.storage.googleapis.com/4d/39/2a/cec2ae6f33c1e7/US6898235.pdf
- ^
von Hann, Julius (1903). Handbook of Climatology. Macmillan. p. 199.
The figures under b are determined by taking into account the parallels 5° away on either side. Thus, for example, for latitude 60° we have ½[60 + (65 + 55)÷2].
- ^
Harris, Fredric J. (Jan 1978). "On the use of Windows for Harmonic Analysis with the Discrete Fourier Transform" (PDF). Proceedings of the IEEE. 66 (1): 51–83. CiteSeerX 10.1.1.649.9880. doi:10.1109/PROC.1978.10837.
The correct name of this window is 'Hann.' The term 'Hanning' is used in this report to reflect conventional usage. The derived term 'Hann'd' is also widely used.
- ^
Blackman, R. B. (Ralph Beebe); Tukey, John W. (John Wilder) (1959). The measurement of power spectra from the point of view of communications engineering. New York : Dover Publications. pp. 98. LCCN 59-10185.
{{cite book}}: CS1 maint: publisher location (link)
- Nuttall, Albert H. (Feb 1981). "Some Windows with Very Good Sidelobe Behavior". IEEE Transactions on Acoustics, Speech, and Signal Processing. 29 (1): 84–91. doi:10.1109/TASSP.1981.1163506.
External links
[edit]Hann function
View on GrokipediaDefinition and Formulation
Continuous Hann Function
The continuous Hann function serves as a foundational raised cosine window in signal processing, providing a smooth tapering envelope for theoretical analysis of continuous-time signals. It is mathematically defined as for , and otherwise, where is the length parameter specifying the total width of the support interval.[8] This formulation arises from the raised cosine shape, which inherently produces a periodic cosine curve adjusted to span exactly one full period over the interval , ensuring the function transitions smoothly from zero at the boundaries to a peak value of 1 at the center .[8] Graphically, the continuous Hann function forms a symmetric, bell-shaped curve centered at the origin, with the amplitude gradually increasing from 0 at to the maximum at , and exhibiting even symmetry due to the cosine term. This shape emphasizes the central portion of the signal while suppressing edge discontinuities. In relation to the rectangular window, which is uniform at amplitude 1 over the same interval, the continuous Hann function introduces a cosine-based modulation to taper the edges, thereby mitigating spectral leakage effects such as high sidelobes in frequency-domain representations. The discrete Hann window represents a sampled version of this continuous form for practical digital implementations.Discrete Hann Window
The discrete Hann window is a finite sequence derived by uniformly sampling the continuous Hann function over an interval of length with points, which provides even symmetry and exact zeros at the endpoints. This formulation is widely used in digital signal processing to taper finite-duration signals while minimizing edge discontinuities.[7] The standard symmetric discrete Hann window is defined as where determines the window length . This yields a sequence with w{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}} = 0 and , ensuring the window tapers smoothly to zero at both ends. An alternative indexing convention defines the window over to with , using the equivalent form which maintains the symmetric properties but adjusts the denominator for the finite range.[1] Normalization options include unity peak value (maximum of 1 at the center) or coherent gain of 0.5, corresponding to the average window value, which is the DC gain in the frequency domain.[7] In practice, the discrete Hann window is computed directly using the cosine expression in programming environments, or equivalently via the identity , yielding , which can offer slight numerical advantages for certain implementations. For example, with (length 3), the sequence is , illustrating the central peak and endpoint zeros.[9] Unlike the continuous Hann function, which is defined over an infinite or semi-infinite domain, the discrete version arises from sampling at integer points over a closed interval [0, N], inherently producing exact zeros at and due to the periodicity of the cosine and the choice of denominator, enhancing symmetry for even-length sequences. Common variants include the symmetric form (with endpoint zeros, suitable for filter design) and the periodic form (designed for spectral analysis via FFT, where the window approximates one full period without forcing endpoint zeros). The periodic variant is generated by evaluating the formula over points and truncating to length , ensuring better continuity in periodic extensions.[7][1]Mathematical Properties
Fourier Transform
The continuous Fourier transform of the normalized Hann function, where the time-domain function is scaled by 1/L to ensure unit integral, is given by for , with appropriate limits at those points. This closed-form expression arises from combining the contributions of the constant and cosine terms in the time domain.[10] To derive this, the cosine in the Hann function for is expressed using Euler's formula as , transforming the integral into the Fourier transform of a rectangular window plus differenced shifted versions at frequencies . The resulting sum simplifies to the closed form after algebraic manipulation using trigonometric identities for the sine arguments and common denominator resolution.[10] In the frequency domain, the central lobe originates from the average value of 1/2 in the time-domain expression, producing a broad sinc-like shape centered at DC, while the cosine modulation introduces interference from the shifted components, manifesting as sidelobes shaped by the three primary terms at DC and . This structure enhances frequency resolution compared to unwindowed signals by concentrating energy near zero frequency.[10] The sidelobes exhibit asymptotic decay proportional to , a significant improvement over the rectangular window's decay, attributable to the Hann function's smoothness—being zero at endpoints with a continuous first derivative but discontinuous second derivative. This rapid roll-off reduces distant spectral leakage effectively.[10] The 1/L normalization scaling ensures the transform's amplitude, particularly the height of the central lobe, remains independent of the window duration L, facilitating consistent spectral analysis across varying signal lengths; without it, amplitudes would scale linearly with L, amplifying low-frequency components disproportionately for longer windows.[10]Discrete Transforms
The discrete-time Fourier transform (DTFT) of the Hann window sequence , defined for the periodic variant as to with , is given by which simplifies to a closed-form involving three shifted sinc functions: where and accounts for the linear phase shift due to time centering.[11][2] Due to the even symmetry of the Hann window around its center, is real and even after removing the linear phase term, ensuring phase linearity.[11] The discrete Fourier transform (DFT) of the length- Hann sequence samples the DTFT at frequencies for integer , introducing periodic aliasing due to the finite length but preserving the overall spectral shape.[11] For the periodic definition using denominator in the cosine argument, the DFT exhibits exact sparsity with only three non-zero bins: at with value , and at and with value each (up to the overall scaling by ), arising from the window's construction as a linear combination of DFT basis functions at DC and the adjacent bins; all other bins are exactly zero.[2] This sparsity holds for any and contrasts with denser spectra from the symmetric definition (e.g., denominator ), where energy leaks slightly beyond three bins.[12] The sparse DFT structure of the Hann window enables efficient computations, such as fast convolution in filter design or spectral analysis, where time-domain windowing corresponds to frequency-domain convolution with a three-tap kernel (non-zeros at bins 0, 1, and ), reducing complexity from to per output sample.[2] For example, consider a length-8 Hann window () with values ; its DFT yields non-zero values of 4 at , -2 at , and -2 at , confirming the sparsity and aiding applications like overlap-add methods in audio processing.[12]Applications and Characteristics
Signal Processing Uses
In digital signal processing, the Hann window is commonly applied to time-domain signals prior to computing the fast Fourier transform (FFT) to mitigate spectral leakage, which arises when analyzing non-periodic or finite-length data segments. By tapering the signal edges to zero, it reduces the discontinuities that cause energy to spread into adjacent frequency bins, thereby improving the accuracy of frequency content estimation in applications such as spectrum analysis.[13][4] The Hann window plays a key role in overlap-add (OLA) methods, particularly within the short-time Fourier transform (STFT) and filter banks, where signal segments are processed with 50% overlap between consecutive windows. This overlap, combined with the Hann window's symmetric tapering, satisfies the constant overlap-add (COLA) condition, enabling perfect reconstruction of the original signal upon synthesis without amplitude distortion or phase errors.[14][15][16] As a tapered weighting function, the Hann window is used for smoothing time-series data by serving as a kernel in weighted moving averages, which diminishes edge effects and Gibbs-like oscillations compared to uniform averaging. This approach weights central data points more heavily while gradually reducing influence toward the edges, making it suitable for preprocessing noisy measurements in fields like econometrics or environmental monitoring.[4][17] In audio and speech processing, the Hann window facilitates analysis of transient sounds, such as in voice recognition systems where STFT frames are windowed to capture formant frequencies without excessive leakage. Similarly, in vibration monitoring for mechanical systems, it enhances the detection of resonant modes in accelerometer data by providing balanced resolution for random vibration spectra. For image processing, two-dimensional Hann windows are applied to patches for tasks like edge detection or frequency-domain filtering, reducing artifacts in Fourier-based operations and preserving moderate dynamic range in visual signals.[15][18][19] For practical implementation, combining the Hann window with zero-padding—appending zeros to the windowed segment before the FFT—yields a finer frequency bin spacing, aiding interpolation for peak frequency estimation without altering the underlying resolution limited by the original data length. This technique is particularly useful in real-time systems where computational efficiency and visual clarity in spectrograms are prioritized.[20][21]Spectral Properties and Performance
The Hann window exhibits a coherent gain of 0.5, meaning the amplitude of a coherent spectral component is reduced to half its true value in the discrete Fourier transform (DFT) output.[22] Its equivalent noise bandwidth measures 1.5 bins, indicating that white noise power is spread over 1.5 frequency bins, which moderately broadens the effective resolution compared to a rectangular window.[22] The scalloping loss reaches a maximum of 1.42 dB when a signal frequency falls midway between DFT bins, representing the attenuation in detected amplitude under worst-case bin misalignment.[22] The sidelobe structure of the Hann window's frequency response features a highest sidelobe level of -31 dB relative to the mainlobe peak, providing moderate suppression of spectral leakage from off-bin signals.[22] The sidelobes decay at a rate of 18 dB per octave, which helps in reducing distant interference but may allow noticeable artifacts in scenarios with strong nearby tones.[2] This profile makes the Hann window suitable for applications where moderate leakage is tolerable, such as general-purpose spectral estimation in audio or vibration analysis.| Window | Coherent Gain | ENBW (bins) | Scalloping Loss (dB) | Highest Sidelobe (dB) | Sidelobe Roll-off (dB/octave) |
|---|---|---|---|---|---|
| Rectangular | 1.0 | 1.0 | 3.92 | -13 | -6 |
| Hann | 0.5 | 1.5 | 1.42 | -31 | -18 |
| Hamming | 0.54 | 1.36 | 1.78 | -43 | -6 |
| Blackman | 0.42 | 1.73 | 0.82 | -58 | -18 |
History and Naming
Origins with Julius von Hann
Julius von Hann (1839–1921), an Austrian meteorologist and a foundational figure in climatology, introduced a three-term weighted smoothing method in his Handbuch der Klimatologie (1883) specifically for analyzing temperature data in meteorological observations. This technique was designed to address irregularities in time series by applying unequal weights to consecutive data points, thereby enhancing the reliability of climatological averages. Hann's approach emerged from his extensive work on global temperature distributions and was particularly suited to handling the limitations of early instrumental records. It was detailed in the first edition (1883) and English translation (1903), and elaborated in the third edition (1908).[23] The original formulation utilized weights of , , and for three consecutive points, creating a simple yet effective moving average that emphasized the central value while tapering the contributions from adjacent points. This weighting is mathematically equivalent to a discrete Hann window of length , providing a rudimentary form of low-pass filtering to suppress high-frequency variations. In practice, Hann applied it to raw temperature readings along latitudinal parallels to derive smoother zonal means, such as obtaining a global average temperature of approximately 14.4°C after processing land-based data.[23] Hann's smoothing procedure was developed in the context of eliminating periodic fluctuations inherent in geophysical time series, such as diurnal or seasonal cycles that could distort long-term trends in temperature records. By predating digital signal processing, it represented an analog-era innovation reliant on manual computation, yet it proved instrumental in early climatological research for reducing noise without overly distorting underlying patterns. This discrete weighting scheme later inspired the formulation of the continuous raised cosine function, which extended the tapering concept to analog filtering designs for smoother transitions in signal attenuation during the mid-20th century.[23]Evolution of Terminology
The term "Hanning window" first appeared in signal processing literature during the mid-20th century, notably in the 1958 work by Blackman and Tukey, where it was used to describe the raised cosine window function applied in spectral analysis to mitigate side-lobe effects.[24] Subsequent standardization efforts by organizations such as the International Organization for Standardization (ISO) and the Institute of Electrical and Electronics Engineers (IEEE) have favored the precise term "Hann window" to directly honor its originator, Julius von Hann. For instance, ISO/IEC 14496-3 explicitly defines it as the "Hann window" in the context of audio coding and Fourier transformation.[25] Similarly, IEEE Std 1057-2017 employs "Hann window" in specifications for digitizing waveform recorders, emphasizing its continuous form and derivative properties.[26] A key source of terminological confusion has been its distinction from the Hamming window, which shares a similar raised cosine structure but incorporates a different weighting factor (0.54 for the constant term versus 0.5 for Hann) and was named after Richard W. Hamming to reflect its optimized sidelobe suppression.[2] This overlap led to occasional interchanges in early texts, though the functions differ fundamentally in their spectral characteristics, with the Hamming variant exhibiting slower sidelobe decay.[2] The terminology gained widespread adoption in the 1970s alongside the rise of fast Fourier transform (FFT) algorithms in digital signal processing, where window functions became essential for leakage reduction.[2] A seminal contribution to standardization came from Harris in 1978, who reviewed various windows and advocated for "Hann" as the accurate designation while documenting "Hanning" as a common but imprecise variant in prior literature.[2] In contemporary usage, "Hann window" predominates in academic and mathematical contexts for its etymological fidelity, whereas "Hanning window" persists in some engineering software legacies, such as MATLAB's originalhanning function, which has since been marked obsolete in favor of hann to align with standardized naming.[27] This shift reflects broader efforts to unify terminology across disciplines, reducing ambiguity in implementations like NumPy, where hanning was deprecated in 2017 for the preferred hann.