Documentation

# isstable

Determine whether system is stable

## Syntax

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

## Description

`B = isstable(sys)` returns a logical value of `1` (`true`) if the dynamic system model `sys` has stable dynamics, and a logical value of `0` (`false`) otherwise. If `sys` is a model array, then `B` = `1` 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

Create an array of SISO transfer function models with poles varying from -2 to 2. To do so, first initialize an array of dimension `[1,length(a)]` with zero-valued SISO transfer functions.

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

Populate this array with transfer functions of the form `1/(s-a)`.

```for j = 1:length(a) sys(1,1,1,j) = tf(1,[1 -a(j)]); end sys.SamplingGrid = struct('a',a);```

Examine the stability of the model array.

`B_all = isstable(sys)`
```B_all = logical 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 nonnegative poles, which are not stable. Therefore, `isstable` returns 0 (`false`) for the entire array.

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

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

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(2)` = 1, which indicates that `sys(1,1,1,2)` is stable. This result is expected, because `sys(1,1,1,2)` has `a` = -1.