主要内容

getTrend

Create trend information object to store offset, mean, and trend information for time-domain signals stored iniddataobject

Description

example

t= getTrend(数据)构造trendInfoobject to store offset, mean, or linear trend information for detrending or retrending data. You can assign specific offset and slope values tot。然后,您可以将趋势信息应用于tto either数据或其他iddata通过使用对象逐渐消退或者retrend

example

t= getTrend(数据,0)计算输入和输出信号的手段,并将其存储为输入输出offset属性t, respectively.

example

t= getTrend(数据,1)计算输入和输出信号的最佳拟合直线,并将其存储为t。这following code represents the straight line:

uline = tr.inputoffset +(time-t0)*tr.inputslope yline = tr.outputoffset +(time-t0)*tr.outputslope
Here,timeis equal toZ.SamplingInstantst0is equal to数据。tstart

Examples

collapse all

从输入和输出信号中删除指定的偏移。

Load SISO data containing vectorsu2y2

loaddryer2

Create a data object with a sample time of 0.08 seconds and plot it.

数据= iddata(y2,u2,0.08); plot(data)

图包含2个轴对象。带标题Y1的轴对象1包含一个类型行的对象。此对象表示数据。带有标题U1的Axes Object 2包含类型行的对象。此对象表示数据。

这数据has a nonzero mean value.

商店the data offset and trend information in atrendInfo目的。

t = getTrend(数据);

Assign offset values to thetrendInfo目的。

t.inputoffset = 5;t.Outputoffset = 5;

Subtract the offsets from the data.

数据_d = detrend(data,T);

在同一地块上绘制刻痕数据。

hold图(data_d)

图包含2个轴对象。Axes object 1 with title y1 contains 2 objects of type line. These objects represent data, data\_d. Axes object 2 with title u1 contains 2 objects of type line. These objects represent data, data\_d.

查看从数据中删除的平均值。

get(T)
ans =struct with fields:dataName:'data'inpoffset:5 outputoffset:5 Inputslope:0 Outputslope:0

Compute input-output signal means, store them, and detrend the data.

Load SISO data containing vectorsu2y2

loaddryer2

Create a data object with a sample time of 0.08 seconds.

数据= iddata(y2,u2,0.08);

计算数据的平均值。

t = getTrend(数据,0);

Remove the mean from the data.

数据_d = detrend(data,T);

在同一图上绘制原始数据和破坏性数据。

plot(data,data_d)

图包含2个轴对象。Axes object 1 with title y1 contains 2 objects of type line. These objects represent data, data\_d. Axes object 2 with title u1 contains 2 objects of type line. These objects represent data, data\_d.

负载和绘图数据包含两个输入通道和一个输出通道。

loadz7lintrendz7Lplot(z7L)

Figure contains 3 axes objects. Axes object 1 with title y1 contains an object of type line. This object represents z7L. Axes object 2 with title u1 contains an object of type line. This object represents z7L. Axes object 3 with title u2 contains an object of type line. This object represents z7L.

这output channel ofz7Lcontains a linear trend that is not present in the input channels. Compute the trend information.

t= getTrend(z7L,1)
trend specifications for data "z7L" with 2 input(s), 1 output(s), 1 experiment(s): DataName: 'z7L' InputOffset: [-0.0764 -0.0683] OutputOffset: -0.2642 InputSlope: [4.8338e-04 3.1642e-04] OutputSlope: 0.0268

Limit the trend information to the output channel only by setting the input trend values to 0.

t.inputoffset = [0 0];t.inputslope = [0 0];t
trend specifications for data "z7L" with 2 input(s), 1 output(s), 1 experiment(s): DataName: 'z7L' InputOffset: [0 0] OutputOffset: -0.2642 InputSlope: [0 0] OutputSlope: 0.0268

从数据中删除线性趋势。

z7d = detrend(z7L,T); plot(z7d)

Figure contains 3 axes objects. Axes object 1 with title y1 contains an object of type line. This object represents z7d. Axes object 2 with title u1 contains an object of type line. This object represents z7d. Axes object 3 with title u2 contains an object of type line. This object represents z7d.

这trend is no longer in the output data and the input data is unchanged.

Input Arguments

collapse all

时间域输入输出数据,指定为iddata包含一组时间域信号的对象。这iddataobject can contain SISO, MIMO, or multiexperiment data. The signal sets can contain either input and output data or output data only.

Output Arguments

collapse all

趋势信息,返回trendInfo目的。

版本嗨story

Introduced in R2009a