Create Multiexperiment Data at the Command Line
Why Create Multiexperiment Data Sets?
You can create iddata
objects that contain several experiments.
Identifying models for an iddata
object with multiple experiments
results in an average model.
In the System Identification Toolbox™ product, experiments can either mean data collected
during different sessions, or portions of the data collected during a single session. In the
latter situation, you can create a multiexperiment iddata
object by
splitting the data from a single session into multiple segments to exclude bad data, and
merge the good data portions.
Note
The idfrd
object does not support the iddata
equivalent of multiexperiment data.
Limitations on Data Sets
You can only merge data sets that have all of the following characteristics:
Same number of input and output channels.
Same input and output channel names.
Same data domain (that is, time-domain data or frequency-domain data).
Entering Multiexperiment Data Directly
To construct an iddata
object that includes N
data sets, you can use this syntax:
data = iddata(y,u,Ts)
where y
, u
, and Ts
are
1-by-N cell arrays containing data from the different experiments.
Similarly, when you specify Tstart
, Period
,
InterSample
, and SamplingInstants
properties of the
iddata
object, you must assign their values as
1-by-N cell arrays.
Merging Data Sets
This example shows how to create a multiexperiment iddata
object by merging iddata
objects, where each contains data from a single experiment or is a multiexperiment data set.
Load iddata objects z1
and z3
.
load iddata1 load iddata3
Merge experiments z1
and z3
into the iddata object z
.
z = merge(z1,z3)
z = Time domain data set containing 2 experiments. Experiment Samples Sample Time Exp1 300 0.1 Exp2 300 1 Outputs Unit (if specified) y1 Inputs Unit (if specified) u1
These commands create an iddata
object that contains two experiments, where the experiments are assigned default names 'Exp1'
and 'Exp2'
, respectively.
Adding Experiments to an Existing iddata Object
You can add experiments individually to an iddata
object as an
alternative approach to merging data sets.
For example, to add the experiments in the iddata
object
dat4
to data
, use the following syntax:
data(:,:,:,'Run4') = dat4
This syntax explicitly assigns the experiment name 'Run4'
to the new
experiment. The Experiment
property of the iddata
object stores experiment names.
For more information about subreferencing experiments in a multiexperiment data set, see Subreferencing Experiments.