Main Content

balred

(Not recommended) Model order reduction

    balred and balredOptions are not recommended. Use reducespec instead. (since R2023b) For more information on updating your code, see Compatibility Considerations.

    Description

    [rsys,info] = balred(sys,order) computes a reduced-order approximation 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. balred also returns a structure info with additional information like the Hankel singular values (HSV), error bound, regularization level and the Cholesky factors of the gramians.

    [~,info] = balred(sys) returns the structure info without computing the reduced-order model. You can use this information to select the reduced order order based on your desired fidelity.

    Note

    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 reduced-order model.

    example

    [___] = balred(___,opts) computes the reduced model using the options set opts that you specify using 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 option set opts.

    balred(sys) displays the Hankel singular values and approximation error on a plot. Use hsvplot to customize this plot.

    Examples

    collapse all

    Compute a reduced-order approximation of the system given by:

    G ( s ) = ( s + 0 . 5 ) ( s + 1 . 1 ) ( s + 2 . 9 ) ( s + 1 0 - 6 ) ( s + 1 ) ( s + 2 ) ( s + 3 ) .

    Create the model.

    sys = zpk([-0.5 -1.1 -2.9],[-1e-6 -2 -1 -3],1);

    Exclude the pole at s = 1 0 - 6 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.

    balred(sys,opts)

    The red HSV 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 rsys.

    Compare the responses of the original and reduced-order models.

    bodeplot(sys,rsys,'r--')

    Observe that the bode response of the original model and the reduced-order model nearly match.

    Input Arguments

    collapse all

    Dynamic system, specified as a SISO or MIMO dynamic system model. Dynamic systems that you can use can be continuous-time or discrete-time numeric LTI models, such as tf, zpk, or ssmodels.

    When sys has unstable poles, balred decomposes sys to its stable and unstable parts and only the stable part is approximated. Use 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.

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

    You can also use the Hankel singular values and error bound information to select the reduced-model order based on the desired model fidelity.

    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.

    See balredOptions to create and configure the option set opts.

    Output Arguments

    collapse all

    Reduced-order model, returned as a dynamic system model or an array of dynamic system models.

    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, sys is replaced by [sys,⍴*I] or [sys;⍴*I] that ensures a well-defined relative error at all frequencies.

    • Rr, Ro — Cholesky factors of gramians.

    Algorithms

    1. balred first decomposes G into its stable and unstable parts:

      G=Gs+Gu

    2. When you specify ErrorBound as absolute, balred uses the balanced truncation method of [1] to reduce Gs. This computes the Hankel singular values (HSV) σj based on the controllability and observability gramians. For order r, the absolute error GsGr is bounded by 2j=r+1nσj. Here, n is the number of states in Gs.

    3. When you specify ErrorBound as relative, balred uses the balanced stochastic truncation method of [2] to reduce Gs. For square Gs, this computes the HSV σj of the phase matrix F=(W')1G where W(s) is a stable, minimum-phase spectral factor of GG’:

      W'(s)W(s)=G(s)G'(s)

      For order r, the relative error Gs1(GsGr) is bounded by:

      j=r+1H(1+σj1σj)12j=r+1nσj

      when, 2j=r+1nσj1.

    Alternative Functionality

    Live Editor Task

    Reduce Model Order

    References

    [1] Varga, A., "Balancing-Free Square-Root Algorithm for Computing Singular Perturbation Approximations," Proc. of 30th IEEE CDC, Brighton, UK (1991), pp. 1062-1065.

    [2] Green, M., "A Relative Error Bound for Balanced Stochastic Truncation", IEEE Transactions on Automatic Control, Vol. 33, No. 10, 1988

    Version History

    Introduced before R2006a

    expand all

    R2023b: Not recommended

    balred and balredOptions are not recommended. To perform balanced truncation model order reduction, use the reducespec function with the following syntax.

    R = reducespec(sys,"balanced");

    For the full workflow, see Task-Based Model Order Reduction Workflow.