Skip to Main Content Skip to Search
Product Documentation

detrend - Class: timeseries

Subtract mean or best-fit line and all NaNs from timeseries object

Syntax

ts1 = detrend(ts, method)
ts1 = detrend(ts, method, index)

Description

ts1 = detrend(ts, method) subtracts either a mean or a best-fit line from time-series data, using the specified method. Usually for FFT processing.

ts1 = detrend(ts, method, index) uses the optional index to specify the columns or rows to detrend.

Tips

Input Arguments

ts

The timeseries object from which you want to subtract the mean or best-fit line and all NaNs.

method

A string that specifies one of the following detrend methods:

  • 'constant' — Subtracts the mean.

  • 'linear' — Subtracts the best-fit line.

index

An integer array that specifies the columns or rows to detrend when ts.IsTimeFirst is true.

Output Arguments

ts1

The timeseries object resulting from detrending the input timeseries object.

See Also

timeseries

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS