View source: R/despike.R View source: R/RcppExports.R
instantaneous_correlation_rcpp | R Documentation |
Computes the instantaneous correlation between two signals using an exponential decay weighting function. This version uses Rcpp for improved performance.
instantaneous_correlation_rcpp(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 using Rcpp
rho <- instantaneous_correlation_rcpp(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.