Help interpolating irregular time series to regular time series
3 views (last 30 days)
Show older comments
Hello,
I have irregular time series data: (time, X-acceleration, Y-acceleration, Z-acceleration)
19:24:26.850, -0.11492168, 0.038307227, 9.634268
19:24:26.859, -0.12449849, 0.038307227, 9.662998
19:24:26.872, -0.1340753, 0.05746084, 9.672575
19:24:26.884, -0.12449849, 0.02873042, 9.615114
19:24:26.889, -0.15322891, 0.047884032, 9.643845
19:24:26.902, -0.10534488, 0.06703765, 9.662998
19:24:26.909, -0.076614454, 0.076614454, 9.624691
19:24:26.921, -0.095768064, 0.05746084, 9.653421
19:24:26.935, -0.05746084, 0.095768064, 9.624691
19:24:26.939, -0.06703765, 0.05746084, 9.672575
etc.
How can I interpolate/resample(?) the data so that I can get accelerations every 0.010 seconds? I can add the date to the time string with no problems, I'll even have too soon. Thank you very much!
Oleg
2 Comments
Jan
on 9 Jun 2014
Please explain the format of your data. Is "19:24:26.850" a string? Is this a cell array? When you post the data in a valid Matlab syntax, creating an meaningful answer is easier.
Accepted Answer
Chad Greene
on 9 Jun 2014
Letting t be column 1 and x be column 2, interpolate values xi corresponding to ti:
ti = yourStartingTime + 0:.010:3; % this represents 3 seconds at 0.010 second intervals.
xi = interp1(t,x,ti);
1 Comment
Chad Greene
on 9 Jun 2014
If your time series is acceleration, spline interpolation may be more appropriate than the default linear.
xi = interp1(t,x,ti,'spline');
More Answers (1)
See Also
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!