Main Content

Linear and Nonlinear Grey-Box Modeling

If you understand the physics of your system and can represent the system using ordinary differential or difference equations (ODEs) with unknown parameters, then you can use System Identification Toolbox™ commands to perform linear and nonlinear grey-box modeling. Grey-box model ODEs specify the mathematical structure of the model explicitly, including couplings between parameters. Grey-box modeling is useful when you know the relationships between variables, constraints on model behavior, or explicit equations representing system dynamics.

You can represent linear and nonlinear grey-box models using the idgrey and idnlgrey objects, respectively.

The toolbox supports both continuous-time and discrete-time linear and nonlinear models. However, because most laws of physics are expressed in continuous time, it is easier to construct models with physical insight in continuous time, rather than in discrete time.

In addition to dynamic input-output models, you can also create time-series models that have no inputs and static models that have no states.

If it is too difficult to describe your system using known physical laws, you can use the black-box modeling approach. For more information, see Linear Model Identification and Nonlinear Model Identification.

You can also use an idss model to perform structured model estimation by using its Structure property to fix or free specific parameters. However, you cannot use this approach to estimate arbitrary structures (arbitrary parameterization). For more information about structure matrices, see Estimate State-Space Models with Structured Parameterization.

Choosing idgrey or idnlgrey Model Object

Grey-box models require that you specify the structure of the ODE model in a file. You use this file to create the idgrey or idnlgrey model object. You can use both the idgrey and the idnlgrey objects to model linear systems. However, you can only represent nonlinear dynamics using the idnlgrey model object.

The idgrey object requires that you write a function to describe the linear dynamics in the state-space form, such that this file returns the state-space matrices as a function of your parameters. For more information, see Estimate Linear Grey-Box Models.

The idnlgrey object requires that you write a function or MEX-file to describe the dynamics as a set of first-order differential equations, such that this file returns the output and state derivatives as a function of time, input, state, and parameter values. For more information, see Estimate Nonlinear Grey-Box Models.

The following table compares idgrey and idnlgrey model objects.

Comparison of idgrey and idnlgrey Objects

Settings and OperationsSupported by idgrey?Supported by idnlgrey?
Set bounds on parameter values.YesYes
Handle initial states individually.YesYes
Perform linear analysis.

Yes

For example, use the bode command.

No
Honor stability constraints.

Yes

Specify constraints using the Advanced.StabilityThreshold estimation option. For more information, see greyestOptions.

No

Note

You can use parameter bounds to ensure stability of an idnlgrey model, if these bounds are known.

Estimate a disturbance model.

Yes

The disturbance model is represented by K in state-space equations.

No
Optimize estimation results for simulation or prediction.

Yes

Set the Focus estimation option to 'simulation' or 'prediction'. For more information, see greyestOptions.

No

Because idnlgrey models are Output-Error models, there is no difference between simulation and prediction results.

Data Supported by Grey-Box Models

You can estimate both continuous-time or discrete-time grey-box models for data with the following characteristics:

  • Time-domain or frequency-domain data, including time-series data with no inputs.

    Note

    Nonlinear grey-box models support only time-domain data.

  • Single-output or multiple-output data

You must first import your data into the MATLAB® workspace. You must represent your data as an iddata or idfrd object. For more information about preparing data for identification, see Data Preparation.

See Also

| |

Related Examples

More About