d8098edAn interactive tutorial on the wave equation in acoustics: strings, drums and rooms, measured by earJeremy Magland 1function w = wv_window(n)
2% WV_WINDOW A smooth taper for spectral estimates: sin(pi t)^8 on n points.
3%
4% The eighth power is deliberate. Its sidelobes fall off like k^-9, so a
5% strong partial ten bins away leaks into a weak one at about 1e-9 of its
6% amplitude, which is what lets wv_peakfreq measure a frequency to nine or
7% ten digits from a few dozen periods. The price is a main lobe about five
8% bins wide, which only matters when two partials are closer than that.
9t = ((0:n-1)' + 0.5) / n;
10w = sin(pi * t) .^ 8;
11end