pub fn welch(
x: &[f64],
fs: f64,
window: &[f64],
overlap: usize,
detrend: Detrend,
scaling: SpectralScaling,
) -> Result<PowerSpectrum, ErrorsJSL>Expand description
Welch’s estimate of the one-sided spectrum of the real signal x sampled at fs: the signal
is cut into segments of window.len() samples overlapping by overlap samples, each is
detrended, windowed and transformed, and the squared magnitudes are averaged. Averaging
trades frequency resolution (fs / segment) for a variance reduced roughly by the number of
segments. With a single segment spanning the signal this is the (modified) periodogram.
Scaling follows SciPy: 1 / (fs Σw²) for density, 1 / (Σw)² for spectrum, with all bins
except DC (and Nyquist for even lengths) doubled to fold in the negative frequencies.