Linear Interpolation hard task
10 ビュー (過去 30 日間)
古いコメントを表示
Ok so i will try to simplify my problem here and explain it. I have some sensor readings of power with corresponding time stamps. An example extract is shown below.
Timestamp Power
2021-04-01 15:07:19 0.0834
2021-04-01 15:08:02 0.0726
2021-04-01 15:08:42 0.0123
2021-04-01 15:09:24 0.0999
As you can see that the sensor data unfortunately has no fixed time interval between data readings.
My goal is to create a new table with a fixed time interval of one minute. In this table the Timestamp will go from 2021-04-01 00:00:00 till
2021-04-01 23:59:00 ( A total of 1440 readings for 24 hours). I have done this part already.
Now comes my question. How to i linearly interpolate the data above to match up with with my new time stamps? The challenge is also to automatically fill in the power readings with '0' on timestamps where no data was recorded.
What i mean to say is, the raw sensor data file dosent start its readings on 2021-04-01 00:00:00, but on a random time of the day,
like 2021-04-01 07:19:51. Thats why i want to automatically fill in power values with 0 when no data is recorded.
Calling out on all MATLAB heros out there to help me. Thanks alot in advance!
Note: I'll attach the real sensor file so you guys can get the feel of the problem.
2 件のコメント
回答 (1 件)
Akira Agata
2021 年 6 月 18 日
As @Walter Roberson -san suggested, timetable and retime is the best solution. Please try the following:
TT = readtimetable('_sd_OPV_OPV_1_dp_2021_04_01.csv',...
'VariableNamingRule','preserve');
TT2 = retime(TT,'minutely','linear');
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!