sim
Simulate response of identified model
Syntax
Description
returns the simulated response of an identified model using the input data,
y
= sim(sys
,udata
)udata
. udata
can be a
timetable
, a numeric matrix, or an iddata
object.
By default, zero initial conditions are used for all model types except
idnlgrey
, in which case the initial conditions stored
internally in the model are used.
sim(___)
plots the simulated
response of the identified model.
Examples
Input Arguments
Output Arguments
Tips
When the initial conditions of the estimated model and the system that measured the validation data set are different, the simulated and measured responses may also differ, especially at the beginning of the response. To minimize this difference, estimate the initial state values using
findstates
and use the estimated values to set theInitialCondition
option usingsimOptions
. For an example, see Match Model Response to Output Data.
Algorithms
Simulation means computing the model response
using input data and initial conditions. sim
simulates
the following system:
Here,
u(t) is the simulation input data,
udata
.y(t) is the simulated output response.
G is the transfer function from the input to the output and is defined in
sys
. The simulation initial conditions, as specified usingsimOptions
, set the initial state of G.e(t) is an optional noise signal. Add noise to your simulation by creating a
simOptions
option set, and setting theAddNoise
option totrue
. Additionally, you can change the default noise signal by specifying theNoiseData
option.H is the noise transfer function and is defined in
sys
.δu is an optional input offset subtracted from the input signal, u(t), before the input is used to simulate the model. Specify an input offset by setting the
InputOffset
option usingsimOptions
.δy is an optional output offset added to the output response, y(t), after simulation. Specify an output offset by setting the
OutputOffset
option usingsimOptions
.
For more information on specifying simulation initial conditions, input and output offsets,
and noise signal data, see simOptions
. For multiexperiment data, you
can specify these options separately for each experiment.
Alternatives
Use
simsd
for a Monte-Carlo method of computing the standard deviation of the response.sim
extendslsim
to facilitate additional features relevant to identified models:Simulation of nonlinear models
Simulation with additive noise
Incorporation of signal offsets
Computation of response standard deviation (linear models only)
Frequency-domain simulation (linear models only)
Simulations using different intersample behavior for different inputs
To obtain the simulated response without any of the preceding operations, use
lsim
.
Version History
Introduced before R2006aSee Also
simOptions
| simsd
| lsim
| step
| compare
| predict
| forecast
| idinput
| findstates