Remove polynomial trend

`y = detrend(x)`

`y = detrend(x,n)`

`y = detrend(x,n,bp)`

`y = detrend(___,Name,Value)`

`y = detrend(`

removes the
best straight-fit line from the data in `x`

)`x`

.

If

`x`

is a vector, then`detrend`

subtracts the trend from the elements of`x`

.If

`x`

is a matrix, then`detrend`

operates on each column separately, subtracting each trend from the corresponding column.

`y = detrend(___,`

specifies additional parameters for any of the previous syntaxes using one or more
name-value pairs. For example, `Name,Value`

)`detrend(x,1,bp,'Continuous','false')`

specifies that the fitted trend can have discontinuities.