# stabsep

Stable-unstable decomposition

## Syntax

```[GS,GNS]=stabsep(G) [G1,GNS] = stabsep(G,'abstol',ATOL,'reltol',RTOL) [G1,G2]=stabsep(G, ...,'Mode', MODE,'Offset', ALPHA) [G1,G2] = stabsep(G, opts) ```

## Description

`[GS,GNS]=stabsep(G)` decomposes the LTI model `G` into its stable and unstable parts

``` G = GS + GNS ```

where `GS` contains all stable modes that can be separated from the unstable modes in a numerically stable way, and `GNS` contains the remaining modes. `GNS` is always strictly proper.

```[G1,GNS] = stabsep(G,'abstol',ATOL,'reltol',RTOL)``` specifies absolute and relative error tolerances for the stable/unstable decomposition. The frequency responses of `G` and ```GS + GNS``` should differ by no more than `ATOL+RTOL*abs(G)`. Increasing these tolerances helps separate nearby stable and unstable modes at the expense of accuracy. The default values are `ATOL=0` and `RTOL=1e-8`.

```[G1,G2]=stabsep(G, ...,'Mode', MODE,'Offset', ALPHA)``` produces a more general stable/unstable decomposition where `G1` includes all separable poles lying in the regions defined using offset `ALPHA`. This can be useful when there are numerical accuracy issues. For example, if you have a pair of poles close to, but slightly to the left of the jω-axis, you can decide not to include them in the stable part of the decomposition if numerical considerations lead you to believe that the poles may be in fact unstable

This table lists the stable/unstable boundaries as defined by the offset `ALPHA`.

Mode

Continuous Time Region

Discrete Time Region

`1`

`Re(s)<-ALPHA*max(1,|Im(s)|) `

` 1 |z| < 1-ALPHA`

`2`

`Re(s)> ALPHA*max(1,|Im(s)|) `

` 2 |z| > 1+ALPHA`

The default values are `MODE=1` and `ALPHA=0`.

```[G1,G2] = stabsep(G, opts)``` computes the stable/unstable decomposition of `G` using the options specified in the `stabsepOptions` object `opts`.

## Examples

Compute a stable/unstable decomposition with absolute error no larger than 1e-5 and an offset of 0.1:

```h = zpk(1,[-2 -1 1 -0.001],0.1) [hs,hns] = stabsep(h,stabsepOptions('AbsTol',1e-5,'Offset',0.1)); ```

The stable part of the decomposition has poles at -1 and -2.

```hs Zero/pole/gain: -0.050075 (s+2.999) ------------------- (s+1) (s+2) ```

The unstable part of the decomposition has poles at +1 and -.001 (which is nominally stable).

```hns Zero/pole/gain: 0.050075 (s-1) --------------- (s+0.001) (s-1) ```