主要内容

Managing iddata Objects

Modifying Time and Frequency Vectors

Theiddata对象存储时间域数据或频域数据,并具有几个指定时间或频率值的属性。要修改时间或频率值,您必须更改相应的属性值。

Note

You can modify the propertySamplingInstants通过设置一个新的向量智慧h the length equal to the number of data samples. For more information, see为时间域数据构建IDDATA对象

The following tables summarize time-vector and frequency-vector properties, respectively, and provides usage examples. In each example,数据是一个iddata目的。

Note

财产names are not case sensitive. You do not need to type the entire property name if the first few letters uniquely identify the property.

IDDATA时间矢量属性

财产 描述 Syntax Example
Ts

Sample time.

  • For a single experiment,Ts是标量值。

  • For multiexperiment data withNE实验,Tsis a1-经过-NE细胞阵列,每个细胞包含相应实验的样品时间。

To set the sample time to0.05:

set(data,'ts',0.05)

或者

数据。ts = 0.05
TSTART

实验的开始时间。

  • For a single experiment,Ts是标量值。

  • For multiexperiment data withNE实验,Tsis a1-经过-NE细胞阵列,每个细胞包含相应实验的样品时间。

将第一个数据样本的启动时间更改为24:

data.tstart = 24

Time units are set by the propertyTimeUnit

SamplingInstants

Time values in the time vector, computed from the propertiesTSTARTTs

  • For a single experiment,SamplingInstants是一个N-经过-1向量。

  • For multiexperiment data withNE实验,此属性是1-经过-NEcell array, and each cell contains the sampling instants of the corresponding experiment.

To retrieve the time vector foriddataobject数据, use:

获取(数据,'sa')

To plot the input data as a function of time:

plot(data.sa,data.u)

Note

sais the first two letters of theSamplingInstants唯一标识此属性的属性。

TimeUnit Unit of time. Specify as one of the following:'纳秒','microseconds',“毫秒”,'seconds','minutes','hours','days','weeks',“月份”, 和'years'

To change the unit of the time vector tomilliseconds:

data.ti ='毫秒'

iddataFrequency-Vector Properties

财产 描述 Syntax Example
Frequency

Frequency values at which the Fourier transforms of the signals are defined.

  • For a single experiment,Frequency是标量值。

  • For multiexperiment data withNE实验,Frequencyis a1-经过-NE细胞阵列,每个细胞包含相应实验的频率。

To specify100日志空间中的频率值0.1100, use the following syntax:

data.freq = logspace(-1,2,100)
频率固定

频率单位。指定为以下一项:为以下一项:'rad/TimeUnit',“循环/时间持续时间”,'rad/s','赫兹','千赫','MHz','GHz', 和,'rpm'。默认:'rad/TimeUnit'

For multi-experiment data withNE实验,单位is a1-经过-NEcell array, and each cell contains the frequency unit for each experiment.

Set the frequency unit to Hz:

data.frequencyunit ='hz'

Note that changing the frequency unit does not scale the frequency vector. For a proper translation of units, usechgFreqUnit

命名,添加和删除数据渠道

什么是输入和输出通道?

多元系统可能包含多个输入变量或几个输出变量,或两者兼有。当输入或输出信号包含几个测量变量时,这些变量被称为channels

命名频道

Theiddata特性InputName输出名称store the channel names for the input and output signals. When you plot the data, you use channel names to select the variable displayed on the plot. If you have multivariate data, it is helpful to assign a name to each channel that describes the measured variable. For more information about selecting channels on a plot, seeSelecting Measured and Noise Channels in Plots

You can use thesetcommand to specify the names of individual channels. For example, suppose数据contains two input channels (voltage and current) and one output channel (temperature). To set these channel names, use the following syntax:

set(data,'InputName',{'Voltage','Current'}, 'OutputName','Temperature')

Tip

You can also specify channel names as follows:

数据。una = {'Voltage','Current') data.yna = 'Temperature'

una相当于the propertyInputName, 和yna相当于输出名称

如果您在创建时未指定频道名称iddataobject, the toolbox assigns default names. By default, the output channels are named'y1','y2',...,'yn',并且输入频道被命名'u1','u2',...,'un'

添加频道

您可以将数据渠道添加到iddata目的。

For example, consider aniddata命名的对象数据其中包含一个带有四个通道的输入信号。要添加第五个输入通道,存储为向量输入5, use the following syntax:

数据。u(:,5) = Input5;

输入5must have the same number of rows as the other input channels. In this example,数据。u(:,5)参考所有样本(由:) of the input signalu并设置第五通道的值。将其值分配给输入5

您还可以组合几个输入通道和输出通道iddata对象成一个iddata使用串联的对象。有关更多信息,请参阅增加IDDATA对象的频道或数据点数量

Modifying Channel Data

After you create aniddataobject, you can modify or remove specific input and output channels, if needed. You can accomplish this by subreferencing the input and output matrices and assigning new values.

For example, suppose theiddataobject数据contains three output channels (namedy1,y2, 和y3), and four input channels (namedu1,u2,u3, 和u4). To replace数据这样它仅包含样本y3,u1, 和u4,在提示下输入以下内容:

数据= data(:,3,[1 4])

The resulting data object contains one output channel and two input channels.

子引用IDDATA对象

SeeSelect Data Channels, I/O Data and Experiments in iddata Objects

Concatenating iddata Objects

See增加IDDATA对象的频道或数据点数量