I have two vectors of matching lengths. They are readings from two different sensors (one is from a smartphone and the other is from a wiimote) of the same hand movement. I am tryin开发者_运维知识库g to find the time offset between them to synchronise the readings for further processing. The readings I get are of the format (Time(ms) Value) for accelerations in the X,Y and Z direction.
For the synchronization, I plotted the cross-correlation function xcorr2()
between the two sets. I am getting the same graph (a weird triangle peak and a straight line at the bottom) for Accelerations along the x, y and z directions (which I guess is good) but I don't know how to interpret it. What do the axes in the graph represent?
Can anyone explain to me what xcorr2()
means in a qualitative sense. From the correlation function, how do I determine the offset (i.e. how many seconds is sensor1 behind sensor2)?
I concur with the comment made above by Predictor. To align the time series against each-other, I would pick xcorr()
without the 2. Consider correlating only the acceleration magnitudes. For example:
a_mag_wii = sqrt(a_x_wii.^2 + a_y_wii.^2 + a_z_wii.^2); a_mag_phone = sqrt(a_x_phone.^2 + a_y_phone.^2 + a_z_phone.^2); res = xcorr(a_mag_wiimote, a_mag_smartphone);
精彩评论