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

2 visualizaciones (últimos 30 días)
Dharmesh Joshi
Dharmesh Joshi el 20 de Sept. de 2022
Comentada: Dharmesh Joshi el 10 de Oct. de 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 comentarios
KSSV
KSSV el 22 de Sept. de 2022
To find the missing values, you can use either interp1 or fillmissing.

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by