I have two signals that I want to synchronize (find the time lag). I already did this using the "ccf" function and finding the maximum, following this post:
Finding lag at which cross correlation is maximum ccf( )
I though I'd have to do something like
fft1 <- fft(my.vector1)
fft2 <- fft(my.vector2)
ccf(fft1, fft2, lag.max = 6000, plot = FALSE)
However, for efficiency reasons, I would like to implement the cross-correlation with the fast fourier transform (FFT), as suggested in other posts. I have many tests with 300.000 samples (1.5 minutes sampled at 2000Hz), and a maximum lag of -3 to 3 seconds.
Any hints on how to do that in R?
I know the fft
and ccf
functions, but don't know how to integrate them.