Main Content

Dynamic models in System Identification Toolbox™ software are mathematical relationships between the inputs
*u(t)* and outputs *y(t)* of a system. The
model is *dynamic* because the output value at the current time
depends on the input-output values at previous time instants. Therefore, dynamic
models have memory of the past. You can use the input-output relationships to
compute the current output from previous inputs and outputs. Dynamic models have
states, where a state vector contains the information of the past.

The general form of a model in discrete time is:

*y*(*t*) =
*f*(*u*(*t* - 1),
*y*(*t* - 1),
*u*(*t* - 2),
*y*(*t* - 2), . . .)

Such a model is nonlinear if the function *f* is a nonlinear
function. *f* may represent arbitrary nonlinearities, such as
switches and saturations.

The toolbox uses objects to represent various linear and nonlinear model
structures. The nonlinear model objects are collectively known as
*identified nonlinear models*. These models represent
nonlinear systems with coefficients that are identified using measured input-output
data. See Nonlinear Model Structures for more
information.

In practice, all systems are nonlinear and the output is a nonlinear function of the input variables. However, a linear model is often sufficient to accurately describe the system dynamics. In most cases, you should first try to fit linear models.

However, for some scenarios, you might need the additional flexibility of nonlinear models.

You might need nonlinear models when a linear model provides a poor fit to the measured output signals and cannot be improved by changing the model structure or order. Nonlinear models have more flexibility in capturing complex phenomena than the linear models of similar orders.

From physical insight or data analysis, you might know that a system is weakly nonlinear. In such cases, you can estimate a linear model and then use this model as an initial model for nonlinear estimation. Nonlinear estimation can improve the fit by using nonlinear components of the model structure to capture the dynamics not explained by the linear model. For more information, see Initialize Nonlinear ARX Estimation Using Linear Model and Initialize Hammerstein-Wiener Estimation Using Linear Model.

You might have physical insight that your system is nonlinear. Certain phenomena are inherently nonlinear in nature, including dry friction in mechanical systems, actuator power saturation, and sensor nonlinearities in electromechanical systems. You can try modeling such systems using the Hammerstein-Wiener model structure, which lets you interconnect linear models with static nonlinearities. For more information, see Identifying Hammerstein-Wiener Models.

Nonlinear models might be necessary to represent systems that operate over a range of operating points. In some cases, you might fit several linear models, where each model is accurate at specific operating conditions. You can also try using the nonlinear ARX model structure with tree partitions to model such systems. For more information, see Identifying Nonlinear ARX Models.

If you know the nonlinear equations describing a system, you can represent this system as a nonlinear grey-box model and estimate the coefficients from experimental data. In this case, the coefficients are the parameters of the model. For more information, see Grey-Box Model Estimation.

Before fitting a nonlinear model, try transforming your input and output variables such that the relationship between the transformed variables becomes linear. For example, you might be dealing with a system that has current and voltage as inputs to an immersion heater, and the temperature of the heated liquid as an output. In this case, the output depends on the inputs via the power of the heater, which is equal to the product of current and voltage. Instead of fitting a nonlinear model to two-input and one-output data, you can create a new input variable by taking the product of current and voltage. You can then fit a linear model to the single-input/single-output data.

You might have multiple data sets that capture the linear and nonlinear dynamics separately. For example, one data set with low amplitude input (excites the linear dynamics only) and another data set with high amplitude input (excites the nonlinear dynamics). In such cases, first estimate a linear model using the first data set. Next, use the model as an initial model to estimate a nonlinear model using the second data set. For more information, see Initialize Nonlinear ARX Estimation Using Linear Model and Initialize Hammerstein-Wiener Estimation Using Linear Model.

In a black-box or “cold start” estimation, you only have to specify the order to configure the structure of the model.

sys =estimator(data,orders)

where * estimator* is the name of an estimation
command to use for the desired model type.

For example, you use `nlarx`

to estimate nonlinear ARX
models, and `nlhw`

for Hammerstein-Wiener
models.

The first argument, `data`

, is time-domain data represented
as an `iddata`

object. The second
argument, `orders`

, represents one or more numbers whose
definition depends upon the model type.

For nonlinear ARX models,

`orders`

refers to the model orders and delays for defining the regressor configuration. Alternatively, you can explicitly specify linear, polynomial, and customer regressors.For Hammerstein-Wiener models,

`orders`

refers to the model order and delays of the linear subsystem transfer function.

When working in the System Identification app, you specify the orders or regressors in the appropriate edit fields of corresponding model estimation dialog boxes.

You can refine the parameters of a previously estimated nonlinear model using the following command:

sys =estimator(data,sys0)

This command updates the parameters of an existing model
`sys0`

to fit the data and returns the results in output
model `sys`

. For nonlinear systems,
*estimator* can be `nlarx`

, `nlhw`

, or `nlgreyest`

.

Nonlinear ARX (`idnlarx`

) and Hammerstein-Wiener
(`idnlhw`

) models contain a linear
component in their structure. If you have knowledge of the linear dynamics, such
as through identification of a linear model using low-amplitude data, you can
incorporate it during the estimation of nonlinear models. In particular, you can
replace the `orders`

input argument with a previously estimated
linear model using the following command:

sys =estimator(data,LinModel)

This command uses the linear model `LinModel`

to determine
the order of the nonlinear model `sys`

as well as initialize
the coefficients of its linear component.

There are many options associated with an estimation algorithm that configures
the estimation objective function, initial conditions, and numerical search
algorithm, among other things of the model. For every estimation command,
* estimator*, there is a corresponding option
command named

`estimator`

`Options`

.
For example, use `nlarxOptions`

to generate the option set for
`nlarx`

. The options command returns an option set that you
then pass as an input argument to the corresponding estimation command.For example, to estimate a nonlinear ARX model with
`simulation`

as the focus and `lsqnonlin`

as the search method, use `nlarxOptions`

.

load iddata1 z1 Options = nlarxOptions('Focus','simulation','SearchMethod','lsqnonlin'); sys= nlarx(z1,[2 2 1],Options);

Information about the options used to create an estimated model is stored in
`sys.Report.OptionsUsed`

. For more information, see Estimation Report.

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