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

2 Ansichten (letzte 30 Tage)
Dharmesh Joshi
Dharmesh Joshi am 20 Sep. 2022
Kommentiert: Dharmesh Joshi am 10 Okt. 2022
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 Kommentare
KSSV
KSSV am 22 Sep. 2022
To find the missing values, you can use either interp1 or fillmissing.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by