I have two matrices, which represent acceleration readings of the same event from two seperate sensors, and I would like to calculate the correlation coefficients so that I may get a measure of how similar their responses are, and whether this improves or gets worse as various filtering/alignment processes are done.

I have done a lot of these calulcations and collected results, I have done this in two different ways. Firstly, using a for loop and comparing them column by column (axis by axis), producing three coefficients per pair of signals. And secondly, by simply comparing the entire matrix, producing one correlation coefficient per pair of signals. The issue I am finding is that the two methods produce such wildly varying numbers that it makes me question my sanity, with the individual axes being in the range of 0.6-0.1 and the overall matrix coefficients being in the range of 0.95+.

I found documentation on the mathworks website that states

"The MATLAB® function corrcoef, unlike the corr function, converts the input matrices X and Y into column vectors, X(:) and Y(:), before computing the correlation between them. Therefore, the introduction of correlation between column two of matrix X and column four of matrix Y no longer exists, because those two columns are in different sections of the converted column vectors. The value of the off-diagonal elements of r, which represents the correlation coefficient between X and Y, is low. This value indicates little to no correlation between X and Y. Likewise, the value of the off-diagonal elements of p, which represents the p-value, is much higher than the significance level of 0.05. This value indicates that not enough evidence exists to reject the hypothesis of no correlation between X and Y."

I was just wondering if these numbers make sense? and which, in your opinion, would be the best for comparing the signals?

Thank you in advance

  • $\begingroup$ Welcome to SE.SP! Can you show us the matlab commands you are using, and the sizes of the matrices you are passing in? $\endgroup$
    – Peter K.
    Feb 6 '19 at 13:20
  • $\begingroup$ @PeterK. Hi! and thanks! I am using the corrcoef function, and my matrices are 3x(3552 - 4527) there are 5 different pairs of signals $\endgroup$ Feb 6 '19 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.