Model order reduction
computes a reduced-order approximation
info] = balred(
rsys of the LTI model
sys. The desired order (number of states) is specified by
order. You can try multiple orders at once by setting
order to a vector of integers, in which case
rsys is an array of reduced models.
returns a structure
info with additional information like the Hankel
singular values (HSV), error bound, regularization level and the Cholesky factors of the
When performance is a concern, avoid computing the Hankel singular values twice by
using the information obtained from the above syntax to select the desired model order
and then use
rsys = balred(sys,order,info) to compute the
[___] = balred(___,
computes the reduced model using the options set
opts that you
balredOptions. You can specify additional
options for eliminating states, using absolute vs. relative error control, emphasizing
certain time or frequency bands, and separating the stable and unstable modes. See
balredOptions to create and configure the
Reduced-Order Model using Hankel Singular Values
For this example, use the Hankel singular value plot to select suitable order and compute the reduced-order model.
For this instance, generate a random discrete-time state-space model with 40 states.
rng(0) sys = drss(40);
Plot the Hankel singular values using
For this example, select order of
16 since it is the first order with an absolute error less than
1e-4. In general, you select the order based on the desired absolute or relative fidelity. Then, compute the reduced-order model.
rsys = balred(sys,16);
Verify the absolute error by plotting the singular value response using
Observe from the plot that the error, represented by the red curve, is below
-80 dB (
Array of Reduced-Order Models
For this example, consider a random continuous-time state-space model with 65 states.
rng(0) sys = rss(65); size(sys)
State-space model with 1 outputs, 1 inputs, and 65 states.
Visualize the Hankel singular values on a plot.
For this instance, compute reduced-order models with 25, 30 and 35 states.
order = [25,30,35]; rsys = balred(sys,order); size(rsys)
3x1 array of state-space models. Each model has 1 outputs, 1 inputs, and between 25 and 35 states.
Reduced-Order Approximation with Offset Option
Compute a reduced-order approximation of the system given by:
Create the model.
sys = zpk([-0.5 -1.1 -2.9],[-1e-6 -2 -1 -3],1);
Exclude the pole at from the stable term of the stable/unstable decomposition. To do so, set the
Offset option of
balredOptions to a value larger than the pole you want to exclude.
opts = balredOptions('Offset',0.001,'StateProjection','Truncate');
Visualize the Hankel singular values (HSV) and the approximation error.
Observe that the first HSV is red which indicates that it is associated with an unstable mode.
Now, compute a second-order approximation with the specified options.
[rsys,info] = balred(sys,2,opts); rsys
rsys = 0.99113 (s+0.5235) ------------------- (s+1e-06) (s+1.952) Continuous-time zero/pole/gain model.
Notice that the pole at
-1e-6 appears unchanged in the reduced model
Compare the responses of the original and reduced-order models.
Observe that the bode response of the original model and the reduced-order model nearly match.
Model Reduction in a Particular Frequency Band
Reduce a high-order model with a focus on the dynamics in a particular frequency range.
Load a model and examine its frequency response.
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. 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. Focus the model reduction on the region of interest to obtain a good match with a low-order approximation. Use
balredOptions to specify the frequency interval for
bopt = balredOptions('StateProjection','Truncate','FreqIntervals',[10,22]); GLim10 = balred(G,10,bopt); GLim18 = balred(G,18,bopt);
Examine the frequency responses of the reduced-order models. Also, examine the difference between those responses and the original response (the absolute error).
subplot(2,1,1); bodemag(G,GLim10,GLim18,logspace(0.5,1.5,100)); title('Bode Magnitude Plot') legend('Original','Order 10','Order 18'); subplot(2,1,2); bodemag(G-GLim10,G-GLim18,logspace(0.5,1.5,100)); title('Absolute Error Plot') legend('Order 10','Order 18');
With the frequency-limited energy computation, even the 10th-order approximation is quite good in the region of interest.
Model-Order Reduction with Relative Error Approximation
For this example, consider the SISO state-space model
cdrom with 120 states. You can use absolute or relative error control when approximating models with
balred. This example compares the two approaches when applied to a 120-state model of a portable CD player device
Load the CD player model
load cdromData.mat cdrom size(cdrom)
State-space model with 1 outputs, 1 inputs, and 120 states.
To compare results with absolute vs. relative error control, create one option set for each approach.
opt_abs = balredOptions('ErrorBound','absolute','StateProjection','truncate'); opt_rel = balredOptions('ErrorBound','relative','StateProjection','truncate');
Compute reduced-order models of order 15 with both approaches.
rsys_abs = balred(cdrom,15,opt_abs); rsys_rel = balred(cdrom,15,opt_rel); size(rsys_abs)
State-space model with 1 outputs, 1 inputs, and 15 states.
State-space model with 1 outputs, 1 inputs, and 15 states.
Plot the Bode response of the original model along with the absolute-error and relative-error reduced models.
bo = bodeoptions; bo.PhaseMatching = 'on'; bodeplot(cdrom,'b.',rsys_abs,'r',rsys_rel,'g',bo) legend('Original (120 states)','Absolute Error (15 states)','Relative Error (15 states)')
Observe that the Bode response of:
The relative-error reduced model
rsys_relnearly matches the response of the original model
sysacross the complete frequency range.
The absolute-error reduced model
rsys_absmatches the response of the original model
sysonly in areas with the most gain.
A.Varga, “On stochastic balancing related model reduction”, Proceedings of the 39th IEEE Conference on Decision and Control (Cat. No.00CH37187), Sydney, NSW, 2000, pp. 2385-2390 vol.3, doi: 10.1109/CDC.2000.914156.
sys — Dynamic system
dynamic system model
sys has unstable poles,
sys to its stable and unstable parts and only the stable part is
balredOptions to specify additional
options for the stable/unstable decomposition.
balred does not support frequency response data models, uncertain
and generalized state-space models, PID models or sparse model objects.
order — Desired number of states
integer | vector of integers
Desired number of states, specified as an integer or a vector of integers. You can
try multiple orders at once by setting
order to a vector of
integers, in which case
rys is returned as an array of reduced
You can also use the Hankel singular values and error bound information to select the reduced-model order based on the desired model fidelity.
opts — Additional options for model reduction
Additional options for model reduction, specified as an options set. You can specify additional options for eliminating states, using absolute vs. relative error control, emphasizing certain time or frequency bands, and separating the stable and unstable modes.
balredOptions to create and configure
the option set
rsys — Reduced-order model
dynamic system model | array of dynamic system models
Reduced-order model, returned as a dynamic system model or an array of dynamic system models.
info — Additional information about the LTI model
Additional information about the LTI model, returned as a structure with the following fields:
HSV— Hankel singular values (state contributions to the input/output behavior). In state coordinates that equalize the input-to-state and state-to-output energy transfers, the Hankel singular values measure the contribution of each state to the input/output behavior. Hankel singular values are to model order what singular values are to matrix rank. In particular, small Hankel singular values signal states that can be discarded to simplify the model.
ErrorBound— Bound on absolute or relative approximation error.
info.ErrorBound(J+1)bounds the error for order J.
Regularization— Regularization level ⍴ (for relative error only). Here,
sysis replaced by
[sys;⍴*I]that ensures a well-defined relative error at all frequencies.
Ro— Cholesky factors of gramians.
balredfirst decomposes G into its stable and unstable parts:
When you specify
balreduses the balanced truncation method of  to reduce Gs. This computes the Hankel singular values (HSV) σj based on the controllability and observability gramians. For order r, the absolute error is bounded by . Here, n is the number of states in Gs.
When you specify
balreduses the balanced stochastic truncation method of  to reduce Gs. For square Gs, this computes the HSV σj of the phase matrix where W(s) is a stable, minimum-phase spectral factor of GG’:
For order r, the relative error is bounded by:
MatchDC option honored when specified frequency or time intervals exclude DC
Behavior changed in R2017b
When you use
balred for model reduction, you can use
balredOptions to restrict the computation to specified frequency or time
intervals. If the
StateProjection option of
balredOptions is set to
'MatchDC' (the default
balred attempts to match the DC gain of the original and
reduced models, even if the specified intervals exclude DC (frequency = 0 or time =
Prior to R2017b, if you specified time or frequency intervals that excluded DC,
balred did not attempt to match the DC gain of the original and
reduced models, even if
StateProjection = 'MatchDC'.
 Varga, A., "Balancing-Free Square-Root Algorithm for Computing Singular Perturbation Approximations," Proc. of 30th IEEE CDC, Brighton, UK (1991), pp. 1062-1065.
 Green, M., "A Relative Error Bound for Balanced Stochastic Truncation", IEEE Transactions on Automatic Control, Vol. 33, No. 10, 1988