idnlhw/plot

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

Syntax

  • plot(model) example
  • plot(model,LineSpec)
  • plot(model1,...,modelN)
  • plot(model1,LineSpec1...,modelN,LineSpecN) example

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

expand all

Plot Input and Output Nonlinearity and Linear Response of a Hammerstein-Wiener Model

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.

Specify Line Style for Multiple Models

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

Specify Number of Samples, Time Samples and Range of Input Nonlinearity

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]);

Specify Time Samples, Frequency and Range of Output Nonlinearity

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

expand all

model — Estimated Hammerstein-Wiener modelidnlhw model

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

LineSpec — Line style, marker symbol, and colorstring

Line style, marker symbol, and color, specified as a string. 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 single 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.

'NumberOfSamples' — Number of data points to use for input regressors100 (default) | positive integer

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

'InputRange' — Minimum and maximum regressor values for evaluating input nonlinearitiesrange of regressor values used during each model's estimation. (default) | positive integer | vector

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

'OutputRange' — Minimum and maximum regressor values for evaluating output nonlinearitiesrange of regressor values used during each model's estimation (default) | positive integer | vector

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

'Time' — Time samples to compute transient responses of the linear blockeach model's dynamics determine the time samples used (default) | positive scalar | vector

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.

'Frequency' — Frequencies at which to compute the Bode responseautomatically chosen inside the Nyquist frequency range (default) | [min max] range of positive scalars | vector of positive integers

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.

More About

expand all

What is a Hammerstein-Wiener Plot?

A Hammerstein-Wiener plot displays the characteristics of the linear block and the static nonlinearities of a Hammerstein-Wiener model.

Examining a Hammerstein-Wiener plot can help you determine whether you chose an unnecessarily complicated nonlinearity for modeling your system. For example, if you chose a piecewise-linear nonlinearity (which is very general), but the plot indicates saturation behavior, then 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.

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

  • uNLInput nonlinearity, representing the static nonlinearity at the input (model.InputNonlinearity) to the Linear Block.

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

  • yNLOutput nonlinearity, representing the static nonlinearity at the output (model.OutputNonlinearity) of the Linear Block.

To learn more about how to configure the linear and nonlinear blocks plots, see Tips.

Tips

  • The Hammerstein-Wiener model can contain up to two nonlinear blocks. The nonlinearity at the input to the Linear Block is labeled uNL and is called the input nonlinearity. The nonlinearity at the output of the Linear Block is labeled yNL and is called the output nonlinearity.

    To configure the nonlinear block characteristics plot:

    1. If the top pane is not visible, click to expand the Hammerstein-Wiener Model Plot window.

    2. Select the nonlinear block you want to plot:

      • To plot uNL as a command of the input data, click the uNL block.

      • To plot yNL as a command of its inputs, click the yNL block.

      The selected block is highlighted in green.

        Note:   The input to the output nonlinearity block yNL is the output from the Linear Block and not the measured input data.

    3. 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.

    4. Click Apply to update the plot.

  • The Hammerstein-Wiener model contains one Linear Block that represents the embedded linear model.

    To configure the linear block plot:

    1. If the top pane is not visible, click to expand the Hammerstein-Wiener Model Plot window.

    2. Click the Linear Block to select it. The Linear Block is highlighted in green.

    3. In the Select I/O pair list, select the input and output data pair for which to view the response.

    4. In the Choose plot type list, select the linear plot from the following options:

      • Step

      • Impulse

      • Bode

      • Pole-Zero Map

See Also

|

Was this topic helpful?