System Identification Toolbox    
iddata

Package input-output data into the iddata object.

Syntax

Description

iddata is the basic object for dealing with signals in the toolbox. It is used by most of the commands.

Basic Use

Let y be a column vector or an N-by-ny matrix. The columns of y correspond to the different output channels. Similarly, u is a column vector or an N-by-nu matrix containing the signals of the input channels.

creates an iddata object containing these output and input channels. Ts is the sampling interval. This construction is sufficient for most purposes.

The data is then plotted by plot(data) (see plot), and portions of the data record are selected as in ze = data(1:300) or zv = data(501:700).

The signals in the output channels are retrieved by data.OutputData, or for short data.y. Similarly the input signals are obtained by data.InputData or data.u.

For a time series (no input channels) use data = iddata(y), or let u = [].

An iddata object can also contain just an input, by letting y = [].

The sampling interval can be changed by set(data,'Ts',0.3) or, simpler, by data.Ts = 0.3.

The input and output channels are given default names like 'y1', 'y2', 'u1','u2', etc. The channel names can be set by

(two inputs and one output is this example) and these names will then follow the object and appear in all plots. The names will also be inherited by models that are estimated from the data.

Similarly, channel units can be specified using the properties 'OutputUnit' and 'InputUnit'. These units, when specified, will be used in plots.

The time points associated with the data samples are determined by the sampling interval Ts and the time of the first sample, Tstart.

The actual time point values are given by the property 'SamplingInstants', as in

for a plot of the input with correct time points. Autofill is used for all properties, and they are case insensitive.

Manipulating Channels

An easy way to set and retrieve channel properties is to use subscripting. The subscripts are defined as

so dat(:,3,:) is the data object obtained from dat by keeping all input channels, but only output channel 3. (Trailing ":"s can be omitted so dat(:,3,:)= dat(:,3).).

The channels can also be retrieved by their names, so that

is the data object where the indicated output channels have been selected and no input channels are selected.

Moreover

will change samples 101 to 200 of output channels 3 and 4 and input channels 1 and 3 in the iddata object dat1 to the indicated values from iddata object dat2. The names and units of these channels will then also be changed accordingly.

To add new channels, use horizontal concatenation of iddata objects.

(see "Horizontal Concatenation" below) or add the data record directly. Thus

will add a fifth input to dat.

Nonequal Sampling

The property 'SamplingInstants' gives the sampling instants of the data points. It can always be retrieved by get(DAT,'SamplingInstants') (or dat.s) and is then computed from dat.Ts and dat.Tstart. 'SamplingInstants' can also be set to an arbitrary vector of the same length as the data, so that nonequal sampling can be handled. Ts is then automatically set to [ ]. Most of the estimation routines, though, do not handle unequally sampled data.

Multiple Experiments

The iddata object can also store data from separate experiments. The property 'ExperimentName' is used to separate the experiments. The number of data as well as the sampling properties can vary from experiment to experiment, but the input and output channels must be the same. (Use NaN to fill possibly unmeasured channels in certain experiments.) The data records will be cell arrays, where the cells contain data from each experiment.

Multiple experiments can be defined directly by letting the 'y' and 'u' properties as well as 'Ts' and 'Tstart' be cell arrays.

It is normally easier to create multi-experiment data by merging experiments as in

See the reference page for merge (data). Storing multiple experiments as one iddata object may be very useful to handle experimental data that has been collected on different occasions, or when a data set has been split up to remove "bad" portions of the data. All the toolbox's routines accept multiple experiment data.

Experiments can be retrieved by the command getexp. They can also be retrieved by subscripting with a fourth index: dat(:,:,:,3) is experiment number 3 and dat(:,:,:,{'Day1','Day4'}) retrieves the two experiments with the indicated names.

The subscripting can be combined: dat(1:100,[2,3],[4:8],3) gives the 100 first samples of output channels 2 and 3 and input channels 4 to 8 of experiment number 3. It can also be used for subassignment, like

which adds the data in dat2 as a new experiment with name 'Run4'. See iddemo number 8 for an illustration of how multiple experiments can be used.

iddata Properties

In the list below, N denotes the number of samples of the signals, ny the number of output channels, nu the number of input channels, and Ne the number of experiments:

Note that all properties can be set or retrieved either by set/get or by subscripts. Autofill applies to all properties and values, and are case insensitive:. 'y' and 'u' can be used as short for 'OutputData' and 'InputData'. 'y' and 'u' can also replace 'Output' and 'Input' in the other properties.

For a complete list of property values, use get(data). To see possible value assignments, use set(data).

Subreferencing

The samples, outputs and input channels can be referenced according to

Use a colon (:) to denote all samples/channels and the empty matrix ([ ]) to denote no samples/channels. The channels can be referenced by number or by name. For several names, a cell array must be used.

Logical expressions will also work.

will select the samples with time marks between 1.27 and 9.3.

Subreferencing with curly brackets refers to the experiment.

Any subreferenced variable can also be assigned.

Horizontal Concatenation

dat = [dat1,dat2,...,datN]

creates an iddata object dat, consisting of the input and output channels in dat1,... datN. Default channel names ('u1', 'u2', 'y1', 'y2', etc.) will be changed so that overlaps in names are avoided, and the new channels will be added.

If datk contains channels with user specified names, that are already present in the channels of Datj, j<k, these new channels will be ignored.

Vertical Concatenation

dat = [dat1;dat2;... ;datN]

creates an iddata object dat whose signals are obtained by stacking those of datk on top of each other. That is

and similarly for the inputs. The datk objects must all have the same number of channels and experiments.

Online Help Functions

See help iddata, idprops iddata, help iddata/subsref, help iddata/subsasgn, help iddata/horzcat, and help iddata/vertcat.

See Also

plot (iddata), size


  idarx ident