# wavenet

Create a wavelet network nonlinearity estimator object

## Syntax

```NL = wavenet NL = wavenet(Name,Value) ```

## Description

`NL = wavenet` creates a default wavelet network nonlinearity estimator object for estimating nonlinear ARX and Hammerstein-Wiener models. Use dot notation to customize the object properties, if needed.

`NL = wavenet(Name,Value)` creates a wavelet network nonlinearity estimator object with properties specified by one or more `Name,Value` pair arguments. The properties that you do not specify retain their default value.

## Object Description

`wavenet` is an object that stores the wavelet network nonlinearity estimator for estimating nonlinear ARX and Hammerstein-Wiener models.

Use `wavenet` to define a nonlinear function $y=F\left(x,\theta \right)$, where y is scalar, x is an `m`-dimensional row vector of regressors, and θ represent the parameters in wavelet expansion. The wavelet network function is based on the following function expansion:

`$f\left(z\right)={e}^{-0.5z{z}^{T}}$`

Here,

• f(z) is a radial function called the scaling function, and z is the input to the scaling function. z is a 1-by-q row vector. q is the number of components of `x` used in the scaling and wavelet functions.

• g(z) is a radial function called the wavelet function, and z is the input to the wavelet function.

• θ represents the following parameters of the nonlinearity estimator:

• P and Q — Projection matrices of size `m`-by-`p` and `m`-by-`q`, respectively.

P and Q are determined by principal component analysis of estimation data. Usually, ```p = m```. If the components of x in the estimation data are linearly dependent, then `p<m`. The number of columns of Q is `q`. `q` is the number of components of x used in the scaling and wavelet function.

When used in a nonlinear ARX model, `q` is equal to the size of the `NonlinearRegressors` property of the `idnlarx` object. When used in a Hammerstein-Wiener model, `m=q=1` and Q is a scalar.

• r – Mean value of the regressor vector computed from estimation data, specified as a 1-by-`m` vector.

• as, bs, aw, and bw — Scaling and wavelet parameters, specified as scalars. Parameters with the s subscript are scaling parameters, and parameters with the w subscript are wavelet parameters.

• L — Specified as a `p`-by-1 vector.

• cs and cw – Specified as a 1-by-`q` vectors.

• d — Output offset, specified as a scalar.

The value `F(x)` is computed by `evaluate(NL,x)`, where `NL` is the wavenet object.

For `wavenet` object properties, see Properties.

## Examples

collapse all

`NL = wavenet;`

Exclude the linear term from the wavelet expansion.

`NL.LinearTerm = 'off';`

`load twotankdata;`

Create an `iddata` object from the estimation data.

`z = iddata(y,u,0.2);`

Create a wavelet network nonlinearity estimator with 5 units.

`NL = wavenet('NumberOfUnits',5);`

Estimate the nonlinear ARX model.

`sys = nlarx(z,[4 4 1],NL);`

`load motorizedcamera;`

Create an `iddata` object.

`z = iddata(y,u,0.02,'Name','Motorized Camera','TimeUnit','s');`

`z` is an `iddata` object with 6 inputs and 2 outputs.

Specify the model orders.

`Orders = [ones(2,2),2*ones(2,6),ones(2,6)];`

Specify different nonlinearity estimators for each output channel.

`NL = [wavenet('NumberOfUnits',2),linear];`

Estimate the nonlinear ARX model.

`sys = nlarx(z,Orders,NL);`

`load motorizedcamera;`

Create an `iddata` object.

`z = iddata(y,u,0.02,'Name','Motorized Camera','TimeUnit','s');`

`z` is an `iddata` object with 6 inputs and 2 outputs.

Specify the model orders and delays.

`Orders = [ones(2,6),ones(2,6),ones(2,6)];`

Specify the same nonlinearity estimator for each input channel.

`InputNL = saturation;`

Specify different nonlinearity estimators for each output channel.

` OutputNL = [deadzone,wavenet];`

Estimate the Hammerstein-Wiener model.

`sys = nlhw(z,Orders,InputNL,OutputNL);`

To see the shape of the estimated input and output nonlinearities, plot the nonlinearities.

`plot(sys)`

