Native Welch-style estimator built from windowed segment FFTs (module 20).
Examples
set.seed(23)
fs <- 512L
t <- seq.int(0, fs - 1L) / fs
x <- sin(2 * pi * 50 * t) + rnorm(fs, sd = 0.2)
y <- x + rnorm(fs, sd = 0.2)
out <- morie_dsp_coherence(x, y, fs = fs, nperseg = 128L)
str(out, max.level = 1)
#> List of 2
#> $ freqs: num [1:65] 0 4 8 12 16 20 24 28 32 36 ...
#> $ coh : num [1:65] 0.414 0.303 0.428 0.653 0.383 ...
