## Nonlinear Model Structures

### About System Identification Toolbox Model Objects

*Objects* are instances of model classes.
Each *class* is a blueprint that defines the following
information about your model:

How the object stores data

Which operations you can perform on the object

This toolbox includes nine classes for representing models.
For example, `idss`

represents
linear state-space models and `idnlarx`

represents
nonlinear ARX models. For a complete list of available model objects,
see Available Linear Models and Available Nonlinear Models.

Model *properties* define how a model object
stores information. Model objects store information about a model,
such as the mathematical form of a model, names of input and output
channels, units, names and values of estimated parameters, parameter
uncertainties, and estimation report. For example, an `idss`

model
has an `InputName`

property for storing one or more
input channel names.

The allowed operations on an object are called *methods*.
In System Identification Toolbox™ software, some methods have the
same name but apply to multiple model objects. For example, `step`

creates a step response plot for
all dynamic system objects. However, other methods are unique to a
specific model object. For example, `canon`

is
unique to state-space `idss`

models and `linearize`

to
nonlinear black-box models.

Every class has a special method, called the *constructor*,
for creating objects of that class. Using a constructor creates an
instance of the corresponding class or *instantiates the
object*. The constructor name is the same as the class name.
For example, `idss`

and `idnlarx`

are
both the name of the class and the name of the constructor for instantiating
the linear state-space models and nonlinear ARX models, respectively.

### When to Construct a Model Structure Independently of Estimation

You use model constructors to create a model object at the command line by specifying all required model properties explicitly.

You must construct the model object independently of estimation when you want to:

Simulate or analyze the effect of model parameters on its response, independent of estimation.

Specify an initial guess for specific model parameter values before estimation. You can specify bounds on parameter values, or set up the auxiliary model information in advance, or both. Auxiliary model information includes specifying input/output names, units, notes, user data, and so on.

In most cases, you can use the estimation commands to both construct
and estimate the model—without having to construct the model
object independently. For example, the estimation command `tfest`

creates a transfer function model
using data and the number of poles and zeros of the model. Similarly, `nlarx`

creates a nonlinear ARX model using
data and model orders and delays that define the regressor configuration.
For information about how to both construct and estimate models with
a single command, see Model Estimation Commands.

In case of grey-box models, you must always construct the model object first and then estimate the parameters of the ordinary differential or difference equation.

### Commands for Constructing Nonlinear Model Structures

The following table summarizes the model constructors available in the System Identification Toolbox product for representing various types of nonlinear models.

After model estimation, you can recognize the corresponding model objects in the
MATLAB^{®} Workspace browser by their class names. The name of the constructor
matches the name of the object it creates.

For information about how to both construct and estimate models with a single command, see Model Estimation Commands.

**Summary of Model Constructors**

Model Constructor | Resulting Model Class |
---|---|

`idnlgrey` | Nonlinear ordinary differential or difference equation (grey-box models). You write a function or MEX-file to represent the governing equations. |

`idnlarx` | Nonlinear ARX models, which define the predicted output as a nonlinear function of past inputs and outputs. |

`idnlhw` | Nonlinear Hammerstein-Wiener models, which include a linear dynamic system with nonlinear static transformations of inputs and outputs. |

`idNeuralStateSpace` | Neural state-space models, which use neural networks to approximate the functions representing a nonlinear state space realization of your system. |

For more information about when to use these commands, see When to Construct a Model Structure Independently of Estimation.

### Model Properties

A model object stores information in the *properties* of the
corresponding model class.

The nonlinear models `idnlarx`

, `idnlhw`

,
and `idnlgrey`

are based on the `idnlmodel`

superclass and inherit all `idnlmodel`

properties.

In general, all model objects have properties that belong to the following categories:

Names of input and output channels, such as

`InputName`

and`OutputName`

Sample time of the model, such as

`Ts`

Time units

Model order and mathematical structure (for example, ODE or nonlinearities)

Properties that store estimation results (

`Report`

)User comments, such as

`Notes`

and`Userdata`

For information about getting help on object properties, see the model reference pages.

The following table summarizes the commands for viewing and changing model property values. Property names are not case sensitive. You do not need to type the entire property name if the first few letters uniquely identify the property.

Task | Command | Example |
---|---|---|

View all model properties and their values | Use `get` . |
Load sample data, compute a nonlinear ARX model, and list the model properties. ```
load iddata1
sys = nlarx(z1,[4 4 1]);
get(sys)
``` |

Access a specific model property | Use dot notation. | View the output function in the previous model. sys.OutputFcn |

For properties, such as `Report` , that are
configured like structures, use dot notation of the form
`model.PropertyName.FieldName` .`FieldName`
is the name of any field of the property. |
View the options used in the nonlinear ARX model estimation. sys.Report.OptionsUsed | |

Change model property values | Use dot notation. | Change the nonlinearity mapping function that the output function uses. sys.OutputFcn = 'idSigmoidNetwork'; |

Access model parameter values and uncertainty information | Use `getpvec` and
`getcov` (for
`idnlgrey` models only). |
Model parameters and associated uncertainty data. getpvec(sys) |

Set model parameter values and uncertainty information | Use `setpar` and `setcov` (for
`idnlgrey` models only). |
Set the parameter vector. `sys = setpar(sys,'Value',parlist)` |

Get number of parameters | Use `nparams` . |
Get the number of parameters. nparams(sys) |

## Related Examples

- Identifying Nonlinear ARX Models
- Identifying Hammerstein-Wiener Models
- Represent Nonlinear Dynamics Using MATLAB File for Grey-Box Estimation