# isStable

Determine stability of lag operator polynomial

## Syntax

```[indicator,eigenvalues] = isStable(A) ```

## Description

```[indicator,eigenvalues] = isStable(A)``` takes a lag operator polynomial object `A` and checks if it is stable. The stability condition requires that the magnitudes of all roots of the characteristic polynomial are less than 1 to within a small numerical tolerance.

## Input Arguments

 `A` Lag operator polynomial object, as produced by `LagOp`.

## Output Arguments

 `indicator` Boolean value for the stability test. `true` indicates that A(L) is stable and that the magnitude of all eigenvalues of its characteristic polynomial are less than one; `false` indicates that A(L) is unstable and that the magnitude of at least one of the eigenvalues of its characteristic polynomial is greater than or equal to one. `eigenvalues` Eigenvalues of the characteristic polynomial associated with A(L). The length of `eigenvalues` is the product of the degree and dimension of A(L).

## Examples

expand all

Divide two Lag Operator polynomial objects and check if the resulting polynomial is stable:

```A = LagOp({1 -0.6 0.08}); B = LagOp({1 -0.5}); [indicator,eigenvalues]=isStable(A\B)```
```indicator = logical 1 ```
```eigenvalues = 4×1 complex 0.3531 + 0.0000i -0.0723 + 0.3003i -0.0723 - 0.3003i -0.3086 + 0.0000i ```

## Tips

• Zero-degree polynomials are always stable.

• For polynomials of degree greater than zero, the presence of NaN-valued coefficients returns a `false` stability indicator and vector of `NaN`s in `eigenvalues`.

• When testing for stability, the comparison incorporates a small numerical tolerance. The indicator is `true` when the magnitudes of all eigenvalues are less than `1-10*eps`, where `eps` is machine precision. Users who wish to incorporate their own tolerance (including `0`) may simply ignore `indicator` and determine stability as follows:

```[~,eigenvalues] = isStable(A); indicator = all(abs(eigenvalues) < (1-tol));```

for some small, nonnegative tolerance `tol`.

## References

[1] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.