A proposal for resolution of Lyapunov equation matrix. A PROPOSAL FOR RESOLUTION OF AT P PA Q LYAPUNOV EQUATION. Cosme Rafael Marcano Gamero. Systems Engineer, (Universidad de los Andes, Mérida – 1986). Magíster Scientiarum in Electronic Engineering, (Universidad Nacional Experimental Politécnica “Antonio José de Sucre” - 2004). Professor at UNEXPO “Antonio José de Sucre”. Estado Bolívar - Venezuela cosmemarcano@yahoo.com tlf. 58-0286-9619965 Abstract. The Lyapunov Second Stability Method consists of select ing a so-called Lyapunov Candidate Function, which satisfies certain conditions that permit us to utilize it in the stability analysis of a mathematical model synthesized from a process which we want to put under action of a given Control Law. In linear cases, it is always possible to find a candidate function of quadratic kind, x T Ax , that satisfies the desired cond5itions. By applying the Lyapunov Second Stability Method to this function, it appears an algebraic, ordinary matrix equations system of the kind AT P PA Q , where P and Q are positive-definite matrices. In this work, the solution of this algebraic system by solving a lineal system of n 2 unknowns and same number of equations is proposed. After some elementary manipulation of original equations, solution can be achieved with some traditional method, like Gauss Inverse Deletion or any of its variants. This paper presents some easy algorithms that allow us to re-accommodate the original matrix system into a conventional algebraic, ordinary, linear equations system. Ax=b. Key words: Lyapunov Second Stability Method, Matrix System, Gaussian Back Deletion Algorithm. : A proposal for resolution of Lyapunov equation matrix. A PROPOSAL FOR RESOLUTION OF AT P PA Q LYAPUNOV EQUATION. INTRODUCTION. In the analysis of control systems in the time domain, two options for determining the system’s stability have been presented. First, the determination of the Transfer Function poles, whose real part must be in the negative half-plane (which is known as Lyapunov Indirect Method or First Lyapunov Stability Method) [1], and, second, the Lyapunov Direct Method or Second Lyapunov Stability Method. Both of these methods apply on a system which is described by the following equations system: dx Ax bu dt (1) where A is a nxn matrix, called System Matrix, b is a row vector of n elements and x is a column vector, known as State Vector. On the other hand, u designates a scalar function, known as Control Function which is determined by the state variables, i.e., the State Vector components, x. The characteristic equation of system (1) is given by the det( sI A) , where s is the Laplace variable. The Transfer Function poles are obtained by calculating the zeros of the characteristic equation, i.e. det( sI A) 0 . (2) Accordingly to the Lyapunov First Stability Method, the real parts of this equation roots must be in the negative half-plane in order to warrant the stability of the system given by (1). : A proposal for resolution of Lyapunov equation matrix. THEORETICAL FOUNDATION OF THE LYAPUNOV´S SECOND METHOD The Lyapunov Second Stability Method, also known as Lyapunov Direct Method [1], which is founded in the application of the following theorem: THEOREM Let be x = 0 an equilibrium point of a non lineal system, in general, given by x f (x) Let be V: D R a continuously differentiable function in the neighbourhood D of x = 0, such as V(0) = 0 and V(x) > 0 in D – {0}. If V is always decrecent in D, i.e., V ( x) 0 in D then, it might be assured that the system is stable in x = 0. Furthermore, if V ( x) 0 in D – {0} then x = 0 is asymptotically stable The task is encountering a V(x), called Lyapunov candidate function, which satisfies the following requirements: V is continouos V(x) has an unique minimum in xeq respect to all the other points in D Along any system trajectory contained in D, the value of V never increases. 9 The Lyapunov First Stability Method determines the stability in the neighbourhood of an equilibrium point, while de Lyapunov Second Stability Method allow to determine how far could be the trajectory of a system from an equilibrium point and still approaching to it as t tends to Region of Asymptotic Stability (Atraction Region) Let be (t;x) the solution of the equations system going from an initial state x at time t = 0. Then, the attraction region is defined as the set conformed by all the points x such that limt (t;x) = 0 : A proposal for resolution of Lyapunov equation matrix. If c = { x Rn | V(x) c } is limited and constrained in D, then each trajectory that Stara from c remains in c and approaches to the equilibrium point as t . So, c is an estimate of the attraction region. TYPES OF STABILITY RESPECT TO THE ATTRACTION REGION. Lyapunov defines three stability typos in relation to the attraction region, which are explained below: Local Stability (stability in the neighbourhood) – when a system remains inside an infinitesimal region around the equilibrium point being under some little disturbances Finite Stability – when a system returns to an equilibrium point from any point inside the region of finite dimensions, R. Global Stability (Stability at large) – if the region R includes the whole state space. The Figure 1 graphically describes the various stability types that proposed Lyapunov. It is good to remark that is always possible to find a Lyapunov function for linear system like those described by (1), without external disturbance, i.e., with u=0. In that case, it might be chosen a Lyapunov function of quadratic form: V x T Px (3) where P is a symmetric matrix, positive definite. Then, we have V x T Px x T Px V ( Ax) T Px x T P( Ax) x T AT Px x T PAx (4) x T ( AT P PA) x x T Qx where: AT P PA Q (5) : A proposal for resolution of Lyapunov equation matrix. Note that the matrix equations system (5), which must be solved during the application of the Lyapunov Second Stability Method, has the general form of a AX + XB = C. system This general system must be adequate for the Lyapunov particular system by taking B AT and C = -Q. Checking for the system consistency, we realised that all the involved matrices must be squares. Figura 1. Various Stability conditions. If the matrix Q is positive definite, then the system is said to be asymptotically stable. By instance, it can be chosen Q = I, the identity matrix, which is obviously positive definite, and solve the following matrix system AT P PA I : A proposal for resolution of Lyapunov equation matrix. for P, and check whether or not P is also positive definite (which may be face up using, for example, the n main minors of P, according to the Sylvester Criteria). Although a linear system stability can be checked by verifying that the real parts of its characteristic equation are in the left half plane, the solution of the Lyapunov matrix equation can provides an estimate to a candidate function for a non-linear system, mainly when that estimation is doing by a computation program. RESOLUTION OF LYAPUNOV MATRIX EQUATIONS SYSTEM. In this section, it will be faced up the matriz equations system given by (5), which appears during the Lyapunov Second Stability Method application, as seen in previous section , i.e., AT P PA Q In order to start this task, it will be primarily solved a generic system of the form: BX XA C where and (6) B AT C Q By checking for matrix dimensions consistency, it is clear that n must equal to m. The expansion of the matrix equation system stated by (6), it is obtained: n n j 1 l 1 sik bij x jk xil alk i 1,2,3,..., n para k 1,2,3,..., n (7) : A proposal for resolution of Lyapunov equation matrix. Note that, due to the bidimesional nature of X, the system solution implies the solution of a nxn algebraic equations system with the same number of unknowns. The proposed technique to face up the solution of this algebraic problem consists in re-accommodating the equations given by (6), in the conventional form of a set of linear equations, of the kind Sz=t, where z is a column vector of nxn elements, which is shown below: x11 x 12 ... x1n x 21 x z 22 ... x2n ... x n1 ... x nn (8) As can be appreciated in (8), the vector components of z, are the same as in the matrix X of the system given by (6), arranged in the form of an unique column vector, conformed by the components of each of the matrix X columns, put in vertical form. In the same way, the vector of the vector t of the modified system is obtained putting in vertical form, followed one after each other, the original system matrix C columns. Later, it will be explained how the matrix S is prepared. The equations matrix system that results of the Lyapunov Second Stability Method, has the peculiar feature that all the involved matrices are squares, and the matrix B of (6) corresponds to the matrix A transpose. : A proposal for resolution of Lyapunov equation matrix. The matrix A is positive definite and, naturally, non singular. The matrix C can be arbitrarily and conveniently chosen. It used to be chosen the nxn identity matrix, which is positive definite. Expansion of the expression (7) for n=3, results in the formation of two auxiliary matrices, say U and V, which are showed below. b11 b 12 b13 0 U 0 0 0 0 0 b21 b22 b23 0 0 0 0 0 0 b31 a32 b33 0 0 0 0 0 0 0 0 0 b11 b12 b13 0 0 0 0 0 0 b21 b22 b23 0 0 0 0 0 0 b31 b32 b33 0 0 0 0 0 0 0 0 0 b11 b12 b13 0 0 0 0 0 0 b21 b22 b23 0 0 0 0 0 0 b31 b32 b33 (9) a11 0 0 a 21 V 0 0 a 31 0 0 0 a11 0 0 a 21 0 0 a31 0 0 0 a11 0 0 a 21 0 0 a31 a12 0 0 a 22 0 0 a32 0 0 0 a12 0 0 a 22 0 0 a32 0 0 0 a12 0 0 a 22 0 0 a32 a13 0 0 a 23 0 0 a33 0 0 0 a13 0 0 a 23 0 0 a33 0 0 0 a13 0 0 a 23 0 0 a33 (10) Note that the n blocks that appear on the matrix U main diagonal, are the same each other, and, in addition, each block consists of the matrix A transpose elements, given by (1). On the other hand, matrix V is conformed by the matrix B of (6), disposed in diagonal bands. Note also that the so obtained matrices present many zeros. By adding matrices U and V, it is obtained the matrix S: : A proposal for resolution of Lyapunov equation matrix. b21 b31 a12 0 0 a13 0 0 b11 a11 b b22 a11 b32 0 a12 0 0 a13 0 12 b13 b23 b33 a11 0 0 a12 0 0 a13 0 0 b11 a22 b21 b31 a23 0 0 a21 S 0 a21 0 b12 b22 a22 b32 0 a23 0 (11) 0 a21 b13 b23 b22 a22 0 0 a23 0 a 0 0 a32 0 0 b11 a33 b21 b31 31 a31 0 0 a32 0 b12 b22 a33 b32 0 0 0 a31 0 0 a32 b13 b23 b33 a33 Next, we proceed to synthesize the algorithms for preparing matrices U, V and S. MATLAB m-files to get U and V are shown below: PrepararMatriz_U Procedure % Initializing variables a=[1 -2 3;4 1 6;7 8 -1]; % a particular example nuevafila=1; nuevacolumna=1; n2=n; nc=n*n; k=1; m=1; u=zeros(nc); for bloque = 1: n, for fila = nuevafila: n2, for columna = nuevacolumna: n2, u(fila,columna) = b(k,m) m=m+1 end k = k + 1; m = 1; end k = 1; m = 1; nuevafila = nuevafila + n; n2 = n2 + n; nuevacolumna = nuevacolumna + n; end %End of PrepareMatrix_U Figure 2. MATLAB m-file for Preparing Matrix U : A proposal for resolution of Lyapunov equation matrix. PrepareMatrix_V Procedure f=1; c=1; n=3; b=a; nuevafila=1; nuevacolumna = 1; n2 = n; nc = n*n; v=zeros(nc); fila = 1; columna =1; for h=1: n, for fila=nuevafila: n2, for columna=nuevacolumna: n: nc, fila, columna v(fila,columna) = b(f, c); c = c + 1; end nuevacolumna = nuevacolumna + 1; c = 1; end f = f + 1; c =1; nuevafila= nuevafila+ n; n2 = n2 + n; nuevacolumna = 1; end End of PrepareMatrix_V Figure 3. MATLAB m-file for Preparing Matrix V : A proposal for resolution of Lyapunov equation matrix. Finally, the matrix S is obtained by adding matrices U and V as shown below: Furthermores, matrix Q is arbitrarily taken as an identity nxn matrix. % m-file for Solving the matrix system I the conventional form Ax=b s=u+v Q=eye(n); % converting Q matrix in QQ vector… k=1; for i=1:n, for j=1:n, QQ(k) = Q(i,j); k = k + 1; end; end; if det(s) == 0 'Matrix S is singular: det(s) = 0' else P1 = inv(s)*(-QQ); end; % P1 is a vector which contains the elements of the solution matrix P % Now, let’s convert the vector P1 in the matrix P. k=1; for i=1:n, for j=1:n, P(i,j) = P1(k); k = k+1; end; end; % End of script Figure 4. Algorithm for Adding Matrices U and V. Once prepared matrices U, V and S, and the vector t, the original matrix system BX XA C is expressed in the form of a nxn linear algebraic ordinary equations system, given by: Sz t (12) which solution will consists of nxn scalar values for the vector z elements, which, according to (8), correspond with the components of matrix X, and constitutes the matrix system solution given by (6). Because of that, after resolving the modified system given by : A proposal for resolution of Lyapunov equation matrix. (13), utilizing some resolution method of linear algebraic equations systems, as Gauss Back Deletion [2], pr any of its variants (Gauss-Jordan or Gauss-Seidel) only would rest re-accommodate the vector elements z, in the matrix form of X, as is shown below. x11 x X 21 ... x n1 x12 x 22 ... xn 2 x1n x 2 n ... ... , , , x nn ... ... (13) The matrix given by (13) constitutes the solution to the matrix system given by (6). In order to get the particular solution of the matrix system required by the Lyapunov Second Stability Method, it is necessary to make the corresponding substitutions of B AT and C=-Q. After doing these substitutions, we get: S 2a11 a21 a31 a21 0 0 a13 0 0 a12 a13 a12 a22 a11 a23 0 a32 a33 a11 0 0 0 a11 a22 a21 0 a21 0 a21 a31 0 0 a32 a13 0 0 0 a13 0 0 a12 0 a12 2a22 a32 0 a23 0 0 a13 0 0 0 a13 a12 0 0 a13 a23 0 a23 0 a23 a33 a22 0 0 0 a11 a33 aº1 0 a21 a22 a33 a32 a31 a32 0 0 a13 0 0 a23 a12 a23 2a33 (11) Note that, due to B AT , we have bij a ji . Without pretending to extend in an exhaustive study od control systems, which goes too far of merely computational approach of this paper, it is important stamd out thsy the possibility of applying the Lyapunov Second Stability Method to non-linear is actually the great advantage of this method, because of in linear systems results much more simple to check the stability by verifying that the real part of the characterictic equation are in the negative half plane. This simple comprobation ins not applicable to non-linear systems. The Lyapunov Second Stability Method importante is more evident in the recent approaches to the synthesis and design f indusrtrial control systems, which are, in general, : A proposal for resolution of Lyapunov equation matrix. non-linear. Examples of that kina of controllers are those based in Variable Structure Theory [1] and [3], which utilizes the underlying theory of the Second Stability Method to get asymptotically stable plants, with small settling and responses times, along with small overshoot percentage EXAMPLE For comparison purpose, between the results obtained with my scripts and those reported by the <MATLAB P=lyap(A,C) function, let us take a numerical example: Let’s be a = [1 -2 3;4 1 6;7 8 -1] that is non singular. By applying my scripts, it is AT P PA Q , with Q= ye(3): obtained the following partial results for the system Matrix U: 1 4 7 0 0 0 0 0 0 -2 3 1 6 8 -1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 4 0 0 7 0 0 0 1 0 0 4 0 0 7 0 0 0 0 0 0 0 0 0 0 1 -2 3 4 1 6 7 8 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -2 3 4 1 6 7 8 -1 Matrix V: 0 -2 0 0 3 0 0 0 0 -2 0 0 3 0 1 0 0 -2 0 0 3 0 1 0 0 6 0 0 0 0 1 0 0 6 0 4 0 0 1 0 0 6 0 8 0 0 -1 0 0 0 0 8 0 0 -1 0 7 0 0 8 0 0 -1 Vector P1 (transposed, the solution of the conventional form Ax=b, with x=P1): >>P1 -0.23485 -0.80303 0.89394 0.50758 0.50758 -0.80303 0.89394 -2.3712 0.74242 : A proposal for resolution of Lyapunov equation matrix. Matrix P = -0.23485 0.89394 0.50758 0.89394 0.74242 -0.80303 0.50758 -0.80303 -2.3712 On the other hand, results reported for P=lyap(A,Q): >> PLyap = lyap(a,Q) PLyap = -0.23485 0.89394 0.50758 0.89394 0.74242 -0.80303 0.50758 -0.80303 -2.3712 Substracting one from the other, we get: >> P2-PLyap ans = -2.3592e-015 -9.1038e-015 -3.1086e-015 -9.992e-015 -1.6542e-014 1.1546e-014 -5.7732e-015 6.6613e-015 3.908e-014 As it can be noted, differences are of the order of 10 14 , which is, obviously, negligible! By the way, it is important to note that the Online Help offered by MATLAB 6.5, R13, say that lyap(A.C) function solves the equation AX + XA’ = -C, and must be A’X + XA = -C that do correspond to the Lyapunov matrix equation. These matrix eqations has different solutions. Finally, it is worthy to be mentioned that the m-files that appear in this paper were developed and used by the author with the MATLAB, version 4.2c.1, Student version, some years ago, which did not included the lyap(A,C) function. : A proposal for resolution of Lyapunov equation matrix. CONCLUSSIONS. 1. Through simple manipulations of rows and columns, it is possible to reaccommodate an algebraic equations matrix system, in order to obtain a conventional system of ordinary linear equations, which may be easily solved by utilizing some known method to solve Algebraic Ordinary Equations Systems, like the Gaussian Back Deletion or any of its variants, i.e., GaussJordan or Gauss-Seidel.. Taking advantage of the sparse nature of the matrix elements after manipulation, it would be possible to utilize other method which results more efficient in the number of operations to do to get the solution. 2. Algorithms are presented in MATLAB m-file format, although it may be translate to any available programming language, as Visual Basic or Visual C; both of them are products of Microsoft Corporation, or in other language from any manufacturer. REFERENCES. [1] Utkin, Vadim. Sliding Modes and their Applications in Variable Structure Systems, MIR Publishers, Moscú, 1978. [2] Marcano G., Cosme R. Síntesis y Diseño de Controladotes de Estructura Variable, Trabajo de Maestría, Universidad Nacional Experimental Politécnica “Antonio José de Sucre”, Puerto Ordaz - Venezuela, Mayo 2.004. [3] Fadeeva, V.N., Métodos de Cálculo del Álgebra Lineal, Editorial Paraninfo, Madrid, 1973. [4] Marcano G., Cosme R. Sistemas de Estructura Variable, Trabajo de Grado, Universidad de los Andes, Mérida – Venezuela, Mayo 1986. [5] Kailath, Thomas. Linear Systems, Prentice may, Englewood Cliffs, New Jersey EE.UU.198 [6] Utkin, Vadim. Variable Structure Control, Automation and Remote Control, 44, pp. 1105-1119, september 1983. [7] Sira-Ramírez, Hebert. Nonlinear Sliding Manifolds for Linear and Bilinear Systems. Conférence Internationale Francophone d'Automatique, CIFA' 2000. París, 2000. [8] The Mathworks, Inc. Matlab Online Help version 6.5, Release R13 :