主要内容

Estimate Hammerstein-Wiener Models at the Command Line

You can estimate Hammerstein-Wiener models after performing the following tasks:

Estimate Model Usingnlhw

Usenlhw至both construct and estimate a Hammerstein-Wiener model. After each estimation,验证模型by comparing it to other models and simulating or predicting the model response.

basic Estimation

从最简单的估计开始m = nlhw(数据,[nb nf nk])。佛r example:

loadiddata3;%nb = nf = 2,nk = 1M = NLHW(Z3,[2 2 1])
m= Hammerstein-Wiener model with 1 output and 1 input Linear transfer function corresponding to the orders nb = 2, nf = 2, nk = 1 Input nonlinearity: Piecewise linear with 10 break-points Output nonlinearity: Piecewise linear with 10 break-points Sample time: 1 seconds Status: Estimated using NLHW on time domain data "z3". Fit to estimation data: 75.31% FPE: 2.019, MSE: 1.472

The second input argument [nbnfnk] sets the order of the linear transfer function, wherenbis the number of zeros plus 1,nfis the number of poles, andnkis the input delay. By default, both the input and output nonlinearity estimators are piecewise linear functions (see theiDpieCewiselIrinearreference page).mis anidnlhwobject.

对于MIMO系统,nb,,,,nf,nkny-by-nu矩阵。看到nlhwreference page for more information about MIMO estimation.

配置非线性估计器

您可以指定与默认分段线性估计器不同的非线性估计器。

m= nlhw(data,[nb,nf,nk],InputNL,OutputNL)

InputNLandoutputnl是非线性估计器对象。如果您的输入信号是二进制的,请设置InputNLidunitgain

To use nonlinearity estimators with default settings, specifyInputNLandoutputnl使用constructors with no input arguments or their names as character vectors (such as 'idWaveletNetwork' for wavelet network or 'idSigmoidNetwork' for sigmoid network).

loadiddata3;M = NLHW(Z3,[2 2 1],,'idSigmoidNetwork',,,,'idDeadZone');

如果您需要配置非线性估计器的属性,请使用其对象表示。例如,估计使用饱和度作为其输入的非线性和一维多项式的hammerstein-Wiener模型作为其输出非线性:

M = NLHW(Z3,[2 2 1],,“ idsaty”,,,,idPolynomial1D(3));

The third input“ idsaty”用默认属性值指定饱和非线性。idPolynomial1D(3)创建一个度量3的一维多项式对象。当然,您可以直接使用构造函数IDS饱和代替字符矢量“ IDSaturation”。

佛r MIMO models, specify the nonlinearities using objects, or cell array of character vectors representing the nonlinearity names. If single name (character vector) used, the same value is applied to all the channels.

This table summarizes values that specify the nonlinearity estimators.

非线性 Value (Default Nonlinearity Configuration) 班级
分段线性
(default)
'iDpieceWiselinear' iDpieCewiselIrinear
One layer sigmoid network 'idSigmoidNetwork' idSigmoidNetwork
Wavelet network 'idWaveletNetwork' idwaveletnetwork
Saturation “ idsaty” idSaturation
盲区 'idDeadZone' idDeadZone
一-
dimensional polynomial
'idPolynomial1D' idPolynomial1D
Unit gain 'iDunitgain'or[ ] idunitgain

其他可用的非线性包括您创建的自定义网络。通过定义称为称为的函数来指定自定义网络Gaussunit.m,如在idCustomNetwork参考页。定义自定义网络对象cnetw作为:

cnetw = idcustomnetwork(@gaussunit);M = NLHW(Z3,[2 2 1],,“ idsaty”,cnetw);

佛r more information, seeHammerstein-Wiener模型的可用非线性估计器

Exclude Input or Output Nonlinearity

通过指定特定通道的非线性idunitgainvalue for theinputnonlinearityorouttufnoninearityproperties.

如果the input signal is binary, setInputNLidunitgain

佛r more information about model estimation and properties, see thenlhwandidnlhw参考页。

佛r a description of each nonlinearity estimator, seeHammerstein-Wiener模型的可用非线性估计器

Iteratively Refine Model

估计Hammerstein-Wiener模型,然后使用nlhw命令迭代完善模型。

loadiddata3;m1 = nlhw(z3,[2 2 1],idSigmoidNetwork, idWaveletNetwork); m2 = nlhw(z3,m1);

