Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# Detrend

Remove linear trend from vectors

Statistics

dspstat3

## Description

The Detrend block removes a linear trend from the length-M input vector, u, by subtracting the straight line that best fits the data in the least squares sense.

The least squares line, û = ax + b, is the line with parameters a and b that minimizes the quantity

$\sum _{i=1}^{M}{\left({u}_{i}-{\stackrel{^}{u}}_{i}\right)}^{2}$

for M evenly-spaced values of x, where ui is the ith element in the input vector. The output, y = u-û, is always an M-by-1 column vector.

## Supported Data Types

• Double-precision floating point

• Single-precision floating point

## See Also

 Cumulative Sum DSP System Toolbox Difference DSP System Toolbox Least Squares Polynomial Fit DSP System Toolbox Unwrap DSP System Toolbox detrend MATLAB

Watch now