fitlm, how to use two datasets with identical size and timestamps
4 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!