# Model Reducer

Reduce complexity of linear time-invariant (LTI) models

## Description

The Model Reducer app lets you compute reduced-order approximations of high-order LTI and sparse LTI models. Working with lower-order models can simplify analysis and control design. Simpler models are also easier to understand and manipulate. You can reduce a plant model to focus on relevant dynamics before designing a controller for the plant. Or, you can use model reduction to simplify a full-order controller.

Using any of the following methods, Model Reducer helps you reduce model order while preserving model characteristics that are important to your application:

Balanced truncation — Remove states with relatively small energy contributions.

Modal truncation — Discard modes based on their locations or DC contributions.

Pole-zero simplification — Eliminate canceling or near-canceling pole-zero pairs.

Model Reducer provides response plots and error plots to help ensure that the reduced-order model preserves important dynamics. For more information on model reduction and why it is useful, see Model Reduction Basics.

For an alternative to the Model Reducer app that lets you interactively perform model reduction and generate code for a live script, see the Reduce Model Order task in the Live Editor.

## Open the Model Reducer App

MATLAB

^{®}Toolstrip: On the**Apps**tab, under**Control System Design and Analysis**, click the app icon.MATLAB command prompt: Enter

`modelReducer`

.

## Examples

## Parameters

**Balanced Truncation Tab**

`Model`

— Currently selected model for reduction

model name

Specify the model you want to reduce by selecting from the
**Model** drop-down list. The list includes all models
currently in the data browser. To get a model from the MATLAB workspace into the data browser, on the **Model
Reducer** tab, click **Import Model**. You can
import any:

`tf`

,`ss`

, or`zpk`

model that is proper. The model can be SISO or MIMO, and continuous or discrete.Continuous-time models must not have time delays. To reduce a continuous-time model with time delays, first use

`pade`

to approximate the time delays as model dynamics.Discrete-time models can have time delays. For the Balanced Truncation reduction method, the app uses

`absorbDelay`

to convert the delay into poles at*z*= 0 before reducing the model. The additional states are reflected in the response plot and Hankel singular-value plot.

Generalized model such as a

`genss`

model. The Model Reducer app uses the current or nominal value of all control design blocks in`model`

(see`getValue`

).Sparse state-space models such as

`sparss`

and`mechss`

models.

**Note**

Model Reducer assumes that the model time unit (specified
in the `TimeUnit`

property of the model) is seconds. If
your model does not have `TimeUnit = 'seconds'`

, use
`chgTimeUnit`

to convert
the model to seconds.

`Reduction criteria`

— Number of states in reduced model

`Order`

| `Maximum error`

| `Minimum energy`

Specify the model order reduction criteria. Any value is permitted that
falls between the number of unstable states in the model and the number of
states in the original model. If you specify a single value, Model
Reducer computes and displays the responses of a model of that
order. If you specify multiple values, Model Reducer computes
models of all specified orders and displays their responses on the same
plot. To store reduced models in the data browser, click **Save
Reduced Model**.

For more information, see Balanced Truncation Model Reduction.

`Comparison plot`

— Type of comparison plot

`Model response`

| `Absolute error plot`

| `Relative error plot`

Specify the comparison plot type.

`Model response`

— Plot the model frequency response. This frequency response comparison is a Bode plot for SISO models, and a singular-value plot for MIMO models.`Absolute error plot`

— Plot the frequency response of absolute error $${\Vert G-{G}_{r}\Vert}_{\infty}$$.`Relative error plot`

— Plot the frequency response of relative error $${\Vert {G}^{-1}\left(G-{G}_{r}\right)\Vert}_{\infty}$$.

For more information, see Balanced Truncation Model Reduction.

`Analysis plot`

— Type of analysis plot

`Hankel singular values`

(default) | `Energy`

Specify the analysis plot type.

`Hankel singular values`

— Bar chart of Hankel singular values and associated error bounds.`Energy`

— Bar chart of normalized state energies.

**Modal Truncation Tab**

`Model`

— Currently selected model for reduction

model name

Specify the model you want to reduce by selecting from the
**Model** drop-down list. The list includes all models
currently in the data browser. To get a model from the MATLAB workspace into the data browser, on the **Model
Reducer** tab, click **Import Model**. You can
import any:

`tf`

,`ss`

, or`zpk`

model that is proper. The model can be SISO or MIMO, and continuous or discrete.Continuous-time models must not have time delays. To reduce a continuous-time model with time delays, first use

