## Using Identified Models for Control Design Applications

### How Control System Toolbox Software Works with Identified Models

System Identification Toolbox™ software integrates with Control System Toolbox™ software by providing a plant for control design.

Control System Toolbox software also provides the Linear System Analyzer to extend System Identification Toolbox functionality for linear model analysis.

Control System Toolbox software supports only linear models. If you identified a nonlinear
plant model using System Identification Toolbox software, you must linearize it before you can work with this model in
the Control System Toolbox software. For more information, see the `linapp`

, `idnlarx/linearize`

, or `idnlhw/linearize`

reference page.

### Using balred to Reduce Model Order

In some cases, the order of your identified model might be higher than necessary
to capture the dynamics. If you have the Control System Toolbox software, you can use `balred`

to compute a state-spate
model approximation with a reduced model order.

To learn how you can reduce model order using pole-zero plots, see Reducing Model Order Using Pole-Zero Plots.

### Compensator Design Using Control System Toolbox Software

After you estimate a plant model using System Identification Toolbox software, you can use Control System Toolbox software to design a controller for this plant.

System Identification Toolbox models in the MATLAB^{®} workspace are immediately available to Control System Toolbox commands. However, if you used the System Identification app to
estimate models, you must first export the models to the MATLAB workspace. To export a model from the app, drag the model icon to the
**To Workspace** rectangle. Alternatively, right-click the icon
to open the Data/model Info dialog box. Click **Export** to
export the model.

Control System Toolbox software provides both the **Control System Designer** and
commands for working at the command line. You can import linear models directly into
**Control System Designer** using the following command:

controlSystemDesigner(model)

You can also identify a linear model from measured SISO data and tune a PID
controller for the resulting model in the PID Tuner. You can interactively adjust
the identified parameters to obtain an LTI model whose response fits your response
data. The PID Tuner automatically tunes a PID controller for the identified model.
You can then interactively adjust the performance of the tuned control system, and
save the identified plant and tuned controller. To access the PID Tuner, enter
`pidTuner`

at the MATLAB command line. For more information, see PID Controller Tuning (Control System Toolbox).

### Converting Models to LTI Objects

You can convert linear identified models into numeric LTI models
(`ss`

, `tf`

, `zpk`

) of
Control System Toolbox software.

The following table summarizes the commands for transforming linear state-space and polynomial models to an LTI object.

**Commands for Converting Models to LTI Objects**

Command | Description | Example |
---|---|---|

`frd` (Control System Toolbox) |
Convert to frequency-response representation. |
ss_sys = frd(model) |

`ss` (Control System Toolbox) |
Convert to state-space representation. |
ss_sys = ss(model) |

`tf` (Control System Toolbox) |
Convert to transfer-function form. |
tf_sys = tf(model) |

`zpk` (Control System Toolbox) |
Convert to zero-pole form. |
zpk_sys = zpk(model) |

The following code converts the noise component of a linear identified model,
`sys`

, to a numeric state-space model:

```
noise_model_ss = idss(sys,'noise');
```

To convert both the measured and noise components of a linear identified model,
`sys`

, to a numeric state-space model:

`model_ss = idss(sys,'augmented');`

For more information about subreferencing the dynamic or the noise model, see Separation of Measured and Noise Components of Models.

### Viewing Model Response Using the Linear System Analyzer

#### What Is the Linear System Analyzer?

If you have the Control System Toolbox software, you can plot models in the Linear System Analyzer from either the System Identification app or the MATLAB Command Window.

The Linear System Analyzer is a graphical user interface for viewing and manipulating the response plots of linear models.

**Note**

The Linear System Analyzer does not display model uncertainty.

For more information about working with plots in the Linear System Analyzer, see the Linear System Analyzer Overview (Control System Toolbox).

#### Displaying Identified Models in the Linear System Analyzer

When the MATLAB software is installed, the System Identification app contains the
**To LTI Viewer** rectangle. To plot models in the Linear
System Analyzer, do one of the following:

Drag and drop the corresponding icon to the

**To LTI Viewer**rectangle in the System Identification app.Right-click the icon to open the Data/model Info dialog box. Click

**Show in LTI Viewer**to plot the model in the Linear System Analyzer.

Alternatively, use the following syntax when working at the command line to view a model in the Linear System Analyzer:

linearSystemAnalyzer(model)

### Combining Model Objects

If you have the Control System Toolbox software, you can combine linear model objects, such as
`idtf`

, `idgrey`

,
`idpoly`

, `idproc`

, and
`idss`

model objects, similar to the way you combine LTI
objects. The result of these operations is a numeric LTI model that belongs to the
Control System Toolbox software. The only exceptions are the model stacking and model
concatenation operations, which deliver results as identified models.

For example, you can perform the following operations on identified models:

`G1+G2`

`G1*G2`

`append(G1,G2)`

`feedback(G1,G2)`