# How to prove stability of discrete time system

**URL:** <https://discourse.julialang.org/t/how-to-prove-stability-of-discrete-time-system/109789>\
**Category:** Modelling & Simulations\
**Tags:** question, controlsystems\
**Created:** [February 6, 2024, 10:01am UTC](https://discourse.julialang.org/t/how-to-prove-stability-of-discrete-time-system/109789 "2024-02-06T10:01:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 6, 2024, 10:01am UTC](https://discourse.julialang.org/t/how-to-prove-stability-of-discrete-time-system/109789/1 "2024-02-06T10:01:48Z")

</div>

I am simulating the following discrete time feedback system:

![Feedback](https://global.discourse-cdn.com/julialang/original/3X/6/e/6ec5e476dd19edf25268db45e2c19286d565df21.png)

How can I prove that it is stable for

K\_\mathrm{u} \< 2 \frac{1}{T\_\mathrm{s} K\_2}

?

Code:

```julia
using ControlSystemsBase

Ts = 0.01
Ku = 100/5e6
K2 = 5e6

num = [Ku * Ts]
den = [1, -1]
P = tf(num, den, Ts) # plant, the integrator

C = K2 # controller, a constant gain
sys = feedback(P, C)

```

Output of the command `margin`:

```julia
julia> margin(sys)
(wgm = [NaN;;], gm = [Inf;;], wpm = [NaN;;], pm = [Inf;;])

```

Does not look like a good answer…

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [February 6, 2024, 10:57am UTC](https://discourse.julialang.org/t/how-to-prove-stability-of-discrete-time-system/109789/2 "2024-02-06T10:57:25Z")

</div>

`isstable(sys)`

Your question relates to introductory control theory, any basic textbook on the subject will provide the background you need. You check the roots of the characteristic polynomial. You can prove that sys is stable for twice the gain of what you have indicated with your bound.

You also compute the margin of the wrong system, you compute margins on open-loop systems.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 6, 2024, 11:37am UTC](https://discourse.julialang.org/t/how-to-prove-stability-of-discrete-time-system/109789/3 "2024-02-06T11:37:46Z")

</div>

> [@baggepinnen](#):
>
> ou can prove that sys is stable for twice the gain of what you have indicated with your bound.

Fixed.