`pade`

to approximate the time delays as model dynamics.Discrete-time models can have time delays. For the Balanced Truncation reduction method, the app uses

`absorbDelay`

to convert the delay into poles at*z*= 0 before reducing the model. The additional states are reflected in the response plot and Hankel singular-value plot.

Generalized model such as a

`genss`

model. The Model Reducer app uses the current or nominal value of all control design blocks in`model`

(see`getValue`

).Sparse state-space models such as

`sparss`

and`mechss`

models.

For more information, see Modal Truncation Model Reduction.

**Note**

Reduce Model Order assumes that the
model time unit (specified in the `TimeUnit`

property
of the model) is seconds. If your model does not have ```
TimeUnit
= 'seconds'
```

, use `chgTimeUnit`

to convert
the model to seconds.

`Frequency Range`

— Frequency range

two-element vector

Frequency range of interest, specified as a vector of form
[*F _{min}*,

*]. The algorithm discards all the modes outside this range.*

*F*_{max}`Damping Range`

— Damping range

two-element vector

Damping range of interest, specified as a vector of form
[*ζ _{min}*,

*ζ*]. The algorithm discards all the modes outside this range.

_{max}`Minimum DC Contribution`

— Minimum DC contribution bound

nonnegative scalar

Minimum DC contribution bound for the reduced-order model, specified as a nonnegative scalar. The algorithm discards all the modes with normalized DC contributions smaller than this value.

`Comparison plot`

— Type of comparison plot

`Model response`

| `Absolute error plot`

| `Relative error plot`

| `Mode locations`

Specify the comparison plot type.

`Model response`

— Plot the model frequency response. This frequency response comparison is a Bode plot for SISO models, and a singular-value plot for MIMO models.`Absolute error plot`

— Plot the frequency response of absolute error $${\Vert G-{G}_{r}\Vert}_{\infty}$$.`Relative error plot`

— Plot the frequency response of relative error $${\Vert {G}^{-1}\left(G-{G}_{r}\right)\Vert}_{\infty}$$.`Mode locations`

— Compare the pole locations of original and reduced models.

`Analysis plot`

— Type of analysis plot

`DC contribution`

(default) | `Mode location`

| `Mode damping and natural frequency`

Specify the comparison plot type.

`DC contribution`

— Bar chart of normalized DC contributions.`Mode location`

— Plot the location of the poles.`Mode damping and natural frequency`

— Plot the damping and natural frequencies of the poles.

**Pole/Zero Simplification Tab**

`Model`

— Currently selected model for reduction

model name

Specify the model you want to reduce by selecting from the
**Model** drop-down list. The list includes all models
currently in the data browser. To get a model from the MATLAB workspace into the data browser, on the **Model
Reducer** tab, click
**Import Model**. You can import any:

`tf`

,`ss`

, or`zpk`

model that is proper. The model can be SISO or MIMO, and continuous or discrete.Continuous-time models must not have time delays. To reduce a continuous-time model with time delays, first use

`pade`

to approximate the time delays as model dynamics.Discrete-time models can have time delays. For the Balanced Truncation reduction method, the app uses

`absorbDelay`

to convert the delay into poles at*z*= 0 before reducing the model. The additional states are reflected in the response plot and Hankel singular-value plot.

Generalized model such as a

`genss`

model. The Model Reducer app uses the current or nominal value of all control design blocks in`model`

(see`getValue`

).

`Simplification of Pole-Zero Pairs`

— Tolerance for pole-zero cancellation

positive scalar

Set the tolerance for pole-zero cancellation by using the slider or entering a value in the text box. The value determines how close together a pole and zero must be for Model Reducer to eliminate them from the reduced model. Moving the slider to the left or entering a smaller value in the text box simplifies the model less, by cancelling fewer poles and zeros. Moving the slider to the right, or entering a larger value, simplifies the model more by cancelling poles and zeros that are further apart.

For more information, see Pole-Zero Simplification.

`Comparison plot`

— Type of comparison plot

`Model response`

| `Absolute error plot`

| `Relative error plot`

Specify the comparison plot type.

`Model response`

— Plot the model frequency response. This frequency response comparison is a Bode plot for SISO models, and a singular-value plot for MIMO models.`Absolute error plot`

— Plot the frequency response of absolute error $${\Vert G-{G}_{r}\Vert}_{\infty}$$.`Relative error plot`

