fitlm, how to use two datasets with identical size and timestamps

1 回表示 (過去 30 日間)
Dharmesh Joshi
Dharmesh Joshi 2022 年 9 月 20 日
コメント済み: Dharmesh Joshi 2022 年 10 月 10 日
Hi
I have two data sets. Each dataset has the sensor values and a timestamp.
I would like to use fitlm to determin a linear function between both these sets of data, but the data used in this function should only be data that has timestamp in both two data sets, to that when data is being compared it at the same timestamp.
The issue is that a certain periods the dataset might have some data samples missing a certain time stamps.
This is my current code.
ref_timetable_time=[ref_data_timestamp]';
ref_timetable_ug=[ref_data_sensordata]';
ref_timetable = timetable(ref_timetable_time,ref_timetable_ug);
timerperiod_Ref=ref_timetable(timerperiod,:);
timetable_time=[live_t]';
timetable_ug=[no2_ppb];
timetable_ug = timetable(timetable_time,timetable_ug);
timerperiod_ug=timetable_ug(timerperiod,:);
hourlyaveraged_no2_data = retime(timerperiod_ug,'hourly','mean');
%model sensor data to ref data
inModels{k} = fitlm( timerperiod_Ref.ref_timetable_ug, hourlyaveraged_no2_data.timetable_ug, "linear", "VarNames", ["Ref Data", "SensorValue"] );
What can be done so that dataset are equal in both size and timestamps?
Thank You
  9 件のコメント
KSSV
KSSV 2022 年 9 月 22 日
To find the missing values, you can use either interp1 or fillmissing.
Dharmesh Joshi
Dharmesh Joshi 2022 年 10 月 10 日
Thanks

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

回答 (0 件)

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by