Quantcast

Documentation Center

  • Trial Software
  • Product Updates

nlhw

Estimate Hammerstein-Wiener model

Syntax

m = nlhw(data,[nb nf nk])
m = nlhw(data,[nb nf nk],InputNL,OutputNL)
m = nlhw(data,[nb nf nk],InputNL,OutputNL,'Name',Value)
m = nlhw(data,LinModel)
m = nlhw(data,LinModel,InputNL,OutputNL)
m = nlhw(data,LinModel,InputNL,OutputNL,'PropertyName',PropertyValue)

Description

m = nlhw(data,[nb nf nk]) creates and estimates a Hammerstein-Wiener model using piecewise linear functions as its input and output nonlinearity estimators. data is a time-domain iddata object. nb, nf, and nk are positive integers that specify the model orders and delay. nb is the number of zeros plus 1, nf is the number of poles, and nk is the input delay.

m = nlhw(data,[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 = nlhw(data,[nb nf nk],InputNL,OutputNL,'Name',Value) creates and estimates the model using options specified as idnlhw model property or idnlhw algorithm property name and value pairs. Specify Name inside single quotes.

m = nlhw(data,LinModel) creates and estimates a Hammerstein-Wiener model using 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), or transfer function model (idtf). 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 = nlhw(data,LinModel,InputNL,OutputNL) specifies input nonlinearity InputNL and output nonlinearity OutputNL.

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

Input Arguments

data

Time-domain iddata object.

nb, nf, nk

Order of the linear transfer function, 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, specified as one of the following:

  • Input-output polynomial model of Output-Error (OE) structure (idpoly)

  • State-space model with no disturbance component (idss with K = 0)

  • Transfer function model (idtf)

Typically, you estimate the model using oe, n4sid or tfest.

Examples

Estimate a Hammerstein-Wiener model:

load iddata3
m1=nlhw(z3,[4 2 1],'sigmoidnet','deadzone')
 

Estimate a Hammerstein model with saturation:

load iddata1
% Create a saturation object with lower limit of 0
% and upper limit of 5
InputNL = saturation('LinearInterval', [0 5]);
% Estimate model with no output nonlinearity
m = nlhw(z1,[2 3 0],InputNL,[]);
 

Estimate a Wiener model with a nonlinearity containing 5 sigmoid units:

load iddata1
m2 = nlhw(z1,[2 3 0],[],sigmoidnet('num', 5))
 

Estimate a Hammerstein-Wiener model with a custom network nonlinearity:

% Load data
load twotankdata;
z = iddata(y, u, 0.2, 'Name', 'Two tank system');
z1 = z(1:1000); 

% Define custom unit function and save it as gaussunit.m.
function [f, g, a] = GAUSSUNIT(x)
[f, g, a] = gaussunit(x)
f =  exp(-x.*x);
if nargout>1
  g = - 2*x.*f;
  a = 0.2;
end

% Estimate Hammerstein-Wiener model using the custom
% Gauss unit function.
H = @gaussunit;
CNetw = customnet(H);
m = nlhw(z1,[5 1 3],CNetw,[])
 

Estimate a MISO Hammerstein model with a different nonlinearity for each input:

m = nlhw(data,[nb,nf,nk],...
              [sigmoidnet;pwlinear],...
              [])
 

Refine a Hammerstein-Wiener model using successive calls of nlhw:

load iddata3
m3 = nlhw(z3,[4 2 1],'sigmoidnet','deadzone')
m3 = nlhw(z3,m3)
% Retrieves the linear block
LinearBlock = m3.LinearModel 
 

Estimate a Hammerstein-Wiener model and avoid local minima:

load iddata3
% Original model
M1 = nlhw(z3, [2 2 1], 'sigm','wave'); 
% Randomly perturbs parameters about nominal values
M1p = init(M1);	
% Estimates parameters of perturbed model
M2 = pem(z3, M1p); 
 

Estimate a regularized Hammerstein-Wiener model using a large number of units in the input-output nonlinearity functions.

load regularizationExampleData.mat nldata;
% unregularized estimate
Orders = [1 2 1];
UNL = sigmoidnet('NumberOfUnits',30);
YNL = pwlinear('Num',20);
% unregularized estimate
sys = nlhw(nldata(1:500), Orders, UNL, YNL);
% regularized estimate using Lambda = .1;
al = sys.Algorithm;
al.Regularization.Lambda = .1;
sysr = nlhw(nldata(1:500), Orders, UNL, YNL,'Algorithm',al);
compare(nldata(500:end), sys, sysr);
 

Estimate default Hammerstein-Wiener model using an input-output polynomial model of Output-Error (OE) structure:

% Estimate linear OE model.
load throttledata.mat
Tr = getTrend(ThrottleData); 
Tr.OutputOffset = 15;
DetrendedData = detrend(ThrottleData, Tr);
opt = oeOptions('Focus','simulation');
LinearModel = oe(DetrendedData,[1 2 1],opt);

% Estimate Hammerstein-Wiener model using OE model as
% its linear component and saturation as its output nonlinearity.
NonlinearModel = nlhw(ThrottleData, LinearModel, [], 'saturation') 

See Also

| | | | | | | | | | | |

Tutorials

Was this topic helpful?