- Step 1: Import the data using “readtable” with a specified range. This avoids reading unnecessary rows and keeps things clean.
- Step 2: Convert the time column (which appears in HH.MM.SS format in the spreadsheet) to numeric using “str2double”, assuming it represents decimal hours. This conversion is necessary for arithmetic and interpolation.
- Step 3: Clean the data by removing any rows where time or temperature values could not be parsed and resulted in “NaN”.
- Step 4: Remove duplicate timestamps from the outdoor data. “interp1” requires strictly increasing time values, so repeated timestamps will cause an error otherwise.
- Step 5: Interpolate the outdoor temperature values to the indoor time points using “interp1”. This aligns the two datasets in time even if their sampling rates or times do not match.
- Step 6: Compute the rate of change of indoor temperature using diff and divide it by the difference in time between samples.
- Step 7: Apply the transformation you described, which combines rate of change, outdoor temperature, and indoor temperature.
- “readtable”: www.mathworks.com/help/matlab/ref/readtable.html
- “str2double”: www.mathworks.com/help/matlab/ref/str2double.html
- “interp1”: www.mathworks.com/help/matlab/ref/interp1.html
- “diff”: www.mathworks.com/help/matlab/ref/diff.html
