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);
0 个评论
采纳的回答
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!
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!