Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Balanced truncation computes a lower-order approximation of your model by neglecting
states that have relatively low effect on the overall model response. Using a
lower-order approximation that preserves the dynamics of interest can simplify analysis
and control design. In the balanced truncation method of model reduction, the software
measures state contributions by Hankel singular values (see `hsvd`

) and discards states with smaller values. There are two ways to
compute a reduced-order model by balanced truncation:

At the command line, using the

`balred`

command.In the

**Model Reducer**, using the**Balanced Truncation**method.

For more general information about model reduction, see Model Reduction Basics.

**Model Reducer** provides an interactive tool for performing model
reduction and examining and comparing the responses of the original and
reduced-order models. To approximate a model by balanced truncation in **Model
Reducer**:

Open the app, and import an LTI model to reduce. For instance, suppose that there is a model named

`build`

in the MATLAB^{®}workspace. The following command opens**Model Reducer**and imports the model.modelReducer(build)

In the

**Data Browser**, select the model to reduce. Click**Balanced Truncation**.In the

**Balanced Truncation**tab,**Model Reducer**displays a plot of the frequency response of the original model and a reduced version of the model. The frequency response is a Bode plot for SISO models, and a singular-value plot for MIMO models. The app also displays a Hankel singular-value plot of the original model.The Hankel singular-value plot shows the relative energy contributions of each state in the system.

**Model Reducer**computes an initial reduced-order model based on these values. The highlighted bar is the lowest-energy state in the initial reduced-order model.**Model Reducer**discards states that have lower Hankel singular values than the highlighted bar.Try different reduced-model orders to find the lowest-order model that preserves the dynamics that are important for your application. To specify different orders, either:

Enter model orders in the

**Reduced model orders**field. You can enter a single integer or an array of integers, such as`10:14`

or`[8,11,12]`

.Click a bar on the Hankel singular-value plot to specify the lowest-energy state of the reduced-order model. Ctrl-click to specify multiple values.

When you change the specified reduced model order,

**Model Reducer**automatically computes a new reduced-order model. If you specify multiple model orders,**Model Reducer**computes multiple reduced-order models and displays their responses on the plot.Optionally, examine the absolute or relative error between the original and reduced-order model, in addition to the frequency response. Select the error-plot type using the buttons on the

**Balanced Truncation**tab.For more information about using the analysis plots, see Visualize Reduced-Order Models in the Model Reducer App.

If low-frequency dynamics are not important to your application, you can clear the

**Preserve DC Gain**checkbox. Doing so sometimes yields a better match at higher frequencies between the original and reduced-order models.When you check or clear the

**Preserve DC Gain**checkbox,**Model Reducer**automatically computes new reduced-order models. For more information about this option, see Compare Truncated and DC Matched Low-Order Model Approximations.Optionally, limit the Hankel singular-value computation to a specific frequency range. Such a limit is useful when the model has modes outside the region of interest to your particular application. When you apply a frequency limit,

**Model Reducer**determines which states to truncate based on their energy contribution within the specified frequency range only. Neglecting energy contributions outside that range can yield an even lower-order approximation that is still adequate for your application.To limit the singular-value computation, check

**Select frequency range**. Then, specify the frequency range by:In the text box, entering a vector of the form

`[fmin,fmax]`

. Units are`rad/TimeUnit`

, where`TimeUnit`

is the`TimeUnit`

property of the model you are reducing.On the response plot or error plot, dragging the boundaries of the shaded region or the shaded region itself.

**Model Reducer**analyzes the state contributions within the shaded region only.

When you check or clear the

**Select frequency range**checkbox or change the selected range,**Model Reducer**automatically computes new reduced-order models.### Note

Checking

**Select frequency range**automatically clears**Preserve DC Gain**. To enforce a DC match even when using frequency limits, recheck**Preserve DC Gain**.When you have one or more reduced models that you want to store and analyze further, click . The new models appear in the

**Data Browser**. If you have specified multiple orders, each reduced model appears separately. Model names reflect the reduced model order.After creating reduced models in the

**Data Browser**, you can continue changing the reduction parameters and create reduced models with different orders for analysis and comparison.

You can now perform further analysis with the reduced model. For example:

Examine other responses of the reduced system, such as the step response or Nichols plot. To do so, use the tools on the

**Plots**tab. See Visualize Reduced-Order Models in the Model Reducer App for more information.Export reduced models to the MATLAB workspace for further analysis or control design. On the

**Model Reducer**tab, click**Export**.

To create a MATLAB script you can use for further model-reduction
tasks at the command line, click **Create Reduced Model**,
and select **Generate MATLAB Script**.

**Model Reducer** creates a script that uses the `balred`

command to perform
model reduction with the parameters and options you have set on the
**Balanced Truncation** tab. The script opens in the
MATLAB editor.

At the command-line, use `balred`

to compute a reduced-order approximation of a model.

To do so, first examine the contribution of the various states to the overall model behavior. Choose the approximation order based on the number of states that make a significant contribution to the overall model behavior.