— Plot the frequency response of relative error $${\Vert {G}^{-1}\left(G-{G}_{r}\right)\Vert}_{\infty}$$.

## Programmatic Use

`modelReducer`

`modelReducer`

opens the Model Reducer app with no
models in the data browser. To import a model from the MATLAB workspace, click
**Import Model**.

`modelReducer(``model`

)

`model`

)`modelReducer(`

opens app and
imports the specified LTI model. `model`

)`model`

can be a:

`tf`

,`ss`

, or`zpk`

model that is proper. The model can be SISO or MIMO, and continuous or discrete.`pade`

to approximate the time delays as model dynamics.`absorbDelay`

to convert the delay into poles at*z*= 0 before reducing the model. The additional states are reflected in the response plot and Hankel singular-value plot.

`genss`

model. The Model Reducer app uses the current or nominal value of all control design blocks in`model`

(see`getValue`

).Sparse state-space models such as

`sparss`

and`mechss`

models.

`modelReducer(``model1`

,...,`modelN`

)

`model1`

,...,`modelN`

)`modelReducer(`

opens the app and imports the specified models.`model1`

,...,`modelN`

)

`modelReducer(``sessionFile`

)

`sessionFile`

)`modelReducer(`

opens the app
and loads a previously saved session. `sessionFile`

)`sessionFile`

is the name
of a session data file in the current working directory or on the MATLAB path.

To save session data to disk, in the Model Reducer app, on the
**Model Reducer** tab, click
**Save Session**. The saved session data includes the current plot
configuration and all models in the data browser.

## Version History

**Introduced in R2016a**

### R2024a: Obtain reduced order models for `sparss`

and `mechss`

models

You can now compute reduced-order models of sparse state-space models interactively using the Model Reducer app. The software supports sparse model order reduction using these methods:

Balanced truncation — Obtain low-order approximation by discarding states with low contribution.

Modal truncation — Obtain low-order approximation by discarding undesired modes.

### R2024a: Mode Selection method is now Modal Truncation

The **Modal Truncation** method replaces the **Mode
Selection** method in the Model Reducer app. Modal
truncation method provides better flexibility for choosing the criteria for
discarding modes.

### R2023b: Generates code using new model order reduction workflow

The Model Reducer app now generates code using the new model order reduction workflows. For example, this table describes the change in the model order reduction workflow in the generated code.

Method | Generated Code before R2023b | Generated Code in R2023b |
---|---|---|

Balanced Truncation |
%% Reduce LTI model order using balanced truncation System = G; % Define System to reduce Order = 14; % Create option set for balred command Options = balredOptions(); % Offset for the stable/unstable boundary Options.Offset = 1e-05; % Compute reduced order approximation ReducedSystem = balred(System,Order,Options); % Create comparison plot bode(System,ReducedSystem); |
%% Reduce LTI model order using balanced truncation System = G; % Define System to reduce % Compute reduced order approximation R = reducespec(System,'balanced'); % Set options for Balanced Truncation specification % Offset for the stable/unstable boundary R.Options.Offset = 1e-05; % Compute MOR data once R = process(R); % Get reduced-order model ReducedSystem = getrom(R,Order=14); % Create comparison plot bode(System,ReducedSystem); |

Mode Selection |
%% Reduce LTI model order using mode selection System = G; % Define System to reduce UpperCutoffFrequency = 100; LowerCutoffFrequency = 10; % Create option set for freqsep command Options = freqsepOptions(); % Accuracy loss factor for stable/unstable decomposition Options.SepTol = 100; % Select modes between lower and upper cutoff frequencies ReducedSystem = freqsep(System,... [LowerCutoffFrequency UpperCutoffFrequency],Options); % Create comparison plot bode(System,ReducedSystem); |
%% Reduce LTI model order using mode selection System = G; % Define System to reduce % Select modes between lower and upper cutoff frequencies R = reducespec(System,'modal'); % Set options for Modal Truncation specification % Accuracy loss factor for stable/unstable decomposition R.Options.SepTol = 1e-11; % Compute MOR data once R = process(R); % Get reduced-order model ReducedSystem = getrom(R,Frequency=[10 100],Method='truncate'); % Create comparison plot bode(System,ReducedSystem); |

For more information about the new workflow, see `reducespec`

and Task-Based Model Order Reduction Workflow.

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)