Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

After estimating a Hammerstein-Wiener model for your system, you can validate whether it reproduces the system behavior within acceptable bounds. It is recommended that you use separate data sets for estimating and validating your model. If the validation indicates low confidence in the estimation, then see Troubleshooting Model Estimation for next steps. For general information about validating models, see Model Validation.

Plot simulated model output and measured output data for comparison,
and compute best fit values. At the command line, use `compare`

command. You can also use `sim`

to simulate model response. Note that
for Hammerstein-Wiener models, the simulated and predicted model output
are equivalent because these models have a trivial noise-component,
that is the additive disturbance in these models is white noise. For
information about plotting simulated output in the app, see Simulation and Prediction in the App.

The estimation report that is generated after model estimation lists the reason the software terminated the estimation. For example, suppose that the report indicates that the estimation reached the maximum number of iterations. You can try repeating the estimation by specifying a larger value for the maximum number of iterations. For information about how to configure the maximum number of iterations and other estimation options, see Specify Estimation Algorithm.

To view the estimation report in the app, after model estimation
is complete, view the **Estimation Report** area
of the **Estimate** tab. At the command line, use `M.Report.Termination`

to
display the estimation termination conditions, where `M`

is
the estimated Hammerstein-Wiener model. For example, check the `M.Report.Termination.WhyStop`

field
that describes why the estimation was stopped.

For more information about the estimation report, see Estimation Report.

You can compare the performance of several estimated models by comparing the final prediction error and loss function values that are shown in the estimation report.

To view these values for an estimated model `M`

at
the command line, use the `M.Report.Fit.FPE`

(final
prediction error) and `M.Report.Fit.LossFcn`

(value
of loss function at estimation termination) properties. Smaller values
typically indicate better performance. However, `M.Report.Fit.FPE`

values
can be unreliable when the model contains many parameters relative
to the estimation data size. Use these indicators with other validation
techniques to draw reliable conclusions.

*Residuals* are differences between the model
output and the measured output. Thus, residuals represent the portion
of the output not explained by the model. You can analyze the residuals
using techniques such as the whiteness test and the independence test.
For more information about these tests, see What Is Residual Analysis?

At the command line, use `resid`

to
compute, plot, and analyze the residuals. To plot residuals in the
app, see How to Plot Residuals in the App.

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:

*u*_{NL}(*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.*y*_{NL}(*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 create a Hammerstein-Wiener plot in the System Identification
app, after you have estimated the model, select the **Hamm-Wiener** check
box in the **Model Views** area. For general information
about creating and working with plots in the app, see Working with Plots.

At the command line, after you have estimated a Hammerstein-Wiener
model `M`

, you can access the objects representing
the input and output nonlinearity estimators using `M.InputNonlinearity`

and `M.OutputNonlinearity`

.

Use `plot`

to
view the shape of the nonlinearities and the properties of the linear
block.

plot(M)

You can use additional `plot`

arguments to
specify the following information:

Include several Hammerstein-Wiener models on the plot.

Configure how to evaluate the nonlinearity at each input and output channel.

Specify the time or frequency values for computing transient and frequency response plots of the linear block.

**To configure the plots of the nonlinear
blocks:**

In the Hammerstein-Wiener Model Plot window, select the nonlinear block you want to plot.

To plot the response of the input nonlinearity function, click the

*u*_{NL}block.To plot the response of the output nonlinearity function, click the

*y*_{NL}block.

The selected block is highlighted green.

### Note

The input to the output nonlinearity block

*y*_{NL}is the output from the Linear Block and not the measured input data.If your model contains multiple inputs or outputs, select the channel in the

**Select nonlinearity at channel**list. Selecting the channel updates the plot and displays the nonlinearity values versus the corresponding input to this nonlinear block.Change the range of the horizontal axis of the plot. This feature is available only for plots generated in the

**System Identification**app.In the plot window, select

**Options**>**Set input range**to open the Range for Input to Nonlinearity dialog box. This feature is only available in the**System Identification**app.Enter the range using the format

`[MinValue MaxValue]`

. Click**Apply**and then**Close**to update the plot.

**To configure the linear block response
plot:**

In the Hammerstein-Wiener Model Plot window, click the

`Linear Block`

.Select the input-output data pair for which you want to view the response in the

**Select I/O pair**list.Select the type of linear response plot. In the

**Choose plot type**list, choose from the following options:`Step`

`Impulse`

`Bode`

`Pole-Zero Map`

Set the time span for a step or impulse response plot. This feature is available only for plots generated in the

**System Identification**app.In the plot window, select

**Options**>**Time span**. In the Time Range dialog box, specify the time span in the units of time you specified for the model. For a time span*T*, the resulting response is plotted from*-T/4*to*T*. Click**Apply**and then**Close**.Set the frequency range for a Bode plot. This feature is available only for plots generated in the app.

The default frequency vector is 128 linearly distributed values, greater than zero and less than or equal to the Nyquist frequency. To change the range, select

**Options**>**Frequency range**. In the Frequency Range dialog box, specify a new frequency vector in units of rad per model time units using one of following methods:MATLAB

^{®}expression, such as`(1:100)*pi/100`

or`logspace(-3,-1,200)`

. The expression cannot contain variables in the MATLAB workspace.Row vector of values, such as

`(1:0.1:100)`

.

Click

**Apply**and then**Close**.