Hann function: Difference between revisions

Content deleted Content added
Restore the + sign, and undo some awkward edits.
 
(25 intermediate revisions by 9 users not shown)
Line 1:
{{Short description|Mathematical function used in signal processing}}
[[File:Window function and its Fourier transform – Hann (n = 0...N).svg|thumb|480px|right|Hann function (left), and its frequency response (right)]]
The '''Hann function''' is named after the Austrian meteorologist [[Julius von Hann]]. It is a [[window function]] used to perform '''Hann smoothing'''.<ref name=Essenwanger/> The function, with length <math>L</math> and amplitude <math>1/L,</math> is given by''':'''
The '''Hann function''' of length <math>
L,
</math> used to perform '''Hann smoothing''',<ref name=Essenwanger/> is named after the Austrian meteorologist [[Julius von Hann]]. It is a [[window function]] given by''':'''
 
:<math>
w_0(x) \triangleq \left\{
\begin{array}{ccl}
\tfrac{1}{2L}\left(\tfrac{1}{2} + \tfrac{1}{2} \cos \left(\frac{2\pi x}{L} \right) \right) = \tfrac{1}{L}\cos^2 \left(\frac{\pi x}{L}\right),\quad &\left|x\right| \leq L/2\\
0,\quad &\left|x\right| > L/2
\end{array}\right\}.
</math> &nbsp; <ref{{efn-la name=Harris/>|[[#Nuttall|Nuttall 1981]], p 84 (3)}}
 
For [[digital signal processing]], the function can beis sampled symmetrically (with spacing <math>L/N</math>) symmetricallyand asamplitude <math>1</math>)''':'''
 
:<math>
\left .
\begin{align}
w[n] = L\cdot w_0\left(\tfrac{L}{N} (n-N/2)\right) &= \tfrac{1}{2} \left[1 - \cos \left ( \tfrac{2 \pi n}{N} \right) \right]\\
&= \sin^2 \left ( \tfrac{\pi n}{N} \right)
\end{align}
Line 23 ⟶ 21:
</math>
 
which is a sequence of <math>N+1</math> samples, and <math>N</math> can be even or odd. (see {{slink|WindowList functionof window functions|Hann and Hamming windows|nopage=y}}) It is also known as the '''raised cosine window''', '''Hann filter''', '''von Hann window''', etc.<ref name=Kahlig/><ref name=Smith/>
 
== Fourier transform ==
 
[[File: DFT-even Hann window & spectral leakage.png|thumb|300px|right|Top: 16 sample [[Window_functionSpectral_leakage#DFT-evensymmetry|DFT-even]] Hann window. Bottom: Its discrete-time Fourier transform (DTFT) and the 3 non-zero values of its discrete Fourier transform (DFT).]]
 
The [[Fourier transform]] of <math>w_0(x)</math> is given by:
 
:<math>W_0(f) = \tfracfrac{1}{2}\frac{\operatorname{sinc}(Lf)}{(1 - L^2f^2)} = \frac{\sin(\pi Lf)}{2\pi L f(1 - L^2f^2)}</math> &nbsp; {{efn-la
|[[#Nuttall|Nuttall 1981]], p 86 (17), except for a factor of <math>L</math> in the denominator
}}
{{math proof|title=Derivation|proof=
 
Using [[Euler's formula]] to expand the cosine term in <math>w_0(x),</math> we can write''':'''
An equivalent expression is found from the formulation as a linear combination of modulated [[Rectangular_function|rectangular windows]]''':'''
 
:<math>w_0(x)= \tfrac{1}{L} \left(\tfrac{1}{2}\mathrmoperatorname{rect}(x/L)\quad +\stackreltfrac{\text1}{Fourier4} transform}}e^{i 2\longleftrightarrow}\quadpi x/L\cdot} \mathrmoperatorname{sincrect}(Lfx/L) =+ \fractfrac{\sin(1}{4}e^{-i 2\pi x/L f)}{\pi f\operatorname{rect}.(x/L)\right),</math>
 
An equivalent expressionwhich is found from the formulation as a linear combination of modulated [[Rectangular_function|rectangular windows]]''':'''
Using [[Euler's formula]] to expand the cosine term, we can write''':'''
 
:<math>w_0(x)= \tfrac{1}{2L} \mathrmoperatorname{rect}(x/L)\quad +\tfracstackrel{1}\text{4Fourier transform}} e^{i 2\pi x/Llongleftrightarrow}\quad \mathrmoperatorname{rectsinc}(x/LLf) +\triangleq \tfracfrac{1\sin(\pi L f)}{4}e^{-i 2\pi x/L} \mathrm{rectf}(x/L),.</math>
 
Transforming each term''':'''
whose [[Fourier transform]] is just''':'''
 
:<math>\begin{align}
:<math>W_0(f) = \tfrac{1}{2}\frac{\sin(\pi Lf)}{\pi f} + \tfrac{1}{4} \frac{\sin(\pi L(f-1/L))}{\pi (f-1/L)} + \tfrac{1}{4} \frac{\sin(\pi L(f+1/L))}{\pi (f+1/L)}.</math>
W_0(f) &= \tfrac{1}{2}\operatorname{sinc}(Lf) + \tfrac{1}{4} \operatorname{sinc}(L(f-1/L)) + \tfrac{1}{4} \operatorname{sinc}(L(f+1/L))\\
:<math>W_0(f) &= \tfrac{1}{2}\frac{\sin(\pi Lf)}{\pi fLf} + \tfrac{1}{4} \frac{\sin(\pi L(fLf-1/L))}{\pi (fLf-1/L)} + \tfrac{1}{4} \frac{\sin(\pi L(fLf+1/L))}{\pi (fLf+1/L)}.</math>\\
&= \frac{1}{2\pi}\left(
\frac{\sin(\pi Lf)}{Lf} -\tfrac{1}{2} \frac{\sin(\pi Lf)}{Lf-1} -\tfrac{1}{2} \frac{\sin(\pi Lf)}{Lf+1}\right)\\
&= \frac{\sin(\pi Lf)}{2\pi}\left(\frac{1}{Lf} +\tfrac{1}{2} \frac{1}{1-Lf} -\tfrac{1}{2} \frac{1}{1+Lf}\right)\\
&= \frac{\sin(\pi Lf)}{2\pi}\cdot \frac{1}{Lf (1-Lf) (1+Lf)} = \frac{1}{2}\frac{\operatorname{sinc}(Lf)}{(1 - L^2f^2)}.
\end{align}</math>
}}
 
== Discrete transforms ==
Line 58 ⟶ 65:
</math>
 
For even values of <math>N</math>, theThe truncated sequence <math>\{w[n],\ 0 \le n \le N-1\}</math> is a [[Window_functionSpectral_leakage#DFT-evensymmetry|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''':'''
 
:<math>\mathcal{F}\{w[n]\} = e^{-i \pi f (N-1)}\left[\tfrac{1}{2} \frac{\sin(\pi N f)}{\sin(\pi f)} + \tfrac{1}{4} e^{-i\pi/N} \frac{\sin(\pi N (f-\tfrac{1}{N}))}{\sin(\pi (f-\tfrac{1}{N}))} + \tfrac{1}{4} e^{i\pi/N} \frac{\sin(\pi N (f+\tfrac{1}{N}))}{\sin(\pi (f+\tfrac{1}{N}))}\right].</math>
 
An ''N''-length DFT of the window function samples the DTFT at frequencies <math>f = k/N,</math> for integer values of <math>k.</math> 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 [[Discrete Fourier transform#Convolution theorem duality|convolution]].<ref name=Carlin/>{{efn-la
|[[#Nuttall|Nuttall 1981]], p 85
}}{{efn-la
Line 70 ⟶ 77:
== Name ==
 
The function is named in honourhonor of von Hann, who used the three-term weighted average smoothing technique on meteorological data.<ref name=Hann/><ref name=Kahlig/> However, the erroneous<ref name=Harris/>term "''Hanning"'' function is also heardconventionally ofused,<ref on occasion,name=Harris/> derived from the paper in which it was named, where the term "''hanning a signal"'' was used to mean applying the Hann window to it.<ref name=Blackman/><ref name=Blackman2/> The confusion arose from the similar [[Hamming function]], named after [[Richard Hamming]].
 
==See also==
Line 88 ⟶ 95:
 
<ref name=Harris>
{{cite journal|ref=Harris|last=Harris|first=Fredric J.|date=Jan 1978|title=On the use of Windows for Harmonic Analysis with the Discrete Fourier Transform|url=http://web.mit.edu/xiphmont/Public/windows.pdf|journal=Proceedings of the IEEE|volume=66|issue=1|pages=51–83|citeseerx=10.1.1.649.9880|doi=10.1109/PROC.1978.10837|quote=The correct name of this window is “Hann'Hann.' The term “Hanning”'Hanning' is used in this report to reflect conventional usage. The derived term “Hann’d”'Hann'd' is also widely used.}}
</ref>
 
<ref name=Blackman>
{{Cite journal|last=Blackman|first=R. B.|author-link=R. B. Blackman|last2=Tukey|first2=J. W.|date=1958|title=The measurement of power spectra from the point of view of communications engineering — Part I|journal=The Bell System Technical Journal|volume=37|issue=1|pages=273|doi=10.1002/j.1538-7305.1958.tb03874.x|issn=0005-8580}}
</ref>
 
<ref name=Blackman2>
{{Cite book|url=https://archive.org/details/TheMeasurementOfPowerSpectra|title=The measurement of power spectra from the point of view of communications engineering|last=Blackman|first=R. B. (Ralph Beebe)|author-link=Ralph Beebe Blackman|last2=Tukey|first2=John W. (John Wilder)|date=1959|publisher=New York : Dover Publications|pages=[https://archive.org/details/TheMeasurementOfPowerSpectra/page/n58 98]|lccn=59-10185}}
</ref>
 
Line 108 ⟶ 115:
 
<ref name=Carlin>
{{cite patent
{{cite patent |ref=refCarlin |inventor-last =Carlin |inventor-first=Joe |inventor2-last=Collins |inventor2-first=Terry |inventor3-last=Hays |inventor3-first=Peter |inventor4-last=Hemmerdinger |inventor4-first=Barry |inventor5-last=Kellogg |inventor5-first=Robert |inventor6-last=Kettig |inventor6-first=Robert |inventor7-last=Lemmon |inventor7-first=Bradley |inventor8-last=Murdock |inventor8-first=Thomas |inventor9-last=Tamaru |inventor9-first=Robert |inventor10-last=Ware |inventor10-first=Stuart |date=1999 |issue-date=2005 |title=Wideband communication intercept and direction finding device using hyperchannelization |country-code=US |description=patent |patent-number=6898235}}
|ref=refCarlin
|title=Wideband communication intercept and direction finding device using hyperchannelization
|invent1=Carlin,Joe
|invent2=Collins,Terry
|invent3=Hays,Peter
|invent4=Hemmerdinger,Barry E. Kellogg,Robert L. Kettig,Robert L. Lemmon,Bradley K. Murdock,Thomas E. Tamaru,Robert S. Ware,Stuart M.
|pubdate=1999-12-10
|fdate=1999-12-10
|gdate=2005-05-24
|country=US
|status=patent
|number=6898235
}}, <!--template creates link to worldwide.espacenet.com-->
also available at https://patentimages.storage.googleapis.com/4d/39/2a/cec2ae6f33c1e7/US6898235.pdf
</ref>
 
<ref name=Hann>
{{Cite book |last=von Hann |first=Julius |url=https://archive.org/details/handbookclimato01wardgoog |page=[https://archive.org/details/handbookclimato01wardgoog/page/n219 199] |title=Handbook of Climatology |date=1903 |publisher=Macmillan |language=en |quote=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&nbsp;+&nbsp;(65&nbsp;+&nbsp;55)÷2].}}
</ref>
}}
Line 130 ⟶ 151:
| url =https://zenodo.org/record/1280930
}}
</li>
{{refend}}