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.
|
To set the sample time to set(data,'ts',0.05) 或者 数据。ts = 0.05 |
TSTART |
实验的开始时间。
|
将第一个数据样本的启动时间更改为 data.tstart = 24 Time units are set by the property |
SamplingInstants |
Time values in the time vector, computed from the properties
|
To retrieve the time vector for
To plot the input data as a function of time: plot(data.sa,data.u) Note
|
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 to data.ti ='毫秒' |
iddataFrequency-Vector Properties
财产 | 描述 | Syntax Example |
---|---|---|
Frequency |
Frequency values at which the Fourier transforms of the signals are defined.
|
To specify data.freq = logspace(-1,2,100) |
频率固定 |
频率单位。指定为以下一项:为以下一项: For multi-experiment data with |
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, use |
命名,添加和删除数据渠道
什么是输入和输出通道?
多元系统可能包含多个输入变量或几个输出变量,或两者兼有。当输入或输出信号包含几个测量变量时,这些变量被称为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 theset
command 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
相当于输出名称
。
如果您在创建时未指定频道名称iddata
object, 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;
输入5
must 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 aniddata
object, 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 theiddata
object数据
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。