How can I calculate the rolling cross covariance of two vectors in MATLAB 7.8 (R2009a)?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 12 May 2011
Edited: MathWorks Support Team
on 18 Oct 2019
I would like to calculate the rolling cross covariance of two vectors:
where R_i is the running cross correlation of two signals centered with i-th time with the window length (-n, n).
Accepted Answer
MathWorks Support Team
on 18 Oct 2019
A function to compute the rolling cross covariance as defined in your equation is not available in MATLAB 7.8 (R2009a).
As a workaround you can consider two possible implementations:
1) Use a FOR loop and apply the MATLAB CORRCOEF function iteratively on your signals.
2) Build a function that implements the rolling cross covariance by using vectorized operations.
Both approaches are called in the attached scripts.m file. The second approach is implemented in the rollingCorr function.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!