difficulty interpreting outputs of movcorr

2 次查看(过去 30 天)
im using movcorr from the file exchange to calculate moving correlation between two time series.
I have 2 time series, interpolated onto the same dt, which contain 1534 datapoints. I have used movcorr to calculate a moving correlation with a 100 point window. When I do this, both r and p contain 1534 points, so surely the window is not being applied correctly as I expected an output of 1 correlation coefficient every 100 points?
I have tried to look at the documentation on the file exchange but I am having difficulty intepreting this output.
k = 100;
[r, p] = movcorr(data_1_interp,data_2_interp,k);

采纳的回答

Ronit
Ronit 2024-8-28
Hello CG,
The function movcorr calculates the correlation coefficient for each point in the time series using a sliding window of specified length (in your case, 100 points). This means that each point in the output arrays r and p represents the correlation coefficient calculated over a window centred at that point, hence why you get a result for each of the 1534 points.
If you expected an output of one correlation coefficient every 100 points, you might consider modifying your approach. Here a suggestion:
After computing r and p, you can take every 100th value to get a reduced set of correlation coefficients.
downsampled_r = r(1:100:end);
downsampled_p = p(1:100:end);
I hope it helps with your query!
  1 个评论
CG
CG 2024-8-28
Thank you for your response, that makes sense. I had assumed this function worked like movsum.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by