For this example, load a high-order model. `hplant`

is a 23rd-order SISO model.

load ltiexamples hplant order(hplant)

ans = 23

Examine the relative amount of energy per state in `hplant`

using a Hankel singular-value (HSV) plot.

hsvplot(hplant)

Small Hankel singular values indicate that the associated states contribute little to the behavior of the system. The plot shows that two states account for most of the energy in the system. Therefore, try simplifying the model to just first or second order.

opts = balredOptions('StateElimMethod','Truncate'); hplant1 = balred(hplant,1,opts); hplant2 = balred(hplant,2,opts);

The second argument to `balred`

specifies the target approximation order, so that `hplant1`

is a first-order approximation and `hplant2`

is a second-order approximation of `hplant`

. By default, `balred`

discards the states with the smallest Hankel singular values, and alters the remaining states to preserve the DC gain of the system. Setting the `StateElimMethod`

option to `Truncate`

causes `balred`

to discard low-energy states without altering the remaining states.

When working with reduced-order models, it is important to verify that the approximation does not introduce inaccuracies at frequencies that are important for your application. Therefore, compare the frequency responses of the original and approximated systems. For MIMO systems, use the `sigmaplot`

command. For this SISO system, examine a Bode plot.

bodeplot(hplant,hplant2,hplant1) legend('Original','2nd order','1st order')

The second-order approximation `hplant2`

matches the original 23rd-order system very well, especially at lower frequencies. The first-order system does not match as well.

In general, as you decrease the order of the approximated model, the frequency response of the approximated model begins to differ from the original model. Choose an approximation that is sufficiently accurate in the bands that are important to you. For example, in a control system you might want good accuracy inside the control bandwidth. Accuracy at frequencies far above the control bandwidth, where the gain rapidly rolls off, might be less important.

You can also validate the approximation in the time domain. For instance, examine the step responses of the original and reduced-order systems.

stepplot(hplant,hplant2,'r--',hplant1,'g--') legend('Original','2nd order','1st order','Location','SouthEast')

This result confirms that the second-order approximation is a good match to the original 23rd-order system.

This example shows how to compute a low-order approximation in two ways and compares the results. When you compute a low-order approximation by the balanced truncation method, you can either:

Discard the states that make the smallest contribution to system behavior, altering the remaining states to preserve the DC gain of the system.

Discard the low-energy states without altering the remaining states.

Which method you choose depends on what dynamics are most important to your application. In general, preserving DC gain comes at the expense of accuracy in higher-frequency dynamics. Conversely, state truncation can yield more accuracy in fast transients, at the expense of low-frequency accuracy.

This example compares the state-elimination methods of the `balred`

command, `Truncate`

and `MatchDC`

. You can similarly control the state-elimination method in the **Model Reducer** app, on the **Balanced Truncation** tab, using the **Preserve DC Gain** check box, as shown.

Consider the following system.

Create a closed-loop model of this system from *r* to *y*.

G = zpk([0 -2],[-1 -3],1); C = tf(2,[1 1e-2]); T = feedback(G*C,1)

T = 2 s (s+2) -------------------------------- (s+0.004277) (s+1.588) (s+4.418) Continuous-time zero/pole/gain model.

`T`

is a third-order system that has a pole-zero near-cancellation close to *s* = 0. Therefore, it is a good candidate for order reduction by approximation.

Compute two second-order approximations to `T`

, one that preserves the DC gain and one that truncates the lowest-energy state without changing the other states. Use `balredOptions`

to specify the approximation methods, `MatchDC`

and `Truncate`

, respectively.

matchopt = balredOptions('StateElimMethod','MatchDC'); truncopt = balredOptions('StateElimMethod','Truncate'); Tmatch = balred(T,2,matchopt); Ttrunc = balred(T,2,truncopt);

Compare the frequency responses of the approximated models.

bodeplot(T,Tmatch,Ttrunc) legend('Original','DC Match','Truncate')

The truncated model `Ttrunc`

matches the original model well at high frequencies, but differs considerably at low frequency. Conversely, `Tmatch`

yields a good match at low frequencies as expected, at the expense of high-frequency accuracy.

You can also see the differences between the two methods by examining the time-domain response in different regimes. Compare the slow dynamics by looking at the step response of all three models with a long time horizon.

stepplot(T,Tmatch,'r--',Ttrunc,1500) legend('Original','DC Match','Truncate')

As expected, on long time scales the DC-matched approximation `Tmatch`

has a very similar response to the original model.

Compare the fast transients in the step response.

stepplot(T,Tmatch,'r',Ttrunc,'g--',0.5) legend('Original','DC Match','Truncate')

On short time scales, the truncated approximation `Ttrunc`

provides a better match to the original model. Which approximation method you should use depends on which regime is most important for your application.

This example shows how to compute a reduced-order approximation of a system when the system has unstable or near-unstable poles.

