Skip to contents

Hamming-windowed averaged CSD (rmorie native FFT loop, module 20).

Usage

morie_dsp_csd(x, y, fs = 1, nperseg = 256L)

Arguments

x

Numeric vector.

y

Numeric vector.

fs

Sampling frequency (Hz). Default 1.

nperseg

Segment length. Default 256.

Value

List with freqs (Hz) and csd (complex).

References

Rangayyan & Krishnan (2015), Ch. 4 & Ch. 6.

Examples

set.seed(1)
t <- seq(0, 4, by = 1 / 128)
x <- sin(2 * pi * 5 * t) + rnorm(length(t), 0, 0.2)
y <- sin(2 * pi * 5 * t + 0.5) + rnorm(length(t), 0, 0.2)
str(morie_dsp_csd(x, y, fs = 128, nperseg = 128L), max.level = 1)
#> List of 2
#>  $ freqs: num [1:65] 0 1 2 3 4 5 6 7 8 9 ...
#>  $ csd  : cplx [1:65] 6.60e-05+0.00i 8.18e-05+7.12e-05i 7.08e-05+1.20e-04i ...