instantaneous_correlation | R Documentation |
Computes the instantaneous correlation between two signals using an exponential decay weighting function, allowing for efficient recursive computation.
instantaneous_correlation(x, y, eta, offset = 0)
x |
Numeric vector. First time-series signal. |
y |
Numeric vector. Second time-series signal. |
eta |
Positive numeric value. Decay parameter for the exponential weighting function. |
offset |
Integer. Temporal offset between the two signals. Defaults to 0. |
Numeric vector of instantaneous correlation coefficients.
# Example signals
x <- sin(seq(0, 2 * pi, length.out = 100))
y <- cos(seq(0, 2 * pi, length.out = 100))
# Compute instantaneous correlation
rho <- instantaneous_correlation(x, y, eta = 0.1)
# Plot the result
plot(rho, type = 'l', ylab = 'Instantaneous Correlation', xlab = 'Time')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.