Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# linearize(idnlhw)

Linearize Hammerstein-Wiener model

## Syntax

SYS = linearize(NLSYS,U0)
SYS = linearize(NLSYS,U0,X0)

## Description

SYS = linearize(NLSYS,U0) linearizes a Hammerstein-Wiener model around the equilibrium operating point. When using this syntax, equilibrium state values for the linearization are calculated automatically using U0.

SYS = linearize(NLSYS,U0,X0) linearizes the idnlhw model NLSYS around the operating point specified by the input U0 and state values X0. In this usage, X0 need not contain equilibrium state values. For more information about the definition of states for idnlhw models, see idnlhw States.

The output is a linear model that is the best linear approximation for inputs that vary in a small neighborhood of a constant input u(t) = U. The linearization is based on tangent linearization.

## Input Arguments

• NLSYS: idnlhw model.

• U0: Matrix containing the constant input values for the model.

• X0: Operating point state values for the model.

 Note:   To estimate U0 and X0 from operating point specifications, use the findop(idnlhw) command.

## Output Arguments

• SYS is an idss model.

When the Control System Toolbox™ product is installed, SYS is an LTI object.

## Examples

expand all

### Linearize Hammerstein-Wiener Model at Equilibrium Operating Point

Linearize a 2-input Hammerstein-Wiener model at an equilibrium point and compare the linearized model response to the original model response.

```load iddata2
z2.Ts = z3.Ts;
z = [z2(1:300),z3];
```

Estimate a Hammerstein-Wiener model using a combination of sigmoidnet and customnet output nonlinearities.

```orders = [2 2 3 4 1 5; 2 5 1 2 5 2];
nlsys = nlhw(z,orders,[],...
[sigmoidnet;customnet(@gaussunit)]);
```

Linearize the model at an equilibrium operating point corresponding to input levels of 10 and 5 respectively. To do this, first compute the operating point using findop , then linearize the model around the computed input and state values.

```[x,u_s,report] = findop(nlsys,'steady',[10,5]);
sys = linearize(nlsys,u_s,x);
```

sys is a state-space model.

Validate the linear model. Apply a small perturbation delta_u to the steady-state input of the nonlinear model nlsys. If the linear approximation is accurate, the following should match:

• The response of the nonlinear model y_nl to an input that is the sum of the equilibrium level and the perturbation delta_u.

• The sum of the response of the linear model to a perturbation input delta_u and the output equilibrium level.

Generate a 300-sample step perturbation signal with amplitude 0.1.

```delta_u = [zeros(20,2); 0.1*ones(280,2)];
```

Compute the response of the linear model delta_y_lin to the perturbed input signal delta_u.

```delta_y_lin = lsim(sys,delta_u);
```

For the nonlinear system with a steady-state input u_s, compute the steady-state output y_s from the SignalLevels field of the findop report computed previously.

```y_s = report.SignalLevels.Output;
```

Compute the perturbed input to the nonlinear system as the sum of the steady-state input u_s and the perturbation signal delta_u.

```u_nl = bsxfun(@plus,delta_u,u_s);
```

Compute the steady-state response of the nonlinear system y_nl to the perturbed input u_nl. Use equilibrium state values x as initial conditions.

```y_nl = sim(nlsys,u_nl,x);
```

Compare the response of nonlinear and linear models.

```time = (0:299)';
subplot(211)
plot(time,y_nl(:,1),time,delta_y_lin(:,1)+y_s(1),'.')
legend('Nonlinear response','Linear response about op. pt.','Location','SouthEast')
title('Comparison of signal values for output 1')
subplot(212)
plot(time,y_nl(:,2),time,delta_y_lin(:,2)+y_s(2),'.')
legend('Nonlinear response',...
title('Comparison of signal values for output 2')
```

expand all

### Algorithms

The idnlhw model structure represents a nonlinear system using a linear system connected in series with one or two static nonlinear systems. For example, you can use a static nonlinearity to simulate saturation or dead-zone behavior. The following figure shows the nonlinear system as a linear system that is modified by static input and output nonlinearities, where function f represents the input nonlinearity, g represents the output nonlinearity, and [A,B,C,D] represents a state-space parameterization of the linear model.

The following equations govern the dynamics of an idnlhw model:

v(t) = f(u(t))

X(t+1) = AX(t)+Bv(t)

w(t) = CX(t)+Dv(t)

y(t) = g(w(t))

where

• u is the input signal

• v and w are intermediate signals (outputs of the input nonlinearity and linear model respectively)

• y is the model output

The linear approximation of the Hammerstein-Wiener model around an operating point (X*, u*) is as follows:

where

where y* is the output of the model corresponding to input u* and state vector X*, v* = f(u*), and w* is the response of the linear model for input v* and state X*.

 Note:   For linear approximations over larger input ranges, use linapp. For more information, see the linapp reference page.