MATLAB: Method to Correlate Time Series Arrays of Differing Lengths

geostatisticsresamplestatisticstime series

I am attempting to correlate the time series from 4 separate tilt monitors that sample every 5 minutes. The time series have slightly different base times and end times, and the resulting arrays are slightly different lengths, though they span almost the (differing by ~3 mins) same period of time. My goal is to correlate each of these time series with a single "wind speed" time series that also covers the same period of time as the tilt monitors, sampling every 5 minutes, but also has a slightly different array length and origin time and end time.
The different array lengths in the tilt measurements are due to instrument error. There are some times within each of the arrays where the instrument missed a measurement and so the sample interval is 10 minutes.
My arrays sizes look something like this:
Tilt_a = 6236x2
Tilt_b = 6310x3
Tilt_c = 6304x2
Tilt_d = 6309x2
wind_Speed = 6383x2
I imagine that I will need to re-sample the data using something like interp1, but I do not know how to renconcile the origin and end times. Is there a method that comes to mind for handling a situation such as this one? Or a function that allows correlating arrays of differing lengths?

Best Answer

One idea would be to:
  1. Start by finding a common time span in in all your data. Find the latest start time and the earliest finish time in all your 5 data sets. (I'm assuming the 1st column in each is the time.)
  2. Then define a regularly sampled time vector as something like
Ts = 5; % sample time
ti = [tstart: Ts: tfinish]; % interpolated time
  1. Now interpolate into each of the five data sets, all using ti
ta = Tilt_a(:,1); Ta = Tilt_a(:,2); % I assume this is the correct order.
Tilt_ai = interp1(ta, Ta, ti)
and so on.
Now all your data is aligned properly. But be careful, this involves interpolation based on some (un-said) assumptions.
Related Question