System Identification Toolbox    

More on the Data Representation in iddata

Some Bookkeeping Facilities

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 timepoints 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. For easy writing 'u' is synonymous to 'Input' and 'y' to 'Output' when referring to the properties.

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 Adding Channels) or add the data record directly, so that

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 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 merge (iddata) in "Command Reference." 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, as in getexp(Dat,3) or getexp(Dat,'Period1'). They can also be set and 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

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

iddata Properties

Type get(Dat) or see iddata in the "Command Reference" for a complete list of iddata properties.

Subreferencing

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

Use 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.

Adding Channels

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.

Adding Samples

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.


  Spectral Analysis Parametric Model Estimation