# Model Reducer

Reduce complexity of linear time-invariant (LTI) models

## Description

The Model Reducer app lets you compute reduced-order approximations of high-order 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.

Mode Selection — Select modes by specifying a frequency range of interest.

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`

).

**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.

`Reduced orders`

— Number of states in reduced model

integer | integer array

Specify the number of states in the reduced-order model. 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 .

For more information, see Balanced Truncation Model Reduction.

**Example: **`5`

**Example: **`4:7`

**Example: **`[3,7,10]`

`Error Bound`

— Type of error bound

`absolute`

(default) | `relative`

You can choose between absolute and relative errors by selecting the
appropriate option in **Error Bound**. Setting it to
`absolute`

controls the absolute error $${\Vert G-{G}_{r}\Vert}_{\infty}$$ while setting it to `relative`

controls the relative error $${\Vert {G}^{-1}\left(G-{G}_{r}\right)\Vert}_{\infty}$$. Relative error gives a better match across frequency
while absolute error emphasizes areas with most gain.

For more information, see Balanced Truncation Model Reduction.

`Preserve DC Gain`

— Match DC gain of reduced model to original model

checked (default) | unchecked

When **Preserve DC Gain** is checked, the DC gain of the
reduced model equals the DC gain of the original model. When the DC behavior
of the model is important in your application, leave this option checked.
Uncheck the option to get better matching of higher-frequency
behavior.

For more information, see Balanced Truncation Model Reduction.

`Focus on range`

— Limit analysis to specified frequencies

unchecked (default) | checked

By default, Model Reducer analyzes Hankel singular values
across all frequencies. Restricting this analysis to a particular frequency
range is useful when you know the model has modes outside the region of
interest to your particular application. When you apply a frequency limit,
Model Reducer determines which states are the low-energy
states to truncate based on their energy contribution within the specified
frequency range only. **Focus on range** is only available
when **Error Bound** is set to
`absolute`

.

To limit the analysis of state contributions to a particular frequency
range, check **Focus on range**. Then, drag the vertical
cursors on the response plot to specify the frequency range of interest.
Alternatively, enter a frequency range in the text box as a vector of the
form `[fmin,fmax]`

. Units are
`rad/TimeUnit`

, where `TimeUnit`

is
the `TimeUnit`

property of the model you are
reducing.

**Mode Selection 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`

).

For more information, see Mode-Selection 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.

`Lower Cutoff`

— Lowest mode frequency

positive scalar

Enter the frequency of the slowest dynamics to preserve in the reduced model. Poles with natural frequency below this cutoff are eliminated from the reduced model.

`Upper Cutoff`

— Highest mode frequency

positive scalar

Enter the frequency of the fastest dynamics to preserve in the reduced model. Poles with natural frequency above this cutoff are eliminated from the reduced model.

**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.

## 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`

).

`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**

### 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)