| 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 |
| On this page… |
|---|
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:
Load the data set, as described in Loading Data into the MATLAB Workspace.
Estimate the second-order process model, as described in Estimating a Second-Order Transfer Function with Complex Poles and Noise.
Export the model to the MATLAB workspace, as described in Exporting the Model to the MATLAB Workspace.
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.
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.
For more information about representing data signals for system identification, see the System Identification Toolbox User's Guide.
To add blocks to a Simulink model:
In the MATLAB Command Window, type simulink.
Select File > New > Model to open a new model window.
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.
Drag the following System Identification Toolbox blocks to the new model window:
IDDATA Sink block
IDDATA Source block
IDMODEL model block
In the Simulink Library Browser, select the Simulink > Sinks library, and drag the Scope block to the new model window.
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.
For more information about working with Simulink models, see the Simulink documentation.
This procedure guides you through the following tasks to configure the model blocks:
Getting data from the MATLAB workspace.
Setting the simulation time interval and duration.
In the new model window, select Simulation > Configuration Parameters.
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.
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.

Click OK.
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.

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:
![]()
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
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.

In the Simulink model window, select Simulation > Start.
Double-click the Scope block to display the time plot of the model output.

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.
![]() | Exporting the Model to the MATLAB Workspace | Tutorial – Identifying Linear Models Using the Command Line | ![]() |

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 |