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 is optional. If it is not specified, a value of 1 is assumed. This corresponds to removing a linear trend.