When computing a reduced-order approximation, the `balred`

command (or the **Model Reducer** app) does not eliminate unstable poles because doing so would fundamentally change the system dynamics. Instead, the software decomposes the model into stable and unstable parts and reduces the stable part of the model.

If your model has near-unstable poles, you might want to ensure that the reduced-order approximation preserves these dynamics. This example shows how to use the `Offset`

option of `balred`

to preserve poles that are close to the stable-unstable boundary. You can achieve the same result in the **Model Reducer** app, on the **Balanced Truncation** tab, under **Options**, using the **Offset** field, as shown:

Load a model with unstable and near-unstable poles.

load('reduce.mat','gasf35unst')

`gasf35unst`

is a 25-state SISO model with two unstable poles (Re(s) > 0). Examine the system poles to find the near-unstable poles.

pzplot(gasf35unst) axis([-0.0015 0.0015 -0.0005 0.0005])

The pole-zero plot shows several poles (marked by `x`

) that fall in the left half-plane, but relatively close to the imaginary axis. These are the near-unstable poles. Two of these fall within 0.0005 of instability. Three more fall within 0.001 of instability.

Examine a Hankel singular-value plot of the model.

hsvplot(gasf35unst)

The plot shows the two unstable modes, but you cannot easily determine the energy contribution of the near-unstable poles. In your application, you might want to reduce the model without discarding those poles nearest to instability, even if they are of relatively low energy. Use the `Offset`

option of `balred`

to calculate a reduced-order system that preserves the two stable poles that are closest to the imaginary axis. The `Offset`

option sets the boundary between poles that `balred`

can discard, and poles that `balred`

must preserve (treat as unstable).

```
opts = balredOptions('Offset',0.0005);
gasf_arr = balred(gasf35unst,[10 15],opts);
```

Providing `balred`

an array of target approximation orders `[10 15]`

causes `balred`

to return an array of approximated models. The array `gasf_arr`

contains two models, a 10th-order and a 15th-order approximation of `gasf35unst`

. In both approximations, `balred`

does not discard the two unstable poles or the two nearly-unstable poles.

Compare the reduced-order approximations to the original model.

` bodeplot(gasf35unst,gasf_arr,'r--')`

The 15th order approximation is a good frequency-domain match to the original model. However, the 10th-order approximation shows changes in high-frequency dynamics, which might be too large to be acceptable. The 15th-order approximation is likely a better choice.

Focusing the energy-contribution calculation on a particular frequency region sometimes yields a good approximation to the dynamics of interest at a lower order than a reduction that takes all frequencies into account. For this example, reduce a high-order model with a focus on the dynamics in a particular interval.

This example demonstrates frequency-limited balanced truncation at the command line, using options for the `balred`

command. You can also perform frequency-limited balanced truncation in the **Model Reducer** app, on the **Balanced Truncation** tab, using the **Select frequency range** check box, as shown.

Load a model and examine its frequency response.

load(fullfile(matlabroot,'examples','control','build.mat'),'G') bodeplot(G)

`G`

is a 48th-order model with several large peak regions around 5.2 rad/s, 13.5 rad/s, and 24.5 rad/s, and smaller peaks scattered across many frequencies. Examine the Hankel singular-value plot to see the energy contributions of the model's 48 states.

hsvd(G)

The singular-value plot suggests that you can discard at least 20 states without significant impact on the overall system response. Suppose that for your application you are only interested in the dynamics near the second large peak, between 10 rad/s and 22 rad/s. Try a few reduced-model orders based on the Hankel singular value plot. Compare their frequency responses to the original model, especially in the region of that peak.

G18 = balred(G,18); G10 = balred(G,10); bodeplot(G,G18,G10,logspace(0.5,1.5,100)); legend('Original','Order 18','Order 10');

The 18th-order model is a good match to the dynamics in the region of interest. In the 10th order model, however, there is some degradation of the match.

Focus the model reduction on the region of interest to obtain a good match with a lower-order approximation. First, examine the state energy contributions in that frequency region only. Use `hsvdOptions`

to specify the frequency interval for `hsvd`

.

```
hopt = hsvdOptions('FreqIntervals',[10,22]);
hsvd(G,hopt)
```

Comparing this plot to the previous Hankel singular-value plot shows that in this frequency region, many fewer states contribute significantly to the dynamics than contribute to the overall dynamics.

Try the same reduced-model orders again, this time choosing states to eliminate based only on their contribution to the frequency interval. Use `balredOptions`

to specify the frequency interval for `balred`

.

bopt = balredOptions('StateElimMethod','Truncate','FreqIntervals',[10,22]); GLim18 = balred(G,18,bopt); GLim10 = balred(G,10,bopt); bodeplot(G,GLim18,GLim10,logspace(0.5,1.5,100)); legend('Original','Order 18','Order 10');

With the frequency-limited energy computation, a 10th-order approximation is as good in the region of interest as the 18th-order approximation computed without frequency limits.