Main Content

idPiecewiseLinear

Piecewise-linear nonlinearity estimator object

Description

The idPiecewiseLinear object stores the piecewise-linear nonlinearity estimator for estimating Hammerstein-Wiener models.

Use idPiecewiseLinear to define a nonlinear function y=F(x,θ), where y and x are scalars, and θ represents the parameters specifying the number of break points and the value of nonlinearity at the break points. The nonlinearity function, F, is a piecewise-linear (affine) function of x. There are n break points (xk,yk), k = 1,...,n, such that yk = F(xk). F is linearly interpolated between the break points. F is also linear to the left and right of the extreme break points. The slope of these extensions is a function of xi and yi break points.

The break points are ordered by ascending x values, which is important to consider when you want to set a specific break point to a different value. There are minor differences between the break point values you set and the values stored in the object because the toolbox has a different internal representation of break points.

For example, in this plot, the break points are xk = [-2,1,4] and the corresponding nonlinearity values are yk = [4,3,5].

You compute the value of F(x) using evaluate(NL,x), where NL is the idPiecewiseLinear object. When using evaluate, you have to initialize the break points manually.

For idPiecewiseLinear object properties, see Properties.

Creation

Description

NL = idPiecewiseLinear creates a default piecewise-linear nonlinearity estimator object with 10 break points for estimating Hammerstein-Wiener models. The break points and their nonlinearities are set to []. The initial values of the nonlinearities are determined from the estimation data range during estimation using nlhw.

example

NL = idPiecewiseLinear(Name=Value) creates a piecewise-linear nonlinearity estimator object with properties specified by one or more name-value arguments.

example

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Use name-value arguments to specify the object properties such as the number of break points, their values and their nonlinearities.

Example: NumberOfUnits=5

Number of break points, specified as a positive integer.

This argument sets the NumberOfUnits property.

If you specify both NumberOfUnits and BreakPoints as name-value arguments, then the NumberOfUnits property is automatically set to the number of columns in BreakPoints.

Break points, xk, and the corresponding nonlinearity values at the break points, yk, specified as one of these values:

  • 2-by-n matrix — The x and y values for each of the n break points are specified as [x1,x2,...,xn;y1,y2,...,yn].

  • 1-by-n vector — The specified vector is interpreted as the x values of the break points: x1,x2,..., xn. All the y values of the break points are set to 0.

By default, the break points and their nonlinearities are set to [].

This argument sets the BreakPoints property. If the BreakPoints property is not [], the NumberOfUnits property is automatically set to the number of columns in BreakPoints, n.

When you create the nonlinearity object, the software sorts the break points by ascending x values. This sorting is important to consider if you want to set a specific break point to a different value after creating the object.

Properties

expand all

idPiecewiseLinear object properties include:

Number of break points, specified as a positive integer.

Break points, xk, and the corresponding nonlinearity values at the break points, yk, specified as one of these values:

  • 2-by-n matrix — The x and y values for each of the n break points are specified as [x1,x2,...,xn;y1,y2,...,yn].

  • 1-by-n vector — The specified vector is interpreted as the x values of the break points: x1,x2, ...., xn. All the y values of the break points are set to 0.

By default, the break points and their nonlinearities are set to [].

If the BreakPoints property is not [], the NumberOfUnits property is automatically set to the number of columns in BreakPoints, n.

When you create the nonlinearity object, the software sorts the break points by ascending x values. This sorting is important to consider if you want to set a specific break point to a different value after creating the object.

Option to fix or free the values in the mapping object, specified as a logical scalar. When you set Free to false, the object does not update during estimation.

Object Functions

idnlhwHammerstein-Wiener Model
nlhwEstimate Hammerstein-Wiener model

Examples

collapse all

Create a default piecewise-linear nonlinearity estimator object using idPiecewiseLinear.

NL = idPiecewiseLinear
NL = 
Piecewise Linear
    NumberOfUnits: 10
      BreakPoints: []
             Free: 1

By default, the NL object has 10 break points. Change the number of break points to 5 by specifying the NumberOfUnits property.

NL.NumberOfUnits = 5
NL = 
Piecewise Linear
    NumberOfUnits: 5
      BreakPoints: []
             Free: 1

Load estimation data.

load twotankdata;
z = iddata(y,u,0.2,'Name','Two tank system');
z1 = z(1:1000);

Create an idPiecewiseLinear object and specify the breakpoints.

InputNL = idPiecewiseLinear(BreakPoints=[-2,1,4])
InputNL = 
Piecewise Linear
Inputs: u(t)
Output: y(t)
    NumberOfUnits: 3
      BreakPoints: [2×3 double]
             Free: 1

Because the BreakPoints property is specified as a vector, the specified vector is interpreted as the x values of the break points. The y values of the break points are set to 0 and are determined during model estimation.

Estimate model with no output nonlinearity using nlhw.

sys = nlhw(z1,[2 3 0],InputNL,[]);

Version History

Introduced in R2007a

expand all