Вы находитесь на странице: 1из 1

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’,
‘lowess’,’loess’,’rlowess’,
Add a New Variable ‘rloess’,’sgolay’
tt.newVar = zeros(height(tt),1);
Change Variable Names Detect Outliers
tt.properties.VariableNames = TF = isoutlier(A,method);
newNames;
Identify outliers with methods:
(Names must be valid MATLAB identifiers)
‘median’,’mean’,’quartiles’,
Tip: Use matlab.lang.makevalidname to
Create Timetables ‘grubbs’,’gesd’
create valid names from potentially invalid names.
tt = timetable(times, var1, var2,
... ,varN); Detect Change Points
Resample Data Using Retime
(All variables must have the same number TF = ischange(A,method);
of rows.) tt = retime(tt,newtimes,method);
Find abrupt changes with methods:
tt = table2timetable(t); method is used to fill gaps after retiming, and has
‘mean’,’variance’,’linear’
the same options as synchronize (see “Merge
(The first datetime or duration variable in “t”
Timetables”).
becomes the row times.)

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:
Fill Missing Values
Synchronizing often results in missing data points % Create a datastore that points to
tt = fillmissing(tt,method);
(times at which a variable was not measured). % 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
‘linear’,’spline’,’pchip’ % datastore
Fill: ‘fillwithmissing’,‘fillwithconstant’
t = tall(ds);
Interpolation: ‘linear’,’spline’,’pchip’
Remove Rows Containing Missing Values
% Convert to a timetable
Nearest Neighbor: ‘previous’,
‘next’,’nearest’ tt = rmmissing(tt); 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

Вам также может понравиться