If x is a vector, detrend (x, p) removes the
best fit of a polynomial of order p from the data x.
If x is a matrix, detrend (x, p) does the same
for each column in x.
The second argument p is optional. If it is not specified, a value of 1 is assumed. This corresponds to removing a linear trend.
The order of the polynomial can also be given as a string, in which case
p must be either "constant" (corresponds to p=0)
or "linear" (corresponds to p=1).
See also: polyfit.
Package: octave