Time align data-sets and get the missing values with interpolation

Hello! Everyone,
I have two datasets which are logged at different rates. I am trying to time align these two data sets and after the data is time aligned i want to interpolate the and get the missing data values. I used a concept of timetables for time alignment but its taking forever to align that way. Can any one please suggest me how can i time align data and then fill up rest of missing data with the help of interpolation.
Thanks

 採用された回答

KSSV
KSSV 2018 年 5 月 22 日

0 投票

You can do interpolation to get both the data sets to same time stamps. Read about interp1. After you get both the data's into same time, again you can use interp1 to get missing data. Or if you are using MATLAB 2016b or higher you can have a look on fillmissing to get the missing data.

3 件のコメント

sc1991
sc1991 2018 年 5 月 22 日
編集済み: sc1991 2018 年 5 月 22 日
Hi! KSSV thanks for the answer but how to i interpolate to get the datasets to same time stamp. I mean wat i have been doing is lets say. I have dataset A and frequency is 1hz and then i have data set B frequency is 200ms.
So wat i do is i convert them to timetable Anew=timetable(1hz,A) and Bnew =timetable(200ms,B); then i use synchronize function newdata=synchronize(Anew,Bnew,'union');
Now this gives me a table with all the data from A and B and places with Nan where it could not find any data. I am guessing that fro these nans we can interpolate and fill teh data. but I am not too sure bout how that works. Please correct me if i am not doing any thing correct. This is my very first attempt and time aligning a data set and getting all the data points values with interpolation.
Also i would like to add after looking at the combined data after using the synchronize function. it looks like at some points we have to interpolate and at some we have to extrapolate. So please suggest me wat i can do here. Can the fillmissing function cover that aspect as well.
Matthew Hanks
Matthew Hanks 2018 年 8 月 20 日
When you use the synchronize function, try instead using this: newdata=synchronize(Anew,Bnew,'Uniform','Interval',0.001);
Peter Perkins
Peter Perkins 2018 年 8 月 24 日
Matthew, I think you're looking at the timeSERIES synchronize method. sc1991 is using the timeTABLE method (I think).
sc1991, take a look at the documentation for synchronize, in particular, the METHOD. I imagine you want something like 'linear' or 'spline'. The default is 'fillwithmissing', which is where all those NaNs are coming from.
I imagine you probably also want to align one timetable to the other, not align them both to the union of times. Take a look at the NewTimeBasis input.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

質問済み:

2018 年 5 月 22 日

コメント済み:

2018 年 8 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by