# idnlhw/plot

Plot input and output nonlinearity, and linear responses of Hammerstein-Wiener model

## Syntax

``plot(model)``
``plot(model,LineSpec)``
``plot(model1,...,modelN)``
``plot(model1,LineSpec1...,modelN,LineSpecN)``
``plot(___,Name,Value)``

## Description

example

````plot(model)` plots the input and output nonlinearity, and linear responses of a Hammerstein-Wiener model on a Hammerstein-Wiener plot. The plot shows the responses of the input and output nonlinearity, and linear blocks that represent the model.```
````plot(model,LineSpec)` specifies the line style.```
````plot(model1,...,modelN)` generates the plot for multiple models.```

example

````plot(model1,LineSpec1...,modelN,LineSpecN)` specifies the line style for each model. You do not need to specify the line style for all models.```

example

````plot(___,Name,Value)` specifies plot properties using additional options specified by one or more `Name,Value` pair arguments. This syntax can include any of the input argument combinations in the previous syntaxes.```

## Examples

collapse all

Estimate a Hammerstein-Wiener Model and plot responses of its input and output nonlinearity and linear blocks.

```load iddata3 model1 = nlhw(z3,[4 2 1],'sigmoidnet','deadzone'); plot(model1)```

Explore the various plots in the plot window by clicking one of the three blocks that represent the model:

• uNL - Input nonlinearity, representing the static nonlinearity at the input ( `model.InputNonlinearity` ) to the LinearBlock.

• Linear Block - Step, impulse,Bode and pole-zero plots of the embedded linear model ( `model.LinearModel` ). By default, a step plot is displayed.

• yNL - Output nonlinearity, representing the static nonlinearity at the output ( `model.OutputNonlinearity` ) of the Linear Block.

```load iddata3 model1 = nlhw(z3,[4 2 1],'sigmoidnet','deadzone'); model2 = nlhw(z3, [4 2 1],[],'sigmoidnet'); plot(model1,'b-',model2,'g')```

```load iddata3 model1 = nlhw(z3,[4 2 1],'sigmoidnet','deadzone'); model2 = nlhw(z3, [4 2 1],[],'sigmoidnet'); plot(model1,'b-',model2,'g','NumberOfSamples',50,'time',10,'InputRange',[-2 2]);```

```load iddata3 model1 = nlhw(z3,[4 2 1],'sigmoidnet','deadzone'); model2 = nlhw(z3, [4 2 1],[],'sigmoidnet'); plot(model1,model2,'time',1:500,'freq',{0.01,100},'OutputRange',[0 1000]);```

## Input Arguments

collapse all

Estimated Hammerstein-Wiener model, specified as an `idnlhw` model object. Use `nlhw` to estimate the model.

Line style, marker symbol, and color, specified as a character vector. `LineSpec` takes values such as `'b'`, `'b+:'`. For more information, see the `plot` reference page in the MATLAB® documentation.

Data Types: `char`

### 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`.

Example: `plot(model,'NumberofSamples',10)` specifies to use 10 data points for the input regressors.

Number of data points to use for the input regressors when evaluating the nonlinearities at individual input or output channels, specified as a positive integer. This property does not affect the plots of the linear block.

Data Types: `double`

Minimum and maximum regressor values to use when evaluating the nonlinearities at each input channel, specified as positive integers or `[min max]` vector, where minimum value is less than the maximum value.

You can use `'uRange'` as a shortcut name for this property.

Data Types: `double`

Minimum and maximum regressor values to use when evaluating the nonlinearities at each output channel, specified as positive integers or `[min max]` vector, where minimum value is less than the maximum value.

You can use `'yRange'` as a shortcut name for this property.

Data Types: `double`

The time samples at which the transient responses (step and impulse) of the linear block of the `idnlhw` model must be computed, specified as one of the following values:

• Positive scalar — Denotes end time for transient responses of all models. For example, 10.

• Vector of time instants — A double vector of equi-sampled values denotes the time samples at which the transient response must be computed. For example, [0:0.1:10].

This property takes the same values as the `step` command on the model.

Frequencies at which to compute the Bode response, specified as one of the following values:

• `[Wmin Wmax]` range — Frequency interval between `Wmin` and `Wmax` (in units `rad/(model.TimeUnit)`) covered using logarithmically placed points.

• Vector of non-negative frequency values — Allows computation of bode response at those frequencies.

By default, the response is computed at some automatically chosen frequencies inside the Nyquist frequency range. Frequencies above Nyquist frequency (`pi/model.Ts`) are ignored.

This property takes the same values as the `bode` command on the model.

collapse all

### What is a Hammerstein-Wiener Plot?

A Hammerstein-Wiener plot displays the static input and output nonlinearities and linear responses of a Hammerstein-Wiener model.

Examining a Hammerstein-Wiener plot can help you determine whether you have selected a complicated nonlinearity for modeling your system. For example, suppose you use a piecewise-linear input nonlinearity to estimate your model, but the plot indicates saturation behavior. You can estimate a new model using the simpler saturation nonlinearity instead. For multivariable systems, you can use the Hammerstein-Wiener plot to determine whether to exclude nonlinearities for specific channels. If the nonlinearity for a specific input or output channel does not exhibit strong nonlinear behavior, you can estimate a new model after setting the nonlinearity at that channel to unit gain.

You can generate these plots in the System Identification app and at the command line. In the plot window, you can view the nonlinearities and linear responses by clicking one of the three blocks that represent the model:

• uNL (input nonlinearity)— Click this block to view the static nonlinearity at the input to the `Linear Block`. The plot displays `evaluate(M.InputNonlinearity,u)` where `M` is the Hammerstein-Wiener model, and `u` is the input to the input nonlinearity block. For information about the blocks, see Structure of Hammerstein-Wiener Models.

• `Linear Block` — Click this block to view the Step, impulse, Bode, and pole-zero response plots of the embedded linear model (`M.LinearModel`). By default, a step plot of the linear model is displayed.

• yNL (output nonlinearity) — Click this block to view the static nonlinearity at the output of the `Linear Block`. The plot displays `evaluate(M.OutputNonlinearity,x)`, where `x` is the output of the linear block.

To learn more about how to configure the linear and nonlinear blocks plots, see Configuring a Hammerstein-Wiener Plot.