Click on the input and output nonlinearity blocks on the top of the plot to see the nonlinearities.

## Input Arguments

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Use `Name,Value` arguments to specify additional properties of `wavenet` nonlinearity. For example, `NL= wavenet('NumberofUnits',5)` creates a wavelet nonlinearity estimator object with five nonlinearity units in wavelet expansion.

## Properties

`NumberofUnits`

Number of nonlinearity units in wavelet expansion, specified as a positive integer or one of the following values:

• `'Auto'` — The number of units are automatically determined from estimation data.

• `'Interactive'` — The number of units are determined during model estimation.

Default: `'Auto'`

`LinearTerm`

Inclusion of linear term, specified as one of the following values:

• `'on'` — The linear term, $\left(x-r\right)PL$, is included in the wavelet expansion.

• `'off'` — The linear term in not included in the wavelet expansion.

Default: `'on'`

`Parameters`

Parameters in wavelet expansion, specified as a structure with the following fields:

Field NameDescriptionDefault
`RegressorMean`

Means of the regressors, r, specified as a 1-by-m vector. m is the number of regressors, x.

For Hammerstein-Wiener models, m = 1.

`[]`
`NonLinearSubspace`

Projection matrix, Q, specified as an m-by-q matrix.

`[]`
`LinearSubspace`

Projection matrix, P, specified as an m-by-p matrix.

`[]`
`LinearCoef`

Linear coefficients, L, specified as a p-by-1 vector.

`[]`
`ScalingDilation`

Scaling function dilation, bs_ns, specified as an ns-by-1 matrix.

`[]`
`WaveletDilation`

Wavelet function dilation, bw_nw, specified as an nw-by-1 matrix.

`[]`
`ScalingTranslation`

Scaling function translation, cs_ns, specified as an ns-by-q matrix.

`[]`
`WaveletTranslation`

Wavelet function translation, cw_nw, specified as an nw-by-q matrix.

`[]`
`ScalingCoef`

Scaling function coefficients, as_ns, specified as an ns-by-1 vector.

`[]`
`WaveletCoef`

Wavelet function coefficients, aw_nw, specified as an nw-by-1 vector.

`[]`
`OutputOffset`

Output offset, `d`, specified as a scalar.

`[]`

The parameters are typically not assigned directly. They are estimated by the identification algorithm (`nlarx` or `nlhw`) when `wavenet` is used in a Nonlinear ARX (`idnlarx`) or Hammerstein-Wiener (`idnlhw`) model.

`Options`

Options specifying the initial wavelet nonlinearity structure, specified as a structure with the following fields:

Field NameDescriptionDefault
`FinestCell`

Minimum number of data points in the smallest cell, specified as an integer or character vector. A cell is the area covered by the significantly nonzero portion of a wavelet.

`'auto'` — Compute the value from the data.
`MinCells`

Minimum number of cells in the partition, specified as an integer.

`16`
`MaxCells`

Maximum number of cells in the partition, specified as an integer.

`128`
`MaxLevels`

Maximum number of wavelet levels, specified as an integer.

`10`
`DilationStep`

Dilation step size, specified as real scalar.

`2`
`TranslationStep`

Translation step size, specified as real scalar.

`1`

## Output Arguments

collapse all

Wavelet nonlinearity estimator object, returned as a `wavenet` object.

## Algorithms

`wavenet` can be used in both Nonlinear ARX and Hammerstein-Wiener models.

• When used in a Nonlinear ARX model:

• If the `Focus` estimation option (see, `nlarxOptions`) is `'prediction'`, `wavenet` uses a fast, noniterative technique for estimating parameters [1]. Successive refinements after the first estimation use an iterative algorithm.

• If `Focus` is `'simulation'`, `wavenet` uses an iterative technique for estimating parameters.

To always use a noniterative or iterative algorithm, specify the `IterativeWavenet` option of `nlarxOptions`.

• When used in a Hammerstein-Wiener model, `wavenet` parameters are determined by iterative minimization.

## References

[1] Zhang, Q. “Using wavelet network in nonparametric estimation.” IEEE Trans. on Neural Networks, Vol. 8, Number 2, March 1997, pp. 227-236.