Main Content


(Not recommended) Eliminate states from state-space models

modred is not recommended. Use xelim instead. (since R2023b).


rsys = modred(sys,elim)
rsys = modred(sys,elim,'method')


rsys = modred(sys,elim) reduces the order of a continuous or discrete state-space model sys by eliminating the states found 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 discarded.

elim can be a vector of indices or a logical vector commensurate with X where true values mark states to be discarded. This function is usually used in conjunction with balreal. Use balreal to first isolate states with negligible contribution to the I/O response. If sys has been balanced with balreal and the vector g of Hankel singular values has M small entries, you can use modred to eliminate the corresponding M states. For example:

[sys,g] = balreal(sys)  % Compute balanced realization
elim = (g<1e-8)         % Small entries of g are negligible states
rsys = modred(sys,elim) % Remove negligible states

rsys = modred(sys,elim,'method') also specifies the state elimination method. Choices for 'method' include

  • 'MatchDC' (default): Enforce matching DC gains. The state-space matrices are recomputed as described in Algorithms.

  • 'Truncate': Simply delete X2.

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

If the state-space model sys has been balanced with balreal and the Gramians have m small diagonal entries, you can reduce the model order by eliminating the last m states with modred.


collapse all

Consider the following continuous fourth-order model.

h ( s ) = s 3 + 1 1 s 2 + 3 6 s + 2 6 s 4 + 1 4 . 6 s 3 + 7 4 . 9 6 s 2 + 1 5 3 . 7 s + 9 9 . 6 5 .

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.

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 modred, using both matched-DC-gain and direct-deletion methods.

hmdc = modred(hb,2:4,'MatchDC');
hdel = modred(hb,2:4,'Truncate');

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


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


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


The algorithm for the matched DC gain method is as follows. For continuous-time models


the state vector is partitioned into x1, to be kept, and x2, to be eliminated.


Next, the derivative of x2 is set to zero and the resulting equation is solved for x1. The reduced-order model is given by


The discrete-time case is treated similarly by setting


modred returns a scaled version of this realization. To disable this scaling, set sys.Scaled to true before eliminating the states.

Version History

Introduced before R2006a

collapse all

R2023b: Not recommended

modred is not recommended. Use xelim to simplify models by eliminating states.