Interpolation of Time Series

2 views (last 30 days)
Lucas Arndt
Lucas Arndt on 14 Nov 2016
Answered: KSSV on 15 Nov 2016
Hello! I have two independent time series (say TS1 and TS2, each as 1-D data vectors with their own corresponding datetime vector), which cover the same time segment, although TS2 overlaps TS1 and intervals are not uniform (TS1 interval is just under 30 seconds, TS2 interval 1 hour). I want to have a uniform time vector (ideally the TS1 one) with corresponding interpolated values (I think spline interplolation would be best for tidal signals) for both time series.
So basically I want to interpolate the data of TS2 so it fits the datetime vector of TS1. Surplus data of TS2 is not important.
TS1:
element datetime value
1 '12-Nov-2010 00:00:29' 0,527889619162767
2 '12-Nov-2010 00:00:59' 0,529886048627037
3 '12-Nov-2010 00:01:29' 0,522882478095841
4 '12-Nov-2010 00:01:59' 0,523878907558089
5 '12-Nov-2010 00:02:29' 0,512875337023349
...
5665560 '01-Apr-2016 05:07:41' 0,264618965779846
5665561 '01-Apr-2016 05:08:11' 0,262618709425624
5665562 '01-Apr-2016 05:08:41' 0,257618453069881
5665563 '01-Apr-2016 05:09:11' 0,244618196716146
5665564 '01-Apr-2016 05:09:41' 0,232617940359887
TS2:
element datetime value
1 '01-Nov-2010 00:00:00' -0,356385967166036
2 '01-Nov-2010 01:00:00' -0,175427769398766
3 '01-Nov-2010 01:59:59' 0,0350333172584120
4 '01-Nov-2010 02:59:59' 0,230564356684479
5 '01-Nov-2010 03:59:59' 0,368901749042020
...
49996 '15-Jul-2016 02:59:59' -0,178737023073785
49997 '15-Jul-2016 03:59:59' -0,0235593698684266
49998 '15-Jul-2016 04:59:59' 0,108886338392307
49999 '15-Jul-2016 05:59:59' 0,193170801382286
50000 '15-Jul-2016 06:59:59' 0,218190681822731
I guess my problem is that there are no common time stamps, so I'm running out of approaches. What can I do? Thank you
Lucas

Answers (1)

KSSV
KSSV on 15 Nov 2016
First create a continuous time stamps. In these time stamps for certain number of dates you have data in TS1/TS2. Fill those time stamps with these values; and the rest of the time stamps are missing which you want to inteprolate.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!