| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| R2010b Documentation → System Identification Toolbox |
| Contents | Index |
| Learn more about System Identification Toolbox |
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)
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:
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.
InputNL, OutputNL |
Input and output nonlinearity estimators, respectively, specified as a nonlinearity estimator object or string representing the nonlinearity estimator type.
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:
|
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 Name | Description |
|---|---|
| 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. |
The following table summarizes the fields of the Algorithm idnlhw model properties. Algorithm is a structure that specifies the estimation-algorithm options.
| Property Name | Description |
|---|---|
| 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:
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) |
| 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. |
| MaxIter | Maximum number of iterations for the estimation algorithm,
specified as a positive integer. |
| 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. |
| SearchMethod | Method used by the iterative search algorithm.
|
| 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 %. |
| Display | Toggles displaying or hiding estimation progress information
in the MATLAB Command Window.
|
| 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. |
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 Name | Description |
|---|---|
| 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. |
| LMStartValue | (For Levenberg-Marquardt search algorithm) The starting
level of regularization when using the Levenberg-Marquardt
search method (Algorithm.SearchMethod='lm'). |
| 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. |
| 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). |
| MaxFunEvals | The iterations are stopped if the number of calls to
the model file exceeds this value. |
| MinParChange | The smallest parameter update allowed per iteration. |
| RelImprovement | The iterations are stopped if the relative improvement
of the criterion function is less than RelImprovement. |
| 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. |
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 Name | Description |
|---|---|
| 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:
|
| 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. |
This block diagram represents the structure of a Hammerstein-Wiener model:

where:
w(t) = f(u(t)) is a nonlinear function transforming input data u(t). w(t) has the same dimension as u(t).
x(t) = (B/F)w(t) is a linear transfer function. x(t) has the same dimension as y(t).
where B and F are similar to polynomials in the linear Output-Error model, as described in What Are Black-Box Polynomial Models?.
For ny outputs and nu inputs, the linear block is a transfer function matrix containing entries:
![]()
where j = 1,2,...,ny and i = 1,2,...,nu.
y(t) = h(x(t)) is a nonlinear function that maps the output of the linear block to the system output.
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:
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.
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.
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.
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.
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 15Create 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', [])
customnet | linear | linearize(idnlhw) | nlhw | pem | poly1d | saturation | saturation | sigmoidnet | wavenet

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |