Products & Services Solutions Academia Support User Community Company

Learn more about System Identification Toolbox   

idnlhw - Nonlinear black-box Hammerstein-Wiener model

Syntax

m = idnlhw([nb nf nk])
m = idnlhw([nb nf nk],InputNL,OutputNL)
m = idnlhw([nb nf nk],InputNL,OutputNL,'PropertyName',PropertyValue)

Description

Represents Hammerstein-Wiener models, including model structure and parameter values.

Typically, you use the nlhw command to both construct the idnlhw object and estimate the model parameters. You can configure the model properties directly in the nlhw syntax. For information about the Hammerstein-Wiener model structure, see Structure of Hammerstein-Wiener Models.

You can also use the idnlhw constructor to create the Hammerstein-Wiener model structure, and then estimate the parameters of this model using pem.

The idnlhw object has idnlhw Properties, including:

Construction

m = idnlhw([nb nf nk]) creates an idnlhw object with orders nb, nf, and nk, specified as positive integers. nb is the number of zeros plus 1, nf is the number of poles, and nk is the input delay. By default, both the input and output nonlinearity estimators are piecewise linear functions (see pwlinear). For nu inputs and ny outputs, nb, nf and, nk are ny-by-nu matrices whose i-jth entry specifies the orders and delay of the transfer function from the jth input to the ith output.

m = idnlhw([nb nf nk],InputNL,OutputNL) creates an idnlhw object with specified input nonlinearity InputNL and output nonlinearity OutputNL, where InputNL and OutputNL can be a strings or objects. To use nonlinearity estimators with default settings, specify InputNL and OutputNL using strings (such as 'wave' for wavelet network or 'sig' for sigmoid network). If you need to configure the properties of a nonlinearity estimator, use its object representation. For supported nonlinearities, see Nonlinearity Estimators for Hammerstein-Wiener Models.

m = idnlhw([nb nf nk],InputNL,OutputNL,'PropertyName',PropertyValue) creates an idnlhw object using options specified as idnlhw property name and value pairs.

idnlhw Properties

After creating the object, you can use get or dot notation to access the object property values. For example:

% Get the model B parameters
get(m,'b')
% Get value of InputNonlinearity property
m.InputNonlinearity

You can specify property name-value pairs in the model estimator or constructor to specify the model structure and estimation algorithm.

The following table summarizes idnlhw model properties. The general idnlmodel properties also apply to this nonlinear model object (see the corresponding reference page).

Property NameDescription
Algorithm

A structure that specifies the estimation algorithm options, as described in idnlhw Algorithm Properties.

b

B polynomial as a cell array of Ny-by-Nu elements, where Ny is the number of outputs and Nu is the number of inputs. An element b{i,j} is a row vector representing the numerator polynomial for the j:th input to ith output transfer function. It contains as many leading zeros as there are input delays.

f

F polynomial as a cell array of Ny-by-Nu elements, where Ny is the number of outputs and Nu is the number of inputs. An element f{i,j} is a row vector representing the denominator polynomial for the j:th input to ith output transfer function.

LinearModel

(Read only) The linear model in the linear block. For single output, represented as an idpoly object. For multiple output, represented as an idss object.

EstimationInfo

(Read-only) Structure that stores estimation settings and results, as described in idnlhw EstimationInfo Properties.

InputNonlinearity

Nonlinearity estimator object. Assignable values include pwlinear (default), deadzone, wavenet, saturation, customnet, sigmoidnet, poly1d, and unitgain. For more information, see the corresponding reference pages.

For ny outputs, Nonlinearity is an ny-by-1 array, such as [sigmoidnet;wavenet]. However, if you specify a scalar object, this nonlinearity object applies to all outputs.

OutputNonlinearity

Same as InputNonlinearity.

nb
nf
nk

Model orders and input delays, where nb is the number of zeros plus 1, nf is the number of poles, and nk is the delay from input to output in terms of the number of samples.

