#### Matlab for Computing Minimum Zero-Padding Factors

The minimum zero-padding factors in the previous two subsections were
computed using the matlab function `zpfmin` listed in
§F.2.4. For example, both tables above are included in the
output of the following matlab program:

windows={'rect','hann','hamming','blackman'}; freqs=[1000,500,250,125,62.5]; for i=1:length(windows) w = sprintf("%s",windows(i)) for j=1:length(freqs) f = freqs(j); zpfmin(w,1/f,0.01*f) % 1 percent spec (large for audio) zpfmin(w,1/f,0.001*f) % 0.1 percent spec (good > 1 kHz) zpfmin(w,1/f,1) % 1 Hz spec (good below 1 kHz) end end

In addition to ``perceptually exact'' detection of spectral peaks,
there are times when we need to find spectral parameters as accurately
as possible, irrespective of perception. For example, one can
estimate the *stiffness* of a piano string by measuring the
stretched overtone-frequencies in the spectrum of that string's
vibration. Additionally, we may have *measurement noise*, in
which case we want our measurements to be minimally influenced by this
noise. The following sections discuss *optimal* estimation of
spectral-peak parameters due to sinusoids in the presence of noise.

**Next Section:**

Sinusoidal Amplitude Estimation

**Previous Section:**

Minimum Zero-Padding for Low-Frequency Peaks