# xelim

## Description

simplifies the state-space model `rsys`

= xelim(`sys`

,`elim`

)`sys`

by eliminating the states
specified in the vector `elim`

. The full state vector
*x* is partitioned as *x* =
[*x*_{1};*x*_{2}]
where *x*_{1} is the reduced state vector and
*x*_{2} 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.

## Examples

### Order Reduction by Matched-DC-Gain and Direct-Deletion Methods

Consider the following continuous fourth-order model.

$$h(s)=\frac{{s}^{3}+11{s}^{2}+36s+26}{{s}^{4}+14.6{s}^{3}+74.96{s}^{2}+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.

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

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")

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.

## Input Arguments

`sys`

— Dynamic system model

dynamic system model

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.

`elim`

— State elimination vector

vector

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.

`method`

— State elimination method

`"MatchDC"`

(default) | `"Truncate"`

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*x*_{2}as infinitely fast and sets its derivative to zero. The resulting algebraic equation is used to express*x*_{2}in terms of*x*_{1}and eliminate it. For details, see Algorithms`"Truncate"`

— Simply drop*x*_{2}, and use*x*_{1}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

`rsys`

— Reduced-order model

state-space model

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

## Algorithms

For a state-space model

$$\begin{array}{l}\dot{x}=Ax+Bu\\ y=Cx+Du\end{array}$$

the function partitions the state vector into *x _{1}*
(to keep) and

*x*(to eliminate).

_{2}$$\begin{array}{l}\left[\begin{array}{c}{\dot{x}}_{1}\\ {\dot{x}}_{2}\end{array}\right]=\left[\begin{array}{cc}{A}_{11}& {A}_{12}\\ {A}_{21}& {A}_{22}\end{array}\right]\left[\begin{array}{c}{x}_{1}\\ {x}_{2}\end{array}\right]+\left[\begin{array}{c}{B}_{1}\\ {B}_{2}\end{array}\right]u\\ y=\left[\begin{array}{cc}{C}_{1}& {C}_{2}\end{array}\right]x+Du\end{array}$$

`"MatchDC"`

Method

For continuous-time models, this method sets the derivative of
*x _{2}* to zero and solves the resulting equation
for

*x*. The reduced-order model is given by

_{1}$$\begin{array}{l}{\dot{x}}_{1}=\left[{A}_{11}-{A}_{12}{A}_{22}{}^{-1}{A}_{21}\right]{x}_{1}+\left[{B}_{1}-{A}_{12}{A}_{22}{}^{-1}{B}_{2}\right]u\\ y=\left[{C}_{1}-{C}_{2}{A}_{22}{}^{-1}{A}_{21}\right]x+\left[D-{C}_{2}{A}_{22}{}^{-1}{B}_{2}\right]u\end{array}$$

Similarly, for discrete-time models, the algorithm sets $${x}_{2}[n+1]={x}_{2}[n]$$ to recompute the matrices.

`xelim`

returns a scaled version of this realization. To disable this
scaling, set `sys.Scaled`

to `true`

before eliminating the
states.

`"Truncate"`

Method

For this method, the algorithm simply drops
*x*_{2}, and uses
*x*_{1} as reduced state. The reduced-order model is
given by

$$\begin{array}{l}{\dot{x}}_{1}={A}_{11}{x}_{1}+{B}_{1}u\\ y={C}_{1}{x}_{1}\end{array}$$

`xelim`

returns a scaled version of this realization. To disable this
scaling, set `sys.Scaled`

to `true`

before eliminating the
states.

## Version History

**Introduced in R2023b**

## See Also

## Apri esempio

Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?

## Comando MATLAB

Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:

Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)