Documentation Center

  • Trials
  • Product Updates

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

  • You cannot apply detrend totimeseries data with more than two dimensions.

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

Was this topic helpful?