Products & Services Solutions Academia Support User Community Company

Learn more about System Identification Toolbox   

Simulating a System Identification Toolbox Model in Simulink Software

Prerequisites for This Tutorial

In this tutorial, you create a simple Simulink model that uses blocks from the System Identification Toolbox library to bring the data z and the model P2DUe2 into Simulink.

To perform the steps in this tutorial, Simulink must be installed on your computer.

Furthermore, you must have already performed the following steps:

If you have not performed these steps, click here to complete them. Then, drag the z and the P2DUe2 icons to the To Workspace rectangle in the System Identification Tool window. The data and the model now appear in the MATLAB Workspace browser.

Preparing Input Data

Use the input channel of the data set z as input for simulating the model output by typing the following in the MATLAB Command Window:

z_input = z    % Creates a new iddata object.
z_input.y = [] % Sets the output channel
               % to empty.

Alternatively, you can specify any input signal.

Learn More

For more information about representing data signals for system identification, see the System Identification Toolbox User's Guide.

Building the Simulink Model

To add blocks to a Simulink model:

  1. In the MATLAB Command Window, type simulink.

  2. Select File > New > Model to open a new model window.

  3. In the Simulink Library Browser, select the System Identification Toolbox library. The right side of the window displays blocks specific to the System Identification Toolbox product.

      Tip   Another way to access the System Identification block library is to type slident in the MATLAB Command Window.

  4. Drag the following System Identification Toolbox blocks to the new model window:

    • IDDATA Sink block

    • IDDATA Source block

    • IDMODEL model block

  5. In the Simulink Library Browser, select the Simulink > Sinks library, and drag the Scope block to the new model window.

  6. In the Simulink model window, connect the blocks until your model resembles the following figure.

In the next section, you configure these blocks to get data from the MATLAB workspace and set the simulation time interval and duration.

Learn More

For more information about working with Simulink models, see the Simulink documentation.

Configuring Blocks and Simulation Parameters

This procedure guides you through the following tasks to configure the model blocks:

  1. In the new model window, select Simulation > Configuration Parameters.

  2. In the Configuration Parameters dialog box, type 200 in the Stop time field. Click OK.

    This value sets the duration of the simulation to 200 seconds.

  3. Double-click the Iddata Source block to open the Source Block Parameters: Iddata Source dialog box. Then, type the following variable name in the Iddata object field:

    z_input

    This variable is the data object in the MATLAB workspace that contains the input data.

      Tip   As a shortcut, you can drag and drop the variable name from the MATLAB Workspace browser to the Iddata object field.

  4. Click OK.

  5. Double-click the Idmodel block to open the Function Block Parameters: Idmodel dialog box. Type the following variable name in the idmodel variable field:

    P2DUe2

    This variable represents the name of the model in the MATLAB workspace.

  6. Clear the Add noise check box to exclude noise from the simulation. Click OK.

    When Add noise is selected, Simulink derives the noise amplitude from the NoiseVariance property of the model and adds noise to the model accordingly. The simulation propagates this noise according to the noise model H that was estimated with the system dynamics:

  7. Double-click the Iddata Sink block to open the Sink Block Parameters: Iddata Sink dialog box. Type the following variable name in the IDDATA Name field:

    z_sim_out
  8. Type 1 in the Sample Time (sec.) field to set the sampling time of the output data to match the sampling time of the input data. Click OK.

The resulting change to the Simulink model is shown in the following figure.

Running the Simulation

  1. In the Simulink model window, select Simulation > Start.

  2. Double-click the Scope block to display the time plot of the model output.

  3. In the MATLAB Workspace browser, notice the variable z_sim_out that stores the model output as an iddata object. You specified this variable name when you configured the Iddata Sink block.

    This variable stores the simulated output of the model, and it is now available for further processing and exploration.

  


Recommended Products

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