difficulty interpreting outputs of movcorr

4 visualizaciones (últimos 30 días)
CG
CG el 28 de Ag. de 2024
Comentada: CG el 28 de Ag. de 2024
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);

Respuesta aceptada

Ronit
Ronit el 28 de Ag. de 2024
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 comentario
CG
CG el 28 de Ag. de 2024
Thank you for your response, that makes sense. I had assumed this function worked like movsum.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by