Main Content

xelim

Eliminate states from state-space models

Since R2023b

    Description

    rsys = xelim(sys,elim) simplifies the state-space model sys by eliminating the states specified in the vector elim. The full state vector x is partitioned as x = [x1;x2] where x1 is the reduced state vector and x2 is eliminated.

    This function is useful to eliminate states known to settle quickly (fast modes) or contribute little to the input/output map. When you don’t know which states to eliminate, use reducespec and the model-order reduction workflow.

    rsys = xelim(sys,elim,method) also specifies the elimination method. Set method to either "MatchDC" or "Truncate".

    example

    Examples

    collapse all

    Consider the following continuous fourth-order model.

    h(s)=s3+11s2+36s+26s4+14.6s3+74.96s2+153.7s+99.65.

    To reduce its order, first compute a balanced state-space realization with balreal.

    h = tf([1 11 36 26],[1 14.6 74.96 153.7 99.65]);
    [hb,g] = balreal(h);

    Examine the Gramians.

    g'
    ans = 1×4
    
        0.1394    0.0095    0.0006    0.0000
    
    

    The last three diagonal entries of the balanced Gramians are relatively small. Eliminate these three least-contributing states with xelim, using both matched DC gain and direct-deletion methods.

    hmdc = xelim(hb,2:4,"MatchDC");
    hdel = xelim(hb,2:4,"Truncate");

    Both hmdc and hdel are first-order models. Compare their Bode responses against that of the original model.

    bp = bodeplot(h,hmdc,'r--',hdel,'k-.');
    bp.PhaseMatchingEnabled = 'on';
    legend("Original","State elimination (match DC)",...
        "State elimination (truncate)");

    MATLAB figure

    The reduced-order model hdel is clearly a better frequency-domain approximation of h. Now compare the step responses.

    stepplot(h,hmdc,'r--',hdel,'k-.')
    legend("Original","State elimination (match DC)",...
        "State elimination (truncate)",Location="southeast");

    MATLAB figure

    While hdel accurately reflects the transient behavior, only hmdc gives the true steady-state response.

    For faster and more accurate results, use reducespec for model reduction workflows.

    Since R2024a

    This example shows how to use findop to find the matching initial condition for a reduced model obtained with xelim.

    Create a random state-space model.

    rng(0)
    sys = rss(10,1,2);

    To reduce its order, first compute a balanced state-space realization with balreal.

    [sysb,g] = balreal(sys);
    g'
    ans = 1×10
    
       13.2301    4.9468    1.0334    0.4597    0.0644    0.0287    0.0057    0.0007    0.0000    0.0000
    
    

    Based on the small Gramians, you can eliminate last 6 states from balanced realization sysb.

    rsys = xelim(sysb,5:10,"MatchDC");

    With MatchDC option, the reduced model states may differ from x1 because xelim scales and sometimes transforms the states x to obtain the reduced model. Therefore, the initial conditions of the original model and reduced model may be different.

    Compute the initial condition of the original and reduced models.

    op = findop(sysb,u=[1 -1]);
    opr = findop(rsys,u=[1 -1]);
    op.x(1:4)
    ans = 4×1
    
       18.9852
       -3.2735
        1.6693
        0.5918
    
    
    opr.x
    ans = 4×1
    
       18.9852
       -3.2735
        0.8347
        0.5918
    
    

    The initial states for both models are different. Therefore, it is recommended to recompute the operating condition when reducing models. Using operating conditions of the original model with the reduced model may result in incorrect responses. For example, compare the initial response of the reduced model with the operating condition from the original model.

    t = 0:0.01:5;
    y = initial(sysb,op.x,t);
    y1 = initial(rsys,op.x(1:4),t);
    y2 = initial(rsys,opr.x,t);
    plot(t,y,t,y1,'k:',t,y2,'r--')
    legend("Original","Reduced (original IC)", "Reduced (recomputed IC)");

    Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent Original, Reduced (original IC), Reduced (recomputed IC).

    Input Arguments

    collapse all

    Dynamic system model, specified as an ordinary or sparse LTI model.

    The input model must have a valid state-space representation, such as tf, ss, sparss, mechss models. For generalized or uncertain state-space models (genss, uss), the function uses the current value of the model. For identified models (idss), the function uses the identified value.

    State elimination vector, specified as one of these.

    • A vector containing index values of states you want to discard.

    • A vector of logical values of the same size as the number of states, where the true (1) values specifies the states you want to discard.

    State elimination method, specified as "MatchDC" or "Truncate". This argument specifies how the function eliminates the states with weak contribution.

    • "MatchDC" — Enforce matching DC gains. To do so, the algorithm treats x2 as infinitely fast and sets its derivative to zero. The resulting algebraic equation is used to express x2 in terms of x1 and eliminate it. For details, see Algorithms

    • "Truncate" — Simply drop x2, and use x1 as reduced state.

    The "Truncate" option tends to produce a better approximation in the frequency domain, but the DC gains are not guaranteed to match.

    Output Arguments

    collapse all

    Reduced-order model, returned as a state-space model.

    Algorithms

    collapse all

    For a state-space model

    x˙=Ax+Buy=Cx+Du

    the function partitions the state vector into x1 (to keep) and x2 (to eliminate).

    [x˙1x˙2]=[A11A12A21A22][x1x2]+[B1B2]uy=[C1C2]x+Du

    "MatchDC" Method

    For continuous-time models, this method sets the derivative of x2 to zero and solves the resulting equation for x1. The reduced-order model is given by

    x˙1=[A11A12A221A21]x1+[B1A12A221B2]uy=[C1C2A221A21]x+[DC2A221B2]u

    Similarly, for discrete-time models, the algorithm sets x2[n+1]=x2[n] to recompute the matrices.

    These equations of the algorithm describe only the general idea. The function performs additional scaling and eliminates only a portion of x2 when A22 or A22E22 is nearly singular. This alters x1 and the original initial condition x1(0) is not valid. You can use the findop function to compute matching initial conditions for the reduced model. For an example, see Find Matching Initial Condition for Reduced Model.

    "Truncate" Method

    For this method, the algorithm simply drops x2, and uses x1 as reduced state. The reduced-order model is given by

    x˙1=A11x1+B1uy=C1x1

    xelim returns a scaled version of this realization.

    Version History

    Introduced in R2023b