HyperMath

Detrend

Detrend

Previous topic Next topic No expanding text in this topic  

Detrend

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Removes the mean or linear trend from a data vector.

Syntax

y = Detrend(x, string)

Arguments

Name

Description

 

x

A data vector or matrix.  If a matrix, then Detrend is applied to each column vector.

 

String

(optional)

A string set to ‘constant’ if the mean is to be removed.  It is omitted if the linear trend is to be removed.

Outputs

Name

Description

 

y

A data vector or matrix with the same dimensions as x that contains the modified data.

Example

Remove the linear trend from the given data set.

 

Syntax

 

y = Detrend([5 5.33 6.02 7.07 8.48 10.25 12.38])

 

Result

 

y = 0.9 0 -0.54 -0.72 -0.54 0 0.9

Comments

The trend line is the least squares' best fit line.