Investigating correlation for unequal signal lengths

4 views (last 30 days)
Hello everybody
I have measurements from two tablet sensors. The first sensor measures the touch pressure applied to the tablet and the second sensor is the acceleration of the tablet (in z direction). The sensor data are stored in csv files where the first column contains the timestamp (in milliseconds) and the second column contains the sensor data (either touch pressure or acceleration). I have uploaded the two sensors files: https://1drv.ms/f/s!AlkQuYgB1McYgudFUrpMzMopUr2wVw
Now I would like to investigate if there exists a correlation between touch pressure and acceleration. I could just calculate the cross-correlation or plotting the pressure against the acceleration (and perhaps add a linear regression line).
The problem is that the acceleration measurements have a more or less constant sampling rate but for the pressure I have not a constant sampling rate. That means that the number of measurements for acceleration and pressure is also not the same (and the timestamps are therefore also not the same).
How can I still calculate the correlation and producing a accleration vs. pressure plot? I thought about a interpolation of the accleration measurements to the timestamps of the pressure readings but I don't know what type of interpolation to use (linear or cubic seems not to be right). Perhaps there is a better way of doing it.
Here are the plots of the two sensors:

Accepted Answer

Jeff Miller
Jeff Miller on 29 May 2018
It looks like you have a lot of readings, so you might be able to estimate the correlation pretty accurately even if you only use a subset of them. Specifically, just select out time points where you have readings from both sensors and correlate the two readings across that subset of the time points. You might allow small time differences (e.g., use two readings within the same 5 msec window) if that seems appropriate.
If you don't want to interpolate, I'm not sure what else you could do.
  2 Comments
Sepp
Sepp on 29 May 2018
Thanks for your idea, I think that makes sense. I will give it a try. Do you think interpolating of either the acceleration or the pressure makes sense and if yes what kind of interpolation would you use?
Jeff Miller
Jeff Miller on 30 May 2018
I don't know what kind of interpolation might be appropriate. That depends a lot on the data. To check the accuracy of different interpolation schemes, you could: omit some randomly selected points, try to recover them via some type of interpolation, and then see how well the recovered values match the omitted ones.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!