| System Identification Toolbox™ | ![]() |
zd = detrend(z)
zd = detrend(z,o,brkp)
Name of iddata object in the MATLAB workspace containing time-domain, frequency-domain, or time-series data.
Note For frequency-domain data, you can only remove a zeroth-order trend. |
Order of the trend, specified as one of the following values:
0: (Default) Specifies to subtract a mean value (zeroth-order trend) from each signal.
1: Specifies to subtract a linear trend (first-order trend) from each signal after performing a least-squares fit on the data.
Data sample index that defines the discontinuities between successive linear trends, specified as one of the following types of values:
Scalar: Specifies one discontinuity.
Vector: Specifies several discontinuities, indicating to subtract multiple linear trends.
zd = detrend(z) subtracts the mean value (zeroth-order trend) from each signal in z and returns an iddata object zd. If z is frequency-domain data, the response at frequency 0 is zero.
zd = detrend(z,o,brkp) subtracts the mean value (o = 0) or linear trend (o = 1). You can subtract piecewise linear trends by specifying one or more breakpoints brkp, where a breakpoint is a data sample index (time value) that defines the discontinuities between successive linear trends. When brkp contains breakpoints that match the time vector, detrend subtracts a continuous piecewise linear trend.
Note detrend for iddata objects differs from detrend in the Signal Processing Toolbox™ product. |
In this example, you subtract several linear trends that connect at three breakpoints [30 60 90], which correspond to the data sample indexes data where breakpoints occur.
data = detrend(data,1,[30 60 90]);
In this example, you subtract a mean value from the input signal and a V-shaped trend from the output signal, such that the V peak occurs at the breakpoint value of 119.
zd1 = z(:,:,[]); zd2 = z(:,[],:); zd1(:,1,[]) = detrend(z(:,1,[]),1,119); zd2(:,[],1) = detrend(z(:,[],1)); zd = [zd1,zd2];
| Subtracting Trends from Signals (Detrending) |
![]() | delayest | diff | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |