Accelerating the pace of engineering and science

IDNLARX Model

Simulate nonlinear ARX model in Simulink software

Library

System Identification Toolbox

Description

The IDNLARX Model block simulates a nonlinear ARX (idnlarx) model for time-domain input and output data.

Input

Input signal to the model.

For multi-input models, specify the input as an Nu-element vector, where Nu is the number of inputs. For example, you can use a Vector Concatenate block to concatenate scalar signals into a vector signal.

 Note:   Do not use a Bus Creator or Mux block to produce the vector signal.

Output

Simulated output from the model.

Dialog Box

Model

Name of idnlarx variable in the MATLAB® workspace.

Initial conditions

Specifies the initial states as one of the following:

• Input and output values: Specify the input and output levels, as follows:

• Input level

If known, enter a vector of length equal to the number of model inputs. If you enter a scalar, it is the signal value for all inputs.

• Output level

If known, enter a vector of length equal to the number of model's outputs. If you enter a scalar, it is the signal value for all outputs.

• State values: When selected, you must specify a vector of length equal to the number of states in the model in the Vector of state values field.

If you do not know the initial states, you can estimate these states, as follows:

• To simulate around a given input level when you do not know the corresponding output level, you can estimate the equilibrium state values using the findop(idnlarx) command.

For example, to simulate a model M about a steady-state point where the input is 1 and the output is unknown, you can enter X0, such that:

`X0 = findop(M,'steady',1,NaN)`
• To estimate the initial states that provide a best fit between measured data and the simulated response of the model for the same input, use the findstates(idnlarx) command.

For example, to compute initial states such that the response of the model M matches the output data in the data set z, you can enter X0, such that:

`X0 = findstates(M,z,[],'sim')`
• To continue a simulation from a previous run, use the simulated input-output values from the previous simulation to compute the initial states X0 for the current simulation.

For example, suppose that firstSimData is a variable that stores the input and output values from a previous simulation. For a model M, you can enter X0, such that:

`X0 = data2state(M,firstSimData)`

Examples

Example 1

In this example, you estimate a nonlinear ARX model from data and compare the model output to the measured output of the system.

1. Load the sample data.

```load twotankdata
```
2. Create a data object from sample data.

```z = iddata(y,u,0.2,'Name','Two tank system');
z1 = z(1:1000);```
3. Estimate a nonlinear ARX model.

`mw1 = nlarx(z1,[5 1 3],wavenet('NumberOfUnits',8)); `
4. Build the following Simulink® model using the IDDATA Source, IDNLARX Model, and Scope blocks.

5. Double-click the IDDATA Source block and enter the following into the block parameter dialog box:

IDDATA Object: z1

Click OK.

6. Double-click the IDNLARX Model block and enter the following into the block parameter dialog box:

• Model: mw1

• Initial conditions: Select Input and output values and accept the default values.

7. Run the simulation.

Click the Scope block to view the difference between the measured output and the model output. Use the Autoscale command to scale the axes.

Example 2

In this example, you reduce the difference between the measured and simulated responses. To achieve this, you use the findstates command to estimate an initial state vector for the model from the data.

1. Estimate initial states from the data z1.

`x0 = findstates(mw1,z1,[],'simulation');`
2. Set the Initial Conditions to State Values. Enter x0 in the corresponding field.

3. Run the simulation.

See Also

Topics in the System Identification Toolbox User's Guide

Was this topic helpful?