# Lyapanov Stability Analysis | MATLAB Tutorial

**Introduction**

Lyapunov stability is often used to describe the state of being stable in a dynamical system. An equilibrium state *x*^{*} of a dynamical system is Lyapunov stable if all trajectories of the system starting from a neighborhood of *x*^{*} stay in the neighborhood forever. If further all solutions starting near *x*^{*}converge to *x*^{*}, then *x*^{*} is asymptotically stable. In biological systems, it is generally believed that observable states are stable.

Lyapunov, in his original 1892 work, proposed two methods for demonstrating stability.The first method developed the solution in a series which was then proved convergent within limits. The second method, which is now referred to as the Lyapunov stability criterion, makes use of a *Lyapunov function V(x)* which has an analogy to the potential function of classical dynamics. It is introduced as follows for a system x’ = f(x) having a point of equilibrium at x = 0. Consider a function V(x) such that

Then V(x) is called a Lyapunov function candidate and the system is stable in the sense of Lyapunov.

It is easier to visualize this method of analysis by thinking of a physical system (e.g. vibrating spring and mass) and considering the energy of such a system. If the system loses energy over time and the energy is never restored then eventually the system must grind to a stop and reach some final resting state. This final state is called the attractor.

However, finding a function that gives the precise energy of a physical system can be difficult, and for abstract mathematical systems, economic systems or biological systems, the concept of energy may not be applicable.

Lyapunov’s realization was that stability can be proven without requiring knowledge of the true physical energy, provided a Lyapunov function can be found to satisfy the above constraints.

Follow the given steps to determine the Lyapanov Stability of a system in MATLAB.

1. Open MATLAB

2. Define Matrix A and Matrix Q (which are derived from the state space equations).

3. Determine the Lyapanov solution to the above matrices by using the command ‘lyap’ as demonstrated below.

4. Determine the Eigen values of the Matrix X obtained in the solution above.

The Eigen values obtained are as follows:

5. Check the following contraints on the eigen values obtained in order to determine the positive definiteness of the system.

The output obtained is as follows:

**Conclusion**

The Lyapanov Stability criteria was used to determine whether a given non linear system is stable or not.

### Recommended Posts

##### PID Tuning

18 Feb 2018 - PID Controller, Simulink, Tutorial