function w = wv_window(n) % WV_WINDOW A smooth taper for spectral estimates: sin(pi t)^8 on n points. % % The eighth power is deliberate. Its sidelobes fall off like k^-9, so a % strong partial ten bins away leaks into a weak one at about 1e-9 of its % amplitude, which is what lets wv_peakfreq measure a frequency to nine or % ten digits from a few dozen periods. The price is a main lobe about five % bins wide, which only matters when two partials are closer than that. t = ((0:n-1)' + 0.5) / n; w = sin(pi * t) .^ 8; end