The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

preprocessing-time-series-data-tips-and-tricks

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by ravi.chowdhary, 2018-04-13 16:51:23

preprocessing-time-series-data-tips-and-tricks

preprocessing-time-series-data-tips-and-tricks

Preprocessing Time Series Data with MATLAB

This reference shows common use cases, but is by no means comprehensive.
The icon provides links to relevant sections of the MATLAB® documentation to learn more.

Timetable Timetable Manipulation Data Cleaning

MATLAB datatype designed to organize and work Access Data These return the same array: Smooth Data
with time series data. tt.Temperature B = smoothdata(A,method);
Components of a Timetable tt{:,’Temperature’} Smooth noisy data with methods:
tt{:,1} ‘movmean’,’movmedian’,’gaussian’,
Create Timetables ‘lowess’,’loess’,’rlowess’,
tt = timetable(times, var1, var2, Add a New Variable ‘rloess’,’sgolay’
tt.newVar = zeros(height(tt),1);
... ,varN); Change Variable Names Detect Outliers
(All variables must have the same number tt.properties.VariableNames = TF = isoutlier(A,method);
of rows.) Identify outliers with methods:
tt = table2timetable(t); newNames; ‘median’,’mean’,’quartiles’,
(The first datetime or duration variable in “t” (Names must be valid MATLAB identifiers) ‘grubbs’,’gesd’
becomes the row times.) Tip: Use matlab.lang.makevalidname to
create valid names from potentially invalid names. Detect Change Points
TF = ischange(A,method);
Resample Data Using Retime Find abrupt changes with methods:
tt = retime(tt,newtimes,method); ‘mean’,’variance’,’linear’
method is used to fill gaps after retiming, and has
the same options as synchronize (see “Merge
Timetables”).

Merge Timetables Missing Data Big Data

Synchronize multiple timetables Find Missing Values Tall arrays extend MATLAB functions to work on
to a common time vector. TF = ismissing(tt); data too big to load into memory.
tt = synchronize(tt1,tt2,...,ttN); Create a “tall” timetable:
Synchronizing often results in missing data points Fill Missing Values % Create a datastore that points to
(times at which a variable was not measured). tt = fillmissing(tt,method); % the data
synchronize supports several methods for adjust- Replace missing values with values calculated from ds = datastore(‘*.csv’);
ing data to fill in gaps: nearby points with methods:
‘previous’,’next’,’nearest’, % Create a tall table from the
Fill: ‘fillwithmissing’,‘fillwithconstant’ ‘linear’,’spline’,’pchip’ % datastore
Interpolation: ‘linear’,’spline’,’pchip’ t = tall(ds);
Remove Rows Containing Missing Values
Nearest Neighbor: ‘previous’, tt = rmmissing(tt); % Convert to a timetable
‘next’,’nearest’ tt = table2timetable(t);

Aggregation: ‘mean’,’min’,’max’,@func,...

© 2018 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of additional trademarks.
Other product or brand names may be trademarks or registered trademarks of their respective holders.

mathworks.com


Click to View FlipBook Version