Reduce Model Order
Reduce complexity of linear time-invariant (LTI) models in the Live Editor
Description
The Reduce Model Order task lets you interactively compute reduced-order approximations of high-order models while preserving model characteristics that are important to your application. The task automatically generates MATLAB® code for your live script. For more information about Live Editor tasks generally, see Add Interactive Tasks to a Live Script.
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. You can also use model reduction to simplify a full-order controller. For more information about model reduction and when it is useful, see Model Reduction Basics.
To get started, select a model to reduce and a model-reduction method. For each method, the task gives you controls and plots that help you ensure that your reduced model preserves dynamics that are important for your application.
Balanced Truncation— Compute a lower order approximation of your model by removing 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.
The model-reduction code that Reduce Model Order generates uses the following functions.

Open the Task
To add the Reduce Model Order task to a live script in the MATLAB Editor:
On the Live Editor tab, select Task > Reduce Model Order.
In a code block in your script, type a relevant keyword, such as
reduce,balred, orminreal. SelectReduce Model Orderfrom the suggested command completions.
Parameters
Choose the model to reduce. The list of available models includes proper
tf, ss, or zpk models
in the MATLAB workspace. The model can be SISO or MIMO, and continuous or discrete.
Continuous-time models cannot have time delays. To reduce a continuous-time model with time delays, first use
padeto approximate the time delays as model dynamics.Discrete-time models can have time delays. For the
Balanced Truncationreduction method, the task usesabsorbDelayto convert the delay into poles at z = 0 before reducing the model.
Note
Reduce Model Order assumes that the model time
unit (specified in the TimeUnit property of the model) is seconds.
For the Balanced Truncation and Mode
Selection methods, if your model does not have TimeUnit =
'seconds', use chgTimeUnit to convert the model to
seconds.
For each method, the Reduce Model Order task gives you controls and plots that help you ensure that your reduced model preserves dynamics that are important for your application.
Balanced Truncation— Compute a lower order approximation of your model by removing states with relatively small energy contributions. To use this method, specify the number of states (order) in the reduced model. The Hankel singular-value plot visualizes the relative energy contribution of each state in the original model. The task discards states with lower energy than the state you select in this plot. This method generates code that uses thereducespec,process, andgetrom (balanced)commands.For discrete-time model that has time delays, Reduce Model Order uses
absorbDelayto convert the delay into poles at z = 0 before reducing the model by balanced truncation. The additional states are reflected in the response plot and Hankel singular-value plot.Modal Truncation— Select modes by specifying a frequency range of interest, damping, and DC contributions. The task discards dynamics that fall outside the region you specify. This method generates code that uses thereducespec,process, andgetrom (modal)commands.Pole-Zero Simplification— Eliminate canceling or near-canceling pole-zero pairs. The task discards pole-zero pairs that cancel with the threshold specified by the Tolerance parameter. Increase the tolerance to discard more states. This method generates code that uses theminrealcommand.
Balanced Truncation Parameters
Specify the model order reduction criteria, specified as one of the following:
Order— Desired order of the reduced-order model, specified as a positive integer.Maximum error— Maximum approximation error, specified as a nonnegative scalar or vector. The app selects the order using the error bound <Error(r+1)= which is not exact and not always tight. As a result, smaller orders may still meet the specifiedMaximum error, so you can try smaller orders when seeking the lowest possible order compatible withMaximum error.Minimum energy— Minimum bound on the normalized energy, specified as a nonnegative scalar or vector. The app discards all the states that have normalized energies lower than the specified value.Maximum loss— Maximum energy loss as a fraction of total energy, specified as a nonnegative scalar or vector. The app selects the lowest order with loss below the specified value.
Any value is permitted that falls between the number of unstable states in the model and the number of states in the original model.
Match the DC gain of the reduced model to that of the original model. Select Preserve DC Gain when the DC behavior of the model is important in your application. Clear the parameter to get better matching of higher frequency behavior. For more information, see Balanced Truncation Model Reduction.
Choose between absolute and relative error bounds. The absolute error is while the relative error is . Relative error gives a better match across frequency while absolute error emphasizes areas with most gain.
Regularization level value that ensures a well-defined relative error at all
frequencies. When you select Control relative error, Reduce Model Order
reduces the model [sys,alpha*I] instead of sys.
Clear this option to let Reduce Model Order pick a suitable alpha value.
Enable this option to specify a value alpha >= 0 to override this
default.
By default, Reduce Model Order 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, Reduce Model Order determines which states are the low-energy states to truncate based on their energy contribution within the specified frequency range only.
To limit the analysis of state contributions to a particular frequency range, click
Add. Then, enter the minimum and maximum frequencies in the text
boxes. The unit is rad/s. Alternatively, drag the vertical cursors on
the response plot to specify the frequency range of interest. If your model does not
have TimeUnit = 'seconds', use chgTimeUnit to convert the model to seconds.
Specify time intervals for computing time-limited Hankel singular values. When identifying low-energy states to truncate, the software computes state contributions to the system’s impulse response in these time intervals only.
To limit the analysis of state contributions to a particular time range, click
Add. Then, enter the minimum and maximum times in the text boxes.
The unit is seconds. If your model does not have TimeUnit =
'seconds', use chgTimeUnit to convert the model to
seconds.
Offset for the stable/unstable boundary, specified as a positive scalar value. In the stable/unstable decomposition, the stable term includes only poles satisfying
Re(s) < -Offset × max(1,|Im(s)|)(continuous time)|z| < 1 - Offset(discrete time)
Increase the value of Offset to treat poles close to
the stability boundary as unstable.
Maximum accuracy loss factor in stable and unstable decomposition, specified as a
positive scalar. For models with unstable poles, the algorithm first extracts the stable
dynamics using the transformation. Use this options to control the decomposition
accuracy. Increasing tolerance helps separate nearby stable and unstable modes at the
expense of accuracy. For more information, see stabsep.
Reduce Model Order shows you a comparison of the frequency responses between the original and reduced models. You can use this plot to monitor the match between the original and reduced-order models while you experiment with model-reduction parameter values. Available comparison plots are:
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 .Relative error plot— Plot the frequency response of relative error .
Modal Truncation Parameters
Frequency range of interest, specified as a range [Fmin,Fmax]. The algorithm discards all the modes outside this range. You can also use the vertical cursors on the response plot to specify the range.
Damping range of interest, specified as a range [ζmin,ζmax]. The algorithm discards all the modes outside this range.
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. You can also use the horizontal cursor on the DC contribution plot to specify this value.
Preserve the DC gain (steady-state value of step response) to match the time response better. Clear the parameter to get better matching of higher frequency behavior.
When you enable this option, the software computes only the pole locations, damping, and natural frequency of the poles. When disabled, the software computes a full modal decomposition.
Frequency for evaluating and matching DC contributions, specified as a nonnegative scalar. For models with integrators, you cannot evaluate modal contributions at DC since the DC gain is infinite. To evaluate modal contributions and match gains at a different frequency, set the option to a positive value. The default value of this option corresponds to the DC contributions.
Relative accuracy of modal decomposition, specified as a scalar between 0 and 1.
This option limits the condition number of the block diagonalizing transformation to
roughly SepTol/eps. Increasing
SepTol helps yield smaller modal components at the expense of
accuracy.
Reduce Model Order shows you a comparison of the frequency responses between the original and reduced models. You can use this plot to monitor the match between the original and reduced-order models while you experiment with model-reduction parameter values. Available comparison plots are:
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 .Relative error plot— Plot the frequency response of relative error .
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 Parameters
Specify the margin for pole-zero cancellation. Pole-zero pairs that cancel within this tolerance are removed from the reduced model. You can use the slider to change the tolerance and observe the results in a response plot.
Results Parameters
Reduce Model Order generates code that shows the response of the original and reduced systems on the plot type you specify. Available plots include:
Step response
Impulse response
Bode plot
Singular value (sigma) plot
Pole-zero plot
Version History
Introduced in R2019bYou can now specify multiple time and frequency intervals to limit the analysis of state contributions to those intervals when using the Balanced Truncation method. Previously, Reduce Model Order supported only a single frequency interval and no time intervals..
The Reduce Model Order task 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.
See Also
Functions
Apps
Topics
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)