For nu inputs and ny outputs, nb, nf and, nk are ny-by-nu matrices whose i-jth entry specifies the orders and delay of the transfer function from the jth input to the ith output.

idnlhw Algorithm Properties

The following table summarizes the fields of the Algorithm idnlhw model properties. Algorithm is a structure that specifies the estimation-algorithm options.

Property NameDescription
Advanced

A structure that specifies additional estimation algorithm options, as described in idnlhw Advanced Algorithm Properties.

Criterion

The search method of lsqnonlin supports the Trace criterion only.

Use for multiple-output models only. Criterion can have the following values:

  • 'Det': Minimize det(E'*E), where E represents the prediction error. This is the optimal choice in a statistical sense and leads to the maximum likelihood estimates in case nothing is known about the variance of the noise. It uses the inverse of the estimated noise variance as the weighting function. This is the default criterion used for all models, except idnlgrey which uses 'Trace' by default.

  • 'Trace': Minimize the trace of the weighted prediction error matrix trace(E'*E*W), where E is the matrix of prediction errors, with one column for each output, and W is a positive semi-definite symmetric matrix of size equal to the number of outputs. By default, W is an identity matrix of size equal to the number of model outputs (so the minimization criterion becomes trace(E'*E), or the traditional least-squares criterion). You can specify the relative weighting of prediction errors for each output using the Weighting field of the Algorithm property. If the model contains neuralnet or treepartition as one of its nonlinearity estimators, weighting is not applied because estimations are independent for each output.

Both the Det and Trace criteria are derived from a general requirement of minimizing a weighted sum of least squares of prediction errors. Det can be interpreted as estimating the covariance matrix of the noise source and using the inverse of that matrix as the weighting. You should specify the weighting when using the Trace criterion.

If you want to achieve better accuracy for a particular channel in MIMO models, use Trace with weighting that favors that channel. Otherwise, use Det. If you use Det, check cond(model.NoiseVariance) after estimation. If the matrix is ill-conditioned, try using the Trace criterion. You can also use compare on validation data to check whether the relative error for different channels corresponds to your needs or expectations. Use the Trace criterion if you need to modify the relative errors, and check model.NoiseVariance to determine what weighting modifications to specify.

IterWavenet

(For wavenet nonlinear estimator only)
Implicitly set to perform iterative estimation. Changing this setting does not impact the algorithm.
Default: 'On'.

LimitError

Robustification criterion that limits the influence of large residuals, specified as a positive real value. Residual values that are larger than 'LimitError' times the estimated residual standard deviation have a linear cost instead of the usual quadratic cost.
Default: 0 (no robustification).

MaxIter

Maximum number of iterations for the estimation algorithm, specified as a positive integer.
Default: 20.

MaxSize

The number of elements (size) of the largest matrix to be formed by the algorithm. Computational loops are used for larger matrices. Use this value for memory/speed trade-off.
MaxSize can be any positive integer. Default: 250000.

    Note   The original data matrix of u and y must be smaller than MaxSize.

SearchMethod

Method used by the iterative search algorithm.
Assignable values:

  • 'Auto' — Automatically chooses from the following methods.

  • 'gn' — Gauss-Newton method.

  • 'gna' — Adaptive Gauss-Newton method.

  • 'grad' — A gradient method.

  • 'lm' — Levenberg-Marquardt method.

  • 'lsqnonlin' — Nonlinear least-squares method (requires the Optimization Toolbox product). This method handles only the 'Trace' criterion.

Tolerance

Specifies to terminate the iterative search when the expected improvement of the parameter values is less than Tolerance, specified as a positive real value in %.
Default: 0.01.

Display

Toggles displaying or hiding estimation progress information in the MATLAB Command Window.
Default: 'Off'.
Assignable values:

  • 'Off' — Hide estimation information.

  • 'On' — Display estimation information.

