detrend
Remove polynomial trend
Syntax
Description
y = detrend(
removes the
best straight-fit line from the data in x
)x
.
If
x
is a vector, thendetrend
subtracts the trend from the elements ofx
.If
x
is a matrix, thendetrend
operates on each column separately, subtracting each trend from the corresponding column ofx
.
y = detrend(___,
specifies
how nanflag
)NaN
values are treated for any of the previous syntaxes. For example,
detrend(x,'omitnan')
removes NaN
values before
calculating the trend, while detrend(x,'includenan')
includes them
(default).
y = detrend(___,
specifies additional parameters 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.