tsout = detrend(tsin,method)subtracts either a mean or a best-fit line from 2-D data in atimeseriesusing the specifiedmethod, and also removes allNaNvalues.
tsout = detrend(tsin,method,ind)specifies the indices of the columns or rows to detrend.indis a vector of integers representing column indices for column-oriented data (tsin.IsTimeFirstistrue) and representing row indices for row-oriented data (tsin.IsTimeFirstisfalse).
Inputtimeseriescontaining 2-D data, specified as a scalar.
Data Types:timeseries
method—Detrend method 'constant'|'linear'
Detrend method, specified as one of the following options:
'constant'— Subtract the mean from the data.
'linear'— Subtract the best-fit line from the data.
ind—Row or column indices scalar|vector
Row or column indices, specified as a positive integer numeric scalar or vector.indrepresents column indices for column-oriented data (tsin.IsTimeFirstistrue) and represents row indices for row-oriented data (tsin.IsTimeFirstisfalse).
Data Types:double|single|int8|int16|int32|int64|uint8|uint16|uint32|uint64
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.