Skip to main content

interpolate

Function interpolate 

Source
pub fn interpolate(magnitudes: &[f64], bin: usize, span: usize) -> Option<Peak>
Expand description

Interpolates the local maximum at bin k of a magnitude spectrum.

With a, b, c = ln|X[k-1]|, ln|X[k]|, ln|X[k+1]| the parabola’s top sits at delta = 0.5 (a - c) / (a - 2b + c). Returns None when k has no neighbour on both sides, is not a strict local maximum, or a magnitude in the three bins is zero. span bins on each side are searched for a neighbouring peak.