y = sim(sys,udata) simulates
the response an identified model, sys, using
the input data, udata. Zero initial conditions
are used for all model types except idnlgrey where
the initial conditions stored internally in the model are used. y is
the simulation output.

y = sim(sys,udata,opt)
simulates the system response using the option set, opt,
to specify simulation behavior.

[y,y_sd] = sim(___) returns
the estimated standard deviation, y_sd, for sys.

[y,y_sd,x]
= sim(___) returns the state trajectory, x,
for state-space models.

Input Arguments

sys

Identified model.

sys may be a linear or nonlinear identified
model.

udata

Simulation input data.

Specify data as an iddata object, using
only the input channels.

If sys is a linear model, you can use either
time- or frequency-domain data. If sys is a nonlinear
model, you can use only time-domain data.

For time-domain simulation of discrete-time systems, udata may
also be specified as a matrix whose columns correspond to each input
channel.

If you do not have data from an experiment, use idinput to
generate signals of various characteristics.

opt

Simulation options.

opt is an option set, created using simOptions, that specifies options including:

Signal offsets

Initial condition handling

Additive noise

Output Arguments

y

Simulated response.

y is an iddata object representing the
simulated response for sys using udata as
the simulation input.

If udata represents time-domain data, then y is
the simulated response for the time vector corresponding to udata.

If udata represents frequency-domain data,
then y contains the Fourier transform of the
corresponding sampled time-domain output signal. This signal is obtained
by the multiplying the frequency response of sys, G(w)
and U(w).

For multi-experiment data, y is a corresponding
multi-experiment iddata object.

y_sd

Estimated standard deviation of the simulated response for linear
models.

y_sd is derived using first order sensitivity
considerations (Gauss approximation formula).

For nonlinear models, y_sd is [].

x

Estimated state trajectory for state-space models.

Relevant only if sys is a state-space model
(idss, idgrey or idnlgrey).

x is an Ns-by-Nx matrix,
where Ns is the number of samples and Nx is
the number of states.

Simulate the model response of an identified model. Specify simulation options to study the contribution of noise to the simulated model response.

Obtain the identified model.

load iddata2z2;
sys = tfest(z2,3);

sys is an idtf model that encapsulates the third-order transfer function estimated for the measured data z2.

Create a simulation option set that adds noise to the simulated model response.

e = randn(length(z2.u),1);
opt = simOptions('AddNoise',true,'NoiseData',e);

e represents white, Gaussian noise. opt is an option set that specifies the addition of noise data, e, to the simulated model response. You specify the noise data vector, e, that is added to the simulated model response by using the option NoiseData.

You can specify initial conditions for simulation
by creating an option set using simOptions and
then setting the InitialCondition option appropriately.

For multi-experiment data, you can configure each experiment's
initial conditions individually.

You can simulate the initial condition response of
time-series models (models with no inputs) using sim. To do so, specify udata as
an Ns-by-0 signal, where Ns is
the number of samples. As with input-output models, you can study
the effect of noise on the response by using the AddNoise and NoiseData simulation
options. For more information regarding these simulation options,
see simOptions.

For example:

load iddata9 z9;
sys = ar(z9,4,'ls');
data = iddata([],zeros(512,0),z9.Ts);
opt = simOptions('AddNoise',true);
y = sim(sys,data,opt);

You can specify the addition of a custom noise signal
to the simulated response. To do so, create an option set using simOptions and then set the NoiseData option
appropriately.