Cross correlation of several rows within a matrix

7 views (last 30 days)
Hola!
I have a matrix of 10 column, each column has measurements at different times. I have a second matrix also of 10 columns, each consisting of measurements at different times.
I want to carry out cross correlations of every combination within this matrix. Example, xcorr row 1 matrix 1 with row 1 of matrix 2, then row 1 of matrix 1 of row 2 of matrix 2 and so on. I would like correlations and time lag for each and every combination of columns.
I currently do this, but it means I have to do each row seperatly which is very time consuming.
[xc,lags] = xcorr(matrix1(:,1),matrix(:,2));
[~,I] = max(abs(xc));figure;
plot(lags,xc); legend(sprintf('Time delay %d',lags(I))); title('Column 1 matrix 1 xcorr with Column 2 matrix 2')
Gracias todos, Ben :)

Answers (0)

Community Treasure Hunt

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

Start Hunting!