Does detrend function remove the mean of the signal?

25 次查看(过去 30 天)
I would like to know if the detrend function (https://fr.mathworks.com/help/ident/ref/iddata.detrend.html) removes also the mean of the signal (demeaning/centering) of the input signal.

回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2021-11-8
If you read the help of detrend you will find:
DETREND Remove a linear trend from a vector, usually for FFT processing.
[Y,trend] = DETREND(X) removes the best straight-line fit linear trend from
the data in vector X and returns the residual in vector Y. If X is a
matrix, DETREND removes the trend from each column of the matrix.
[Y,trend] = DETREND(X,'constant') removes just the mean value from the vector X,
or the mean value from each column, if X is a matrix.
[Y,trend] = DETREND(X,'linear',BP) removes a continuous, piecewise linear trend.
Breakpoint indices for the linear trend are contained in the vector BP.
The default is no breakpoints, such that one single straight line is
removed from each column of X.
Class support for inputs X,BP:
float: double, single
Modified to also output the trend - so that it can be re-inserted
later. BG
See also MEAN
Other functions named detrend
gpuArray/detrend timeseries/detrend
HTH
  2 个评论
Steven Lord
Steven Lord 2021-11-8
This is the help for the MATLAB detrend function. The link in the original question is for the detrend method of iddata objects, and if we look at it the second item in the Description section states:
"data_d = detrend(data) computes and subtracts the mean value from each time-domain signal in data. The iddata objects data_d and data each contain input and output data originating from SISO, MIMO, or multiexperiment datasets."
I haven't used iddata objects before but from reading the third item in that Description section it appears you can ask detrend for those objects to remove different types of trends.
serafeim loukas
serafeim loukas 2021-11-8
Thanks. Indeed, after running the example (using default input parameters), I can see that the mean is indeed removed.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Preprocess Data 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by