difficulty interpreting outputs of movcorr

조회 수: 3 (최근 30일)
CG
CG 2024년 8월 28일
댓글: CG 2024년 8월 28일
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