Accelerating the pace of engineering and science

Documentation Center

• Trial Software

Batch Linearize Model for Parameter Value Variations Using linearize

This example shows how to use the linearize command to extract multiple linearizations from a model for varying parameter values (batch linearization).

In this example, you vary the plant parameters and obtain the closed-loop transfer function from the reference input to the plant output for the watertank model. You can analyze the batch linearization results, for example, to determine the controller robustness to variations in the plant model.

Open the model.

`open_system('watertank');`

Specify the reference input and plant output as the linearization I/Os.

```io(1) = linio('watertank/Desired  Water Level',1,'input');
io(2) = linio('watertank/Water-Tank System',1,'output');```

io(1), the signal originating at the outport of the Desired Water Level block, is the reference input. io(2), the signal originating at the outport of the Water-Tank System block, is the plant output.

Vary the plant parameters A and b, used in the Water-Tank System block, in the 10% range. linearize requires a structure with fields Name and Value to specify the parameters being varied.

```[A_grid,b_grid] = ndgrid(linspace(0.9*A,1.1*A,3),...
linspace(0.9*b,1.1*b,4));
params(1).Name = 'A';
params(1).Value = A_grid;
params(2).Name = 'b';
params(2).Value = b_grid;```

params specifies a 3 x 4 parameter grid, where each grid point corresponds to a unique combination of A and b values.

Obtain the closed-loop transfer function from the reference input to the plant output for the specified range of plant parameter values.

```T = linearize('watertank',io,params);
```

T is a 3 x 4 array of linearized models. Each entry in the array contains a linearization for the corresponding parameter combination in the grid specified by params. For example, T(:,:,2,2) corresponds to the linearization obtained by setting the values of the A and b parameters to A_grid(2,2) and b_grid(2,2).