| Contents | Index |
y = sim(sys,data)
y = sim(sys,data,opt)
[y,y_sd] = sim(sys,data,___)
[y,y_sd,x]
= sim(sys,data,___)
y = sim(sys,data) simulates the response an identified model, sys, using the input data, data. y is the simulation output.
y = sim(sys,data,opt) simulates the system response using the option set, opt, to specify simulation behavior.
[y,y_sd] = sim(sys,data,___) also returns the estimated standard deviation, y_sd, for sys.
[y,y_sd,x] = sim(sys,data,___) also returns the state trajectory, x, for state-space models.
sim extends lsim 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 above operations, use lsim.
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 this, specify data 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 a custom noise signal to be added to the simulated response by creating an option set using simOptions and then setting the NoiseData option appropriately.
sys |
Identified model. sys may be a linear or nonlinear identified model. |
data |
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, data 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 that specifies the following:
Use simOptions to create the options set. |
Simulate the response of an identified model.
Obtain the identified model.
load iddata2 z2; sys = tfest(z2,3);
sys is an idtf model that encapsulates the third-order transfer function estimated for the measured data z2.
Simulate the model.
sim(sys,z2);

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 iddata2 z2; 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.
Obtain the simulated model response.
sim(sys,z2,opt);

Use simsd for a Monte-Carlo method of computing the standard deviation of the response.
compare | forecast | idinput | lsim | predict | simOptions | simsd | step

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |