Products & Services Solutions Academia Support User Community Company

Learn more about System Identification Toolbox   

idnlhw - 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)
m = idnlhw(LinModel)
m = idnlhw(LinModel,InputNL,OutputNL)
m = idnlhw(LinModel,InputNL,OutputNL,'PropertyName',PropertyValue)

Description

Represents Hammerstein-Wiener models. The Hammerstein-Wiener structure represents a linear model with input-output nonlinearities.

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.

For idnlhw object properties, see:

Construction

m = idnlhw([nb nf nk]) creates an idnlhw object using default piecewise linear functions for the input and output nonlinearity estimators. nb, nf, and nk are positive integers that specify model orders and delays. nb is the number of zeros plus 1, nf is the number of poles, and nk is the input delay.

m = idnlhw([nb nf nk],InputNL,OutputNL) specifies input nonlinearity InputNL and output nonlinearity OutputNL, as a nonlinearity estimator object or string representing the nonlinearity estimator type.

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

m = idnlhw(LinModel) uses a linear model (in place of [nb nf nk]) and default piecewise linear functions for the input and output nonlinearity estimators. LinModel is a discrete time input-output polynomial model of Output-Error (OE) structure (idpoly) or state-space model with no disturbance component (idss with K = 0) for single-output systems, and idss model with K = 0 for multi-output systems. LinModel sets the model orders, input delay, B and F polynomial values, input-output names and units, sampling time, and time units of m.

m = idnlhw(LinModel,InputNL,OutputNL) specifies input nonlinearity InputNL and output nonlinearity OutputNL.

m = idnlhw(LinModel,InputNL,OutputNL,'PropertyName',PropertyValue) creates the object using options specified as idnlhw property name and value pairs.

Input Arguments

nb, nf, nk

Model orders and input delay, where nb is the number of zeros plus 1, nf is the number of poles, and nk is the input delay.

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.

InputNL, OutputNL

Input and output nonlinearity estimators, respectively, specified as a nonlinearity estimator object or string representing the nonlinearity estimator type.

'pwlinear' or pwlinear object (default)Piecewise linear function
'sigmoidnet' or sigmoidnet objectSigmoid network
'wavenet' or wavenet objectWavelet network
'saturation' or saturation objectSaturation
'deadzone' or deadzone objectDead zone
'poly1d' or poly1d objectOne-dimensional polynomial
'unitgain' or unitgain objectUnit gain
customnet objectCustom network

Specifying a string creates a nonlinearity estimator object with default settings. Use object representation to configure the properties of a nonlinearity estimator.

For ny output channels, you can specify nonlinear estimators individually for each output channel by setting InputNL or OutputNL to an ny-by-1 cell array or object array of nonlinearity estimators. To specify the same nonlinearity for all outputs, specify a single input and output nonlinearity estimator.

LinModel

Discrete time linear model, typically estimated using the oe or n4sid command:

  • Input-output polynomial model of Output-Error (OE) structure (idpoly) or state-space model with no disturbance component (idss with K = 0), for single-output systems

  • State-space model with no disturbance component (idss model with K = 0), for multi-output systems

idnlhw Model 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 jth 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 random number type and seed 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 nonlinear function 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)
 

Construct default Hammerstein-Wiener model using an input-output polynomial model of Output-Error structure:

% Construct an input-output polynomial model of OE structure.
B = [0.8 1];
F = [1 -1.2 0.5];
LinearModel = idpoly(1, B, 1,1, F, 'Ts', 0.1);

% Construct Hammerstein-Wiener model using OE model
% as its linear component.
m1 = idnlhw(LinearModel, 'saturation', [])

See Also

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

Tutorials

How To

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS