Main Content

detrend

去除多项式趋势

Description

例子

y = deatrend(X从数据中删除最佳的直接拟合线X

  • 如果Xis a vector, thendetrend减去趋势中的趋势X

  • 如果Xis a matrix, thendetrendoperates on each column separately, subtracting each trend from the corresponding column.

例子

y = deatrend(X,,,,n删除nth-degree polynomial trend. For example, whenn = 0,,,,detrend删除mean value fromX。什么时候n = 1,,,,detrend去除线性趋势,等效于先前的语法。什么时候n = 2,,,,detrend删除quadratic trend.

例子

y = deatrend(X,,,,n,,,,bpremoves a continuous, piecewise trend with segments defined by the break pointsbp

y = deatrend(___,,,,nanflag指定如何values are treated for any of the previous syntaxes. For example,逐渐消退(x,'omitnan')removes计算趋势之前的值detrend(x,'includenan')includes them (default).

例子

y = deatrend(___,,,,名称,价值使用一个或多个名称值对指定其他参数。例如,detrend(x,1,bp,'Continuous',false)指定合适的趋势可能存在不连续性。

Examples

collapse all

Create a vector of data, and remove the continuous linear trend. Plot the original data, the detrended data, and the linear trend.

t = 0:20;x = 3*sin(t) + t;y = detrend(x);情节(t,x,t,y,t,x-y,':k') 传奇('输入数据',,,,“破坏数据”,,,,'Trend',,,,'Location',,,,'西北'

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent Input Data, Detrended Data, Trend.

Create a vector of data, and remove the continuous quadratic trend. Plot the original data, the detrended data, and the trend.

t = 0:20;X= 20*sin(t) + t.^2; y = detrend(x,2); plot(t,x,t,y,t,x-y,':k') 传奇('输入数据',,,,“破坏数据”,,,,'Trend',,,,'Location',,,,'西北'

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent Input Data, Detrended Data, Trend.

创建一个数据向量,并使用0的断路点删除分段线性趋势。指定所得的输出可能是不连续的。绘制原始数据,破坏数据和趋势。

t = -10:10;x = t。^3 + 6*t。^2 + 4*t + 3;bp = 0;y = denrend(x,1,bp,“样本点”,,,,t,'Continuous',错误的);情节(t,x,t,y,t,x-y,':k') 传奇('输入数据',,,,“破坏数据”,,,,'Trend',,,,'Location',,,,'西北'

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent Input Data, Detrended Data, Trend.

输入参数

collapse all

输入阵列,指定为向量,矩阵或多维数组。什么时候Xis a multidimensional array,detrend在所有维度上操作列。

数据类型:double|单身的
复杂的数字支持:金宝app是的

多项式程度,指定为非负整数标量或'持续的'(相当于0)or“线性”(相当于1)。

突破点to define piecewise segments of the data, specified as a vector containing one of the following:

  • 样品点值表示断裂点的位置。样品点值包含在默认样品点向量中[1 2 3 ...]or in the vector specified by the“样本点”范围。

  • Logical values where logical 1 (true)表示输入数据的相应元素中的断点。如果bp包含逻辑值,必须与样品点相同。

当您想为数据的不同段计算单独的趋势时,断点很有用。

数据类型:double|单身的|datetime|期间|逻辑

条件,指定为下列值之一s:

  • 'includeenan'- 包括计算趋势时输入数据中的值。

  • 'omitnan'-Ignore all计算趋势时输入中的值。

名称值参数

指定可选的逗号分隔对名称,价值arguments.姓名是参数名称和Valueis the corresponding value.姓名must appear inside quotes. You can specify several name and value pair arguments in any order as姓名1,,,,Value1,...,NameN,ValueN

Example:y = detrend(x,'samplepoints',1:10:1000)

连续性约束,指定为逗号分隔对'Continuous'以及以下一个:

  • true- 合适的趋势必须到处都是连续的。

  • 错误的- 合适的趋势可能包含不连续性。

样品点,指定为逗号分隔对,由“样本点”和矢量。样本点表示输入数据的位置X- 轴,它们必须是独特的和分类的。

数据类型:double|单身的|datetime|期间

扩展功能

也可以看看

|

Introduced before R2006a