Signal Processing Toolbox Help Desk

detrend

Purpose

Remove linear trends.

Syntax

Description

detrend removes the mean value or linear trend from a vector or matrix, usually for FFT processing.

y = detrend(x) removes the best straight-line fit from vector x and returns it in y. If x is an array, detrend removes the trend from each column.

y = detrend(x,0) removes the mean value from vector x or, if x is an array, from each column of the array.

Algorithm

detrend computes the least-squares fit of a straight line to the data and subtracts the resulting function from the data. The main part of the algorithm is

To obtain the equation of the straight-line fit, use polyfit.

See Also

polyfit

Polynomial curve fitting (see MATLAB Function Reference).



[ Previous | Help Desk | Next ]