| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → System Identification Toolbox |
| Contents | Index |
| Learn more about System Identification Toolbox |
YS = sim(MODEL,U)
YS = sim(MODEL,U,'Noise')
YS = sim(MODEL,U,'InitialState',INIT)
YS = sim(MODEL,U) simulates the output of an idnlhw model.
YS = sim(MODEL,U,'Noise') simulates the model output with an additive Gaussian noise scaled according to the value of the NoiseVariance property of MODEL.
YS = sim(MODEL,U,'InitialState',INIT) specifies initial conditions for starting the simulation.
To simulate the model with user-defined noise, set the input U = [UIN E], where UIN is the input signal and E is the noise signal. UIN and E must both be one of the following:
iddata objects: E stores the noise signals as inputs, where the number of inputs matches the number of model outputs.
Matrices: E has as many columns as there are noise signals, corresponding to the number of model outputs.
MODEL: idnlhw model object.
U: Input data for simulation, which is an iddata object (where only the input channels are used) or a matrix. For simulations with noisy data, U contains both input and noise channels.
INIT: Initial condition for simulation. INIT has one of the following values:
Vector of initial state values. To estimate an initial state vector from input-output data or to generate equilibrium states, see the findstates(idnlhw) and findop(idnlhw) reference pages. For multiple-experiment data, enter a matrix with the same number of columns as the number of experiments.
'z': (Default) Vector containing zeros and corresponding to a system starting from rest.
YS: Simulated output, which is an iddata object when U is an iddata object, or a matrix otherwise.
Note If sim is called without an output argument, MATLAB software displays the simulated output(s) in a plot window. |
In this example you simulate the model output using initial states that minimize the error between the simulated and the measured output. z2 is the measured data.
Load the sample data.
load iddata2
Create a Hammerstein-Wiener model.
M = nlhw(z2,[4 3 2],'wave','pwl');
Compute the initial states that best fit the model response to the measured output.
x0 = findstates(M,z2);
Simulate the model using the estimated initial states.
ysim = sim(M,z2.u,'init',x0)
Compare ysim to output signal in z2:
t = z2.samp; plot(t, ysim, t, z2.y)
In this example, you simulate a single-input single-output idnlhw model about a steady-state operating point, where the input level is known to be 1 and the output level is unknown.
Load the sample data.
load iddata2
Create a Hammerstein-Weiner model.
M = nlhw(z2,[4 3 2],'wave','pwl');
Compute steady-state operating point values corresponding to an input level of 1 and an unknown output level.
x0 = findop(M,'steady',1,NaN);
Simulate the model using the estimated initial states.
sim(M,z2.u,'init',x0)
| findop(idnlhw) | |
| finstates(idnlhw) | |
| predict(idnlhw) |
![]() | sim(idnlgrey) | simsd | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |