# isstable

Determine whether system is stable

## Syntax

`B = isstable(sys)B = isstable(sys,'elem')`

## Description

`B = isstable(sys)` returns 1 (true) if the dynamic system model `sys` has stable dynamics, and 0 (false) otherwise. If `sys` is a model array, then `B` is true only if all models in `sys` are stable.

`B = isstable(sys,'elem')` returns a logical array of the same dimensions as the model array `sys`. The logical array indicates which models in `sys` are stable.

`isstable` is only supported for analytical models with a finite number of poles.

## Examples

collapse all

### Determine Stability of Models in Model Array

Create an array of SISO transfer function models with poles varying from 2 to -2.

```a = [-2:2]; sys = tf(zeros(1,1,1,length(a))); for j = 1:length(a) sys(1,1,1,j) = tf(1,[1 a(j)]); end ```

Examine the stability of the model array.

```B_all = isstable(sys) ```
```B_all = 0 ```

By default, `isstable` returns a single Boolean value that is 1 (`true`) only if all models in the array are stable. `sys` contains some models with nonpositive poles, which are not stable. Therefore, `isstable` returns 0 (`false`).

Examine stability of each model in the array, element by element.

```B_elem = isstable(sys,'elem') ```
```B_elem = 0 0 0 1 1 ```

The `'elem'` flag causes `isstable` to return an array of Boolean values, which indicate the stability of the corresponding entry in the model array. For example, `B_elem(4)` = 1, which indicates that sys(1,1,1,4) is stable.