In this tutorial, you will learn the following topics:
- Derivation of the Lyapunov equation. You will learn to derive the Lyapunov equation by analyzing the stability of dynamical systems.
- Stability test of dynamical systems that is based on solving the Lyapunov equation.
- Numerical solution of the Lyapunov equation. We will use a relatively simple method that is based on vectorization, as well as a more advanced method implemented in MATLAB’s lyap() function.
Origins of the Lyapunov Equation in Stability Analysis of Dynamical Systems
First, let us talk about the origins of the Lyapunov equation. The Lyapunov equation is a fundamental equation that is used for the stability and performance analysis of dynamical systems. Apart from the stability analysis, the solution of the Lyapunov equation is also used in other control algorithms and methods. For example, in order to compute the solution of an optimal control problem, it is often necessary to solve Lyapunov equations.
In this post, for brevity and simplicity, we explain the derivation of the Lyapunov equation that is based on the stability analysis of dynamical systems. Let us consider a dynamical system of the following form:
(1)
where
Let us assume that the system (1) has a unique equilibrium point. Then, the stability analysis is concerned with the following question:
What is the condition under which the system’s equilibrium point is asymptotically stable?
To answer this question, we will briefly recall the Lyapunov stability theorem.
Lyapunov stability theorem: Let
- The function
is positive definite on this subset. This means that 1) if and only if , and 2) if and only if . - The function
is negative (negative definite) on this subset.
Then, the equilibrium point of the system (1) is asymptotically stable.
The function
Quadratic Forms, Positive Definite, Negative Definite, and Semi-Definite Matrices
The Lyapunov equation for the linear system (1), will be derived by assuming a Lyapunov function with a quadratic form. Consequently, it is important to explain quadratic forms and relate these forms with positive definite matrices. Let us consider the following function
(2)
where
(3)
where
(4)
where
(5)
In order to better illustrate the structure of quadratic forms, let us consider a 2D case below
(6)
and consequently, our original function takes the following form
(7)
Let us visualize these functions, for several values of the matrix
(8)
The function
The MATLAB code used to generate these plots is given below.
clear,pack,clc
x1=-50:2:50;
x2=-50:2:50;
[X1,X2]=meshgrid(x1,x2);
syms x1s
syms x2s
% P1 - positive definite completely symmetric with respect to the zero axis
%P=[1 0; 0 1];
% P2 - positive definite not completely symmetric
% P=[1 -2;1 5];
% P3 - negative definite
%P=[-1 -2;1 -5];
%P4 - indefinite
%P=[-1 -2; 1 2];
%P5 - positive semi-definite
P=[1 1; 1 1];
expression= [x1s x2s]*P*[x1s; x2s];
% print this expression in the command window to see the expanded form of
% the Z function
% use the expanded expression to define a new function
expand(expression)
V= X1.^2+X2.^2+(X1.*X2).*2
figure(1)
surf(V)
xlabel('x1')
ylabel('x2')
zlabel('V(x1,x2)')
Here, we need to mention one important fact about quadratic forms. Notice that in the definition of the quadratic form, given by Eq. (2), it is assumed that the matrix
(9)
Consequently, any non-symmetric matrix defines a quadratic form with a symmetric matrix. That is, for any non-symmetric matrix, we can find a quadratic form with a symmetric matrix.
From (7), we can see that the function
(10)
Positive definite quadratic forms corresponding to the positive definite matrices
(11)
Let us analyze the last expression. Let us assume that
(12)
Let us consider the second term
(13)
The second term is positive for all
(14)
The last equation is equivalent to
(15)
To summarize, the quadratic form (7) is positive definite if
(16)
On the other hand, consider again the original matrix
(17)
The number
By using this test, we can determine that the matrices
Condition for positive definiteness:
Generally speaking, the n-dimensional matrix
(18)
is positive definite if and only if
- the first-order leading principal minor is positive, that is, the determinant of the upper left 1-by-1 corner of P is positive:
(19)
- the second-order leading principal minor is positive, that is, the determinant of the upper left 2-by-2 corner of P is positive:
(20)
- the third-order leading principal minor is positive, that is, the determinant of the upper left 3-by-3 corner of P is positive:
(21)
- …
- the determinant of the matrix P is positive (this is the
-th order leading principal minor)(22)
This is the Sylvester condition for testing the positive definiteness of a matrix.
Let us apply this test on the following matrix
(23)
We have
(24)
Consequently, the matrix
Let us now state definitions of negative definite, negative semidefinite, positive semidefinite, and indefinite matrices.
Negative definite matrix: A matrix
(25)
Negative semi-definite matrix: A matrix
(26)
Positive semi-definite matrix: A matrix
(27)
Indefinite matrix: A matrix
The matrix
(28)
We see that this quadratic form is positive semi-definite since for
Condition for negative definiteness: A matrix
(29)
That is, the matrix
Condition for indefiniteness: A matrix
The conditions for positive and negative semidefiniteness are different from the conditions for strict positive and negative definiteness since they involve all principal minors, and not only leading principal minors. Principal minors are simply obtained by erasing certain columns and rows of a matrix and computing the determinant. Here, the process of erasing the columns and rows is not only restricted to the last rows and columns such as in the case of leading principal minors. The column and row numbers should be identical. That is, the indices of deleted rows must be equal to the indices of deleted columns. For example, consider the 3×3 matrix
(30)
Its second order principal minors are
(31)
Condition for positive semi-definiteness: A matrix
Condition for negative semi-definiteness: A matrix
Asymptotic stability and the Lyapunov equation
Let us assume that the function (2) is positive definite, and this is equivalent to assuming that the matrix
Let us now compute the derivative of the function
(32)
Next, from (1), we have
(33)
By substituting (1) and (33) in (32), we obtain
(34)
Let us define the matrix
(35)
Note since the matrix
(36)
Since the matrix
This derivation motivates the introduction of the following theorem.
Theorem about the system stability and the solution of the Lyapunov equation: The real parts of all the eigenvalues of the matrix
(37)
Furthermore, if the matrix A is Hurwitz, then
From everything being said, we can deduce a test for testing the stability of the system:
Stability test of the system:
- Select a symmetric positive definite matrix
(for example, a diagonal matrix with positive entries). - Solve the Lyapunov equation (37)
- Test the definiteness of the matrix P. If the matrix
is positive definite, the system is asymptotically stable. If the matrix is not positive definite, the system is not asymptotically stable.
Basically, this test enables us to investigate the system stability without computing the eigenvalues of the matrix