How to Calculate Cross Correlation Using Accelerometer Data
Hi, I am trying to calculate the cross-correlation between two accelerometer signals. The idea is to measure how synchronized the movments were between two people each wearing an accelerometer. The signals are the same length of time and the people were attempting to perform identical actions. I’m currently focusing on the y-axis.
I tried using corrcoeff() for this that outputs a pearson correlation coefficient value (~0.4) but I’m not sure I’ve really done this correctly. From what I understand, corrcoeff() subtracts the mean from a and b, but I don’t know why. What is corrcoeff() actually giving me in this scenario?
a = p01_acceleration_y
b = p02_acceleration_y
corrcoef(a, b)
Using xcorr() instead, I get a bunch of numbers that make a graph in the shape of a triangle. Using max(), I can find that at a lag of 1 the value is the highest and it’s a much higher number than before (~0.9). Is this saying that the two people are a lot more synchronized than I thought initially? And that one is lagging behind the other?
[c, lags] = xcorr(a, b, ‘coeff’)
max(c)
Is xcorr() giving me the average correlation across the entire time series? Is there another way to do this that gets a better measure of synchrony, like showing certain time windows in which the correlation is the highest?
Am I supposed to use corrcoef() or xcorr() here? Do I need to normalize the data? Should I not be using ‘coeff’?
Should I translate my accerlation data into velocity or displacement first using convertVibration()?
Sorry for all the questions, I think I’m not fully grasping the concept of a cross-correlation. Thanks in advance!Hi, I am trying to calculate the cross-correlation between two accelerometer signals. The idea is to measure how synchronized the movments were between two people each wearing an accelerometer. The signals are the same length of time and the people were attempting to perform identical actions. I’m currently focusing on the y-axis.
I tried using corrcoeff() for this that outputs a pearson correlation coefficient value (~0.4) but I’m not sure I’ve really done this correctly. From what I understand, corrcoeff() subtracts the mean from a and b, but I don’t know why. What is corrcoeff() actually giving me in this scenario?
a = p01_acceleration_y
b = p02_acceleration_y
corrcoef(a, b)
Using xcorr() instead, I get a bunch of numbers that make a graph in the shape of a triangle. Using max(), I can find that at a lag of 1 the value is the highest and it’s a much higher number than before (~0.9). Is this saying that the two people are a lot more synchronized than I thought initially? And that one is lagging behind the other?
[c, lags] = xcorr(a, b, ‘coeff’)
max(c)
Is xcorr() giving me the average correlation across the entire time series? Is there another way to do this that gets a better measure of synchrony, like showing certain time windows in which the correlation is the highest?
Am I supposed to use corrcoef() or xcorr() here? Do I need to normalize the data? Should I not be using ‘coeff’?
Should I translate my accerlation data into velocity or displacement first using convertVibration()?
Sorry for all the questions, I think I’m not fully grasping the concept of a cross-correlation. Thanks in advance! Hi, I am trying to calculate the cross-correlation between two accelerometer signals. The idea is to measure how synchronized the movments were between two people each wearing an accelerometer. The signals are the same length of time and the people were attempting to perform identical actions. I’m currently focusing on the y-axis.
I tried using corrcoeff() for this that outputs a pearson correlation coefficient value (~0.4) but I’m not sure I’ve really done this correctly. From what I understand, corrcoeff() subtracts the mean from a and b, but I don’t know why. What is corrcoeff() actually giving me in this scenario?
a = p01_acceleration_y
b = p02_acceleration_y
corrcoef(a, b)
Using xcorr() instead, I get a bunch of numbers that make a graph in the shape of a triangle. Using max(), I can find that at a lag of 1 the value is the highest and it’s a much higher number than before (~0.9). Is this saying that the two people are a lot more synchronized than I thought initially? And that one is lagging behind the other?
[c, lags] = xcorr(a, b, ‘coeff’)
max(c)
Is xcorr() giving me the average correlation across the entire time series? Is there another way to do this that gets a better measure of synchrony, like showing certain time windows in which the correlation is the highest?
Am I supposed to use corrcoef() or xcorr() here? Do I need to normalize the data? Should I not be using ‘coeff’?
Should I translate my accerlation data into velocity or displacement first using convertVibration()?
Sorry for all the questions, I think I’m not fully grasping the concept of a cross-correlation. Thanks in advance! cross-correlation, correlation, xcorr, corrcoef, accelerometer, acceleration MATLAB Answers — New Questions