Alternatively, usepem完善模型。

M2 = PEM(Z3,M1);

检查搜索终止标准M.Report.thystop。如果WhyStop表示估计达到最大迭代次数,尝试重复估算,并可能指定更大的值MaxIterations

从模型开始运行30次迭代m1

选择= nlhwOptions;opt.SearchOptions.MaxIterations= 30; m2 = nlhw(z3,m1,opt);

When theM.Report.thystopvalue is近(本地)最小值(norm(g)or线路搜索没有沿搜索方向的改进,验证您的模型以查看此模型是否适合数据。如果没有,该解决方案可能会卡在成本功能表面的局部最低限度中。尝试调整SearchOptions.Toleranceor theSearchMethod选项nlhwoption set, and repeat the estimation.

您也可以尝试使用使用init,然后使用nlhw命令。

Randomly perturb parameters of original modelm1about nominal values.

m1p = init(m1);

Estimate the parameters of perturbed model.

M2 = NLHW(Z3,M1P);

Note that usinginitdoes not guarantee a better solution on further refinement.

使用初始状态提高估计结果

如果your estimated Hammerstein-Wiener model provides a poor fit to measured data, you can repeat the estimation using the initial state values estimated from the data. By default, the initial states corresponding to the linear block of the Hammerstein-Wiener model are zero.

To specify estimating initial states during model estimation:

loadiddata3;opt = nlhwOptions('InitialCondition',,,,'estimate');m = nlhw(z3,[2 2 1],idsigmoidnetwork,[],opt);

故障排除估计

如果you do not get a satisfactory model after many trials with various model structures and estimation options, it is possible that the data is poor. For example, your data might be missing important input or output variables and does not sufficiently cover all the operating points of the system.

Nonlinear black-box system identification usually requires more data than linear model identification to gain enough information about the system. See alsoTroubleshooting Model Estimation

估计多个Hammerstein-Wiener模型

This example shows how to estimate and compare multiple Hammerstein-Wiener models using measured input-output data.

Load estimation and validation data.

loadtwotankdataz = iddata(y,u,0.2); ze = z(1:1000); zv = z(1001:3000);

使用估计数据估算几个模型ze以及不同的模型订单,延迟和非线性设置。

m1 = nlhw(ze,[2 3 1]); m2 = nlhw(ze,[2 2 3]); m3 = nlhw(ze,[2 2 3],idPiecewiseLinear('单位数量',13),iDpieceWiselinear('单位数量',10);m4 = nlhw(ze,[2 2 3],idsigmoidnetwork('单位数量',2),iDpieceWiselinear('单位数量',10);

An alternative way to perform the estimation is to configure the model structure first usingidnlhw,then estimate the model.

m5 = idnlhw([2 2 3],idDeadZone,idSaturation); m5 = nlhw(ze,m5);

通过绘制模型输出和验证数据中的测量输出来比较结果模型zv

比较(ZV,M1,M2,M3,M4,M5)

图包含一个轴对象。轴对象包含6个类型行的对象。这些对象代表ZV(Y1),M1:28.28%,M2:13.16%,M3:-9.498%,M4:62.21%,M5:35.13%。

使用Hammerstein-Wiener结构改善线性模型

This example shows how to use the Hammerstein-Wiener model structure to improve a previously estimated linear model.

After estimating the linear model, insert it into the Hammerstein-Wiener structure that includes input or output nonlinearities.

Estimate a linear model.

loadiddata1LM = arx(z1,[2 2 1]);

从线性模型中提取传输函数系数。

[num,den] = tfdata(lm);

Create a Hammerstein-Wiener model, where you initialize the linear block propertiesbandF使用NumandDen, 分别。

nb = 1;%通常,NB =一个(NY,NU)%ny是输出的数量,nu是输入的数量nf =注;nk = 0;%通常,NK =零(NY,NU)%ny是输出的数量,nu是输入的数量m = idnlhw([[nb nf nk],[],,,'iDpieceWiselinear');M.B = Num; M.F = Den;

估计模型系数,该系数完善了线性模型系数NumandDen

M = nlhw(z1,M);

Compare responses of linear and nonlinear model against measured data.

compare(z1,LM,M);

图包含一个轴对象。The axes object contains 3 objects of type line. These objects represent z1 (y1), LM: 54.22%, M: 70.56%.

Related Topics