Products & Services Solutions Academia Support User Community Company

Learn more about System Identification Toolbox   

Estimating Nonlinear Grey-Box Models

Supported Nonlinear Grey-Box Models

You can estimate nonlinear discrete-time and continuous-time grey-box models for arbitrary nonlinear ordinary differential equations using single-output and multiple-output time-domain data, or output-only time-series data. Your grey-box models can be static or dynamic.

Grey-box models describe the system behavior as a set of nonlinear ordinary differential or difference equations (ODEs) with unknown parameters.

Nonlinear Grey-Box Demos and Examples

The System Identification Toolbox product provides several demos and case studies on creating, manipulating, and estimating nonlinear grey-box models. You can access these demos by typing the following command at the prompt:

iddemo

For examples of M-files and MEX-files that specify model structure, see the toolbox/ident/iddemos/examples directory. For example, the model of a DC motor—used in the demo idnlgreydemo1—is described in files dcmotor_m and dcmotor_c.

Specifying the Nonlinear Grey-Box Model Structure

You must represent your system as a set of first-order nonlinear difference or differential equations:

where for continuous-time representation and for discrete-time representation with Ts as the sampling interval. F and H are arbitrary linear or nonlinear functions with Nx and Ny components, respectively. Nx is the number of states and Ny is the number of outputs.

After you establish the equations for your system, create an M-file or MEX-file. MEX-files, which can be created in C or Fortran, are dynamically linked subroutines that can be loaded and executed by the MATLAB interpreter. For more information about MEX-files, see the MATLAB documentation.

The purpose of the model file is to return the state derivatives and model outputs as a function of time, states, inputs, and model parameters, as follows:

[dx,y] = MODFILENAME(t,x,u,p1,p2, ...,pN,FileArgument)

The output variables are:

The file inputs are:

For an example of creating grey-box model files and idnlgrey model object, see the demo Creating idnlgrey Model Files.

Constructing the idnlgrey Object

After you create the M-file or MEX-file with your model structure, you must define an idnlgrey object. This object shares many of the properties of the linear idgrey model object.

Use the following syntax to define the idnlgrey model object:

m = idnlgrey('filename',Order,Parameters,InitialStates)

The idnlgrey arguments are defined as follows:

For detailed information about this object and its properties, see the idnlgrey reference page.

Use pem to estimate your grey-box model.

Using pem to Estimate Nonlinear Grey-Box Models

You can use the pem command to estimate the unknown idnlgrey model parameters and initial states using measured data.

The input-output dimensions of the data must be compatible with the input and output orders you specified for the idnlgrey model.

Use the following general estimation syntax:

m = pem(data,m)

where data is the estimation data and m is the idnlgrey model object you constructed.

You can pass additional property-value pairs to pem to specify the properties of the model or the estimation algorithm. Assignable properties include the ones returned by the get(idnlgrey) command and the algorithm properties returned by the get(idnlgrey, 'Algorithm'), such as MaxIter and Tolerance. For detailed information about these model properties, see the idnlgrey reference page.

For more information about validating your models, see Model Analysis.

Options for the Estimation Algorithm

The Algorithm property of the model specifies the estimation algorithm, which simulates the model several times by trying various parameter values to reduce the prediction error.

The following algorithm properties can affect the quality of the results:

For detailed information about these and other model properties, see the idnlgrey reference page.

Simulation Method

You can specify the simulation method using the SimulationOptions (struct) fields of the model Algorithm property.

System Identification Toolbox software provides several variable-step and fixed-step solvers for simulating idnlgrey models. To view a list of available solvers and their properties, type the following command at the prompt:

idprops idnlgrey algorithm.simulationoptions

For discrete-time systems, the default solver is 'FixedStepDiscrete'. For continuous-time systems, the default solver is 'ode45'.

By default, SimulationOptions.Solver is set to 'Auto', which automatically selects either 'ode45' or 'FixedStepDiscrete' during estimation and simulation—depending on whether the system is continuous or discrete in time.

Search Method

You can specify the search method for estimating model parameters using the SearchMethod field of the Algorithm property. Two categories of methods are available for nonlinear grey-box modeling.

One category of methods consists of the minimization schemes that are based on line-search methods, including Gauss-Newton type methods, steepest-descent methods, and Levenberg-Marquardt methods.

The Trust-Region Reflective Newton method of nonlinear least-squares (lsqnonlin), where the cost is the sum of squares of errors between the measured and simulated outputs, requires Optimization Toolbox™ software. When the parameter bounds differ from the default +/- Inf, this search method handles the bounds better than the schemes based on a line search. However, unlike the line-search-based methods, lsqnonlin only works with Criterion='Trace'.

By default, SearchMethod is set to Auto, which automatically selects a method from the available minimizers. If the Optimization Toolbox product is installed, SearchMethod is set to 'lsqnonlin'. Otherwise, SearchMethod is a combination of line-search based schemes.

Gradient Options

You can specify the method for calculating gradients using the GradientOptions field of the Algorithm property. Gradients are the derivatives of errors with respect to unknown parameters and initial states.

Gradients are calculated by numerically perturbing unknown quantities and measuring their effects on the simulation error.

Option for gradient computation include the choice of the differencing scheme (forward, backward or central), the size of minimum perturbation of the unknown quantities, and whether the gradients are calculated simultaneously or individually.

Example – Specifying Algorithm Properties

You can specify the Algorithm fields directly in the estimation syntax, as property-value pairs.

For example, you can specify the following properties as part of the pem syntax:

m = pem(data,init_model,'Search','gn',...
                        'MaxIter',5,...
                        'Display','On')
  


Recommended Products

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