I have several time series, i.e. I have measured a couple of signals over 15min. Each signal is sampled several times each second but the timestamps of the different signals are not equal. Let's say we start at time 0s. For example, signal one has the following (timestamp, values):
0.1s: 954
0.2s: 1000
0.24s: 1090
0.3s: 855
0.45s: 600
...
Signal two has the following (timestamp, values):
0.05s: 900
0.13s: 960
0.2s: 1000
0.29s: 850
0.33s 800
...
How can I now calculate the correlation of the values of these time series in e.g. python or Matlab? If the values would be always at the same timestamps I could calculate just the correlation between the individual values but unfortunately the values are not at the same timestamps.
Let's say you have a signal with values in an array s1 at time points t1, and a signal s2 evaluate at time points t2. With NumPy in Python:
t. You can pick t1 or t2, or compute a linear space in the considered time range with np.linspace. In any case, I'd make sure that the minimum and maximum values of t are in the range of both t1 and t2 to avoid extrapolations.s1interp and s2interp. This can be done with np.interp, which computes linear interpolations. If you need more sophisticated interpolation methods, you can take a look at SciPy's interp1d.s1interp and s2interp. This is done with np.corrcoef.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With