Main Content

# isstable

Determine if dynamic system model is stable

## Syntax

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

## Description

example

````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 the function returns `1` only if all the models in `sys` are stable.`isstable` returns a logical value of `1` (`true`) for stability of a dynamic system if: In continuous-time systems, all the poles lie in the open left half of the complex plane.In discrete-time systems, all the poles lie inside the open unit disk. `isstable` is supported only for analytical models with a finite number of poles.```

example

````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.```

## Examples

collapse all

Determine the stability of this discrete-time SISO transfer function model with a sample time of `0.1` seconds.

`$\mathrm{sys}\left(\mathit{z}\right)=\frac{2\mathit{z}}{4{\mathit{z}}^{3}+3\mathit{z}-1}$`

Create the discrete-time transfer function model.

`sys = tf([2,0],[4,0,3,-1],0.1);`

Examine the poles of the system.

`P = abs(pole(sys))`
```P = 3×1 0.9159 0.9159 0.2980 ```

All the poles of the transfer function model have a magnitude less than `1`, so all the poles lie within the open unit disk and the system is stable.

Confirm the stability of the model using `isstable`.

`B = isstable(sys)`
```B = logical 1 ```

The system `sys` is stable.

Determine the stability of this continuous-time zero-pole-gain model.

`$\mathrm{sys}\left(\mathit{s}\right)=\text{\hspace{0.17em}}\frac{2}{\left(\mathit{s}+2+3\mathit{j}\right)\left(\mathit{s}+2-3\mathit{j}\right)\left(\mathit{s}-0.5\right)}$`

Create the model as a `zpk` model object by specifying the zeros, poles, and gain.

`sys = zpk([],[-2-3*j,-2+3*j,0.5],2);`

Because one pole of the model lies in the right half of the complex plane, the system is unstable.

Confirm the instability of the model using `isstable`.

`B = isstable(sys)`
```B = logical 0 ```

The system `sys` is unstable.

Determine the stability of an array of SISO transfer function models with poles varying from `-2` to `2`.

`$\left[\frac{1}{\mathit{s}+2}\text{\hspace{0.17em}},\text{\hspace{0.17em}}\frac{1}{\mathit{s}+1}\text{\hspace{0.17em}},\text{\hspace{0.17em}}\frac{1}{\mathit{s}}\text{\hspace{0.17em}},\text{\hspace{0.17em}}\frac{1}{\mathit{s}-1}\text{\hspace{0.17em}},\text{\hspace{0.17em}}\frac{1}{\mathit{s}-\mathrm{2}}\right]$`

To create the array, first initialize an array of dimension `[length(a),1]` with zero-valued SISO transfer functions.

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

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

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

`isstable` can tell you whether all the models in model array are stable or each individual model is stable.

Examine the stability of the model array.

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

By default, `isstable` returns a single logical 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 the stability of each model in the array by using `'elem'` flag.

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

The function returns an array of logical values that indicate the stability of the corresponding entry in the model array. For example, `B_elem(2)` is `1`, which indicates that the second model in the array, `sys(1,1,2)` is stable. This is because `sys(1,1,2)` has a pole at `-1`.

## Input Arguments

collapse all

Dynamic system, specified as a SISO or MIMO dynamic system model or an array of SISO or MIMO dynamic system models. Dynamic systems that you can use include continuous-time or discrete-time numeric LTI models such as `tf`, `zpk`, or `ss` models.

If `sys` is a generalized state-space model `genss` or an uncertain state-space model `uss` (Robust Control Toolbox), `isstable` checks the stability of the current or nominal value of `sys`.

If `sys` is an array of models, `isstable` checks the stability of every model in the array.

• If you use `B = isstable(sys)`, the output is `1` (`true`) only if all the models in the array are stable.

• If you use `B = isstable(sys,'elem')`, the output is a logical array, the entries of which indicate the stability of the corresponding entry in the model array.

For more information on model arrays, see Model Arrays.

## Output Arguments

collapse all

True or false result, returned as `1` for a stable model or `0` for an unstable model.

The `'elem'` flag causes `isstable` to return an array of logical values with same dimensions as the model array. The values in the array indicate the stability of the corresponding entry in the model array.

## See Also

Introduced in R2012a

## Support

#### Learn how to automatically tune PID controller gains

Download code examples