Weighting

Positive semi-definite matrix W used for weighted trace minimization. When Criterion = 'Trace', trace(E'*E*W) is minimized. Weighting can be used to specify relative importance of outputs in multiple-input multiple-output models (or reliability of corresponding data) when W is a diagonal matrix of nonnegative values. Weighting is not useful in single-output models. By default, Weighting is an identity matrix of size equal to the number of outputs.

idnlhw Advanced Algorithm Properties

The following table summarizes the fields of the Algorithm.Advanced model properties. The fields in the Algorithm.Advanced structure specify additional estimation-algorithm options.

Property NameDescription
GnPinvConst

When the search direction is computed, the algorithm discards the singular values of the Jacobian that are smaller than GnPinvConst*max(size(J))*norm(J)*eps. Singular values that are closer to 0 are included when GnPinvConst is decreased.
Default: 1e4.
Assign a positive, real value.

LMStartValue

(For Levenberg-Marquardt search algorithm) The starting level of regularization when using the Levenberg-Marquardt search method (Algorithm.SearchMethod='lm').
Default: 0.001.
Assign a positive real value.

LMStep

(For Levenberg-Marquardt search algorithm) Try this next level of regularization to get a lower value of the criterion function. The level of regularization is LMStep times the previous level. At the start of a new iteration, the level of regularization is computed as 1/LMStep times the value from the previous iteration.
Default: 10.
Assign a real value >1.

MaxBisections

Maximum number of bisections performed by the line search algorithm along the search direction (number of rotations of search vector for 'lm'). Used by 'gn', 'lm', 'gna' and 'grad' search methods (Algorithm.SearchMethod property).
Default: 10.
Assign a positive integer value.

MaxFunEvals

The iterations are stopped if the number of calls to the model file exceeds this value.
Default: Inf.
Assign a positive integer value.

MinParChange

The smallest parameter update allowed per iteration.
Default: 1e-16.
Assign a positive, real value.

RelImprovement

The iterations are stopped if the relative improvement of the criterion function is less than RelImprovement.
Default: 0.
Assign a positive real value.

    Note   This does not apply when Algorithm.SearchMethod='lsqnonlin'.

StepReduction

(For line search algorithm) The suggested parameter update is reduced by the factor 'StepReduction' after each try until either 'MaxBisections' tries are completed or a lower value of the criterion function is obtained.
Default: 2.
Assign a positive, real value >1.

    Note   This does not apply when Algorithm.SearchMethod='lsqnonlin'.

idnlhw EstimationInfo Properties

The following table summarizes the fields of the EstimationInfo model properties. The read-only fields of the EstimationInfo structure store estimation settings and results.

Property NameDescription
Status

Shows whether the model parameters were estimated.

Method

Shows the estimation method.

LossFcn

Value of the loss function, equal to det(E'*E/N), where E is the residual error matrix (one column for each output) and N is the total number of samples.

FPE

Value of Akaike's Final Prediction Error (see fpe).

DataName

Name of the data from which the model is estimated.

DataLength

Length of the estimation data.

DataTs

Sampling interval of the estimation data.

DataDomain

'Time' means time domain data. 'Frequency' is not supported.

DataInterSample

Intersample behavior of the input estimation data used for interpolation:

  • 'zoh' means zero-order-hold, or piecewise constant.

  • 'foh' means first-order-hold, or piecewise linear.

WhyStop

Reason for terminating parameter estimation iterations.

UpdateNorm

Norm of the search vector (gn-vector) in the last iteration. Empty when 'lsqnonlin' is the search method.

LastImprovement

Criterion improvement in the last iteration, shown in %. Empty when 'lsqnonlin' is the search method.

Iterations

Number of iterations performed by the estimation algorithm.

Warning

Any warnings encountered during parameter estimation.

InitRandState

The value of randn('state') at the last randomization of the initial parameter vector.

EstimationTime

Duration of the estimation.

Definitions

Hammerstein-Wiener Model Structure

This block diagram represents the structure of a Hammerstein-Wiener model:

where:

w(t) and x(t) are internal variables that define the input and output of the linear block, respectively.

Because f acts on the input port of the linear block, this function is called the input nonlinearity. Similarly, because h acts on the output port of the linear block, this function is called the output nonlinearity. If system contains several inputs and outputs, you must define the functions f and h for each input and output signal.

You do not have to include both the input and the output nonlinearity in the model structure. When a model contains only the input nonlinearity f, it is called a Hammerstein model. Similarly, when the model contains only the output nonlinearity h), it is called a Wiener model.

The nonlinearities f and h are scalar functions, one nonlinearity for each input and output channel.

The Hammerstein-Wiener model computes the output y in three stages:

  1. Computes w(t) = f(u(t)) from the input data.

    w(t) is an input to the linear transfer function B/F.

    The input nonlinearity is a static (memoryless) function, where the value of the output a given time t depends only on the input value at time t.

    You can configure the input nonlinearity as a sigmoid network, wavelet network, saturation, dead zone, piecewise linear function, one-dimensional polynomial, or a custom network. You can also remove the input nonlinearity.

  2. Computes the output of the linear block using w(t) and initial conditions: x(t) = (B/F)w(t).

    You can configure the linear block by specifying the numerator B and denominator F orders.

  3. Compute the model output by transforming the output of the linear block x(t) using the nonlinear function h: y(t) = h(x(t)).

    Similar to the input nonlinearity, the output nonlinearity is a static function. Configure the output nonlinearity in the same way as the input nonlinearity. You can also remove the output nonlinearity, such that y(t) = x(t).

Resulting models are idnlhw objects that store all model data, including model parameters and nonlinearity estimator. See the idnlhw reference page for more information.

idnlhw States

This toolbox requires states for simulation and prediction using sim(idnlhw), predict(idnlhw), and compare. States are also necessary for linearization of nonlinear ARX models using linearize(idnlhw). This toolbox provides a number of options to facilitate how you specify the initial states. For example, you can use findstates and data2state to automatically search for state values in simulation and prediction applications. For linearization, use findop. You can also specify the states manually.

The states of the Hammerstein-Wiener model correspond to the states of the linear block in the Hammerstein-Wiener model structure:

The linear block contains all the dynamic elements of the model. If this linear model is not a state-space structure, the states are defined as those of model Mss, where Mss = idss(Model.LinearModel) and Model is the idnlhw object.

Examples

Create default Hammerstein-Wiener model structure:

  m = idnlhw([2 2 1]) % na=nb=2 and nk=1
% m has piecewise linear input and output nonlinearity
 

Create nonlinear ARX model structure with sigmoid network nonlinearity:

m=idnlarx([2 3 1],sigmoidnet('Num',15))
% number of units is 15
 

Create Hammerstein-Wiener model with specific input-output nonlinearities:

  m=idnlhw([2 2 1],'sigmoidnet','deadzone')
% Equivalent to m=idnlhw([2 2 1],'sig','dead')
% Nonlinearities have default configuration
 

Create Hammerstein-Wiener model and configure the nonlinearity objects:

m=idnlhw([2 2 1],sigmoidnet('num',5),deadzone([-1,2]))
 

Create a Hammerstein model (no output nonlinearity):

m=idnlhw([2 2 1],'saturation',[])
% [] specifies unitgain output nonlinearity
 

Configure the Hammerstein-Wiener model and estimate models parameters:

m0 = idnlhw([nb,nf,nk],[sigmoidnet;pwlinear],[]);
m = pem(data,m0); % equivalent to m=nlhw(data,m0)

See Also

customnet | linear | linearize(idnlhw) | nlhw | pem | poly1d | saturation | saturation | sigmoidnet | wavenet

Tutorials

How To

  


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