帮助中心帮助中心
从 timeseries 对象中减去均值或最佳拟合线
timeseries
tsout = detrend(tsin,method)
tsout = detrend(tsin,method,ind)
示例
tsout = detrend(tsin,method) 使用指定的 method 从 timeseries 中的二维数据中减去均值或最佳拟合线,还会删除所有 NaN 值。
tsin
method
NaN
tsout = detrend(tsin,method,ind) 指定要去除线性趋势的列或行的索引。ind 是一个整数向量,其中的整数表示列向数据的列索引(tsin.IsTimeFirst 为 true 时)或行向数据的行索引(tsin.IsTimeFirst 为 false 时)。
ind
tsin.IsTimeFirst
true
false
全部折叠
用二维数据创建一个 timeseries 对象,并从数据中减去每列的均值。
A = magic(3)
A = 3×3 8 1 6 3 5 7 4 9 2
tsin = timeseries(A,[1 2 3]); tsout = detrend(tsin,'constant'); tsout.Data
ans = 3×3 3 -4 1 -2 0 2 -1 4 -3
仅减去第二列和第三列数据的每列均值。
tscol = detrend(tsin,'constant',[2 3]); tscol.Data
ans = 3×3 8 -4 1 3 0 2 4 4 -3
包含二维数据的输入 timeseries,指定为标量。
数据类型: timeseries
'constant'
'linear'
去除线性趋势方法,指定为以下选项之一:
'constant' - 从数据中减去均值。
'linear' - 从数据中减去最佳拟合线。
行或列索引,指定为正整数数值标量或向量。ind 表示列向数据的列索引(tsin.IsTimeFirst 为 true 时)或行向数据的行索引(tsin.IsTimeFirst 为 false 时)。
数据类型: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
double
single
int8
int16
int32
int64
uint8
uint16
uint32
uint64
在 R2006a 之前推出
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office