This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Simulating Identified Model Output in Simulink

When to Use Simulation Blocks

Add model simulation blocks to your Simulink® model from the System Identification Toolbox™ block library when you want to:

  • Represent the dynamics of a physical component in a Simulink model using a data-based nonlinear model.

  • Replace a complex Simulink subsystem with a simpler data-based nonlinear model.

You use the model simulation blocks to import the models you identified using System Identification Toolbox software from the MATLAB® workspace into the Simulink environment. For a list of System Identification Toolbox simulation blocks, see Summary of Simulation Blocks.

Summary of Simulation Blocks

The following table summarizes the blocks you use to import models from the MATLAB environment into a Simulink model for simulation. Importing a model corresponds to entering the model variable name in the block parameter dialog box.

IdmodelSimulate a linear identified model in Simulink software. The model can be a process (idproc), linear polynomial (idpoly), state-space (idss), grey-box (idgrey) and transfer-function (idtf) model.
Nonlinear ARX ModelSimulate idnlarx model in Simulink.
Hammerstein-Wiener ModelSimulate idnlhw model in Simulink.
Nonlinear Grey-Box ModelSimulate nonlinear ODE (idnlgrey model object) in Simulink.

After you import the model into Simulink software, use the block parameter dialog box to specify the initial conditions for simulating that block. (See Specifying Initial Conditions for Simulation.) For information about configuring each block, see the corresponding reference pages.

Specifying Initial Conditions for Simulation

For accurate simulation of a linear or a nonlinear model, you can use default initial conditions or specify the initial conditions for simulation using the block parameters dialog box.

Specifying Initial States of Linear Models

Specify the initial states for simulation in the Initial states (state space only: idss, idgrey) field of the Function Block Parameters: Idmodel dialog box:

  • For idss and idgrey models, initial states must be a vector of length equal to the order of the model.

  • For models other than idss and idgrey, initial conditions are zero.

  • In some situations, you may want to match the simulated response of the model to a certain input/output data set:

    1. Convert the identified model into state-space form (idss model), and use the state-space model in the block.

    2. Compute the initial state values that produce the best fit between the model output and the measured output signal using findstates.

    3. Specify the same input signal for simulation that you used as the validation data in the app or in the compare plot.

      For example:

      % Convert to state-space model
      mss = idss(m); 
      % Estimate initial states from data
      X0 = findstates(mss,z);

      z is the data set you used for validating the model m. Use the model mss and initial states X0 in the Idmodel block to perform the simulation.

Specifying Initial States of Nonlinear ARX Models

The states of a nonlinear ARX model correspond to the dynamic elements of the nonlinear ARX model structure, which are the model regressors. Regressors can be the delayed input/output variables (standard regressors) or user-defined transformations of delayed input/output variables (custom regressors). For more information about the states of a nonlinear ARX model, see the idnlarx reference page.

For simulating nonlinear ARX models, you can specify the initial conditions as input/output values, or as a vector. For more information about specifying initial conditions for simulation, see the IDNLARX Model reference page.

Specifying Initial States of Hammerstein-Wiener Models

The states of a Hammerstein-Wiener model correspond to the states of the embedded linear (idpoly or idss) model. For more information about the states of a Hammerstein-Wiener model, see the idnlhw reference page.

The default initial state for simulating a Hammerstein-Wiener model is 0. For more information about specifying initial conditions for simulation, see the IDNLHW Model reference page.

Simulate Identified Model Using Simulink Software

This example shows how to set the initial states for simulating a model such that the simulation provides a best fit to measured input-output data.


To simulate the model using input u2, use x0(:,2) as the initial states. x0(:,2) is computed to maximize the fit between the measured output, y2, and the response of M.

To compute initial states that maximizes the fit to the corresponding output y2, and simulate the model using the second experiment:

  1. Extract the initial states that correspond to the second experiment for simulation.

    X0est = x0(:,2);
  2. Open the System Identification Toolbox library by typing the following command at the MATLAB prompt.

  3. Open a new Simulink model window. Then, drag and drop an Idmodel block from the library into the model window.

  4. Open the Function Block Parameters dialog box by double-clicking the Idmodel block. Specify the following block parameters:

    1. In the Model variable field, type M to specify the estimated model.

    2. In the Initial state field, type X0est to specify the estimated initial states. Click OK.

  5. Drag and drop an Iddata Source block into the model window. Then, configure the model, as shown in the following figure.

  6. Simulate the model for 2 seconds, and compare the simulated output ysim with the measured output ymeasured using the Scope block.

See Also


Related Topics

Was this topic helpful?