# CVX code for solve a LMI resulting from Lyapunov inequality

Good evening,

It is my first time with CVX and initially need a code to solve a simple LMI problem like:

(A^T)P+PA<0, P>0. (Considering any randon square hurwitz matrix A)

This one is resulting from Lyapunov inequality stablished to guarant the stability of the system:

\dot(X)=A*X.

Please, any help will be importante.

Have you read the CVX Users’ Guide http://cvxr.com/cvx/doc/ ?

Have you looked at https://stanford.edu/class/ee363/notes/lmi-cvx.pdf ?

I used the second link that you post and use the followin example:

A=diag([-3,-1,-2]);

cvx_begin sdp
variable P(3,3) symmetric
A’P + PA <= -eye(3)
P >= eye(3)
cvx_end

and, the answer was (Where is the result for P?):

## Calling SDPT3 4.0: 12 variables, 6 equality constraints

num. of constraints = 6
dim. of sdp var = 6, num. of sdp blk = 2

SDPT3: Infeasible path-following algorithms

## number of iterations = 8 primal objective value = 0.00000000e+00 dual objective value = 3.76017054e-10 gap := trace(XZ) = 1.57e-09 relative gap = 1.57e-09 actual relative gap = -3.76e-10 rel. primal infeas (scaled problem) = 5.22e-15 rel. dual " " " = 1.60e-10 rel. primal infeas (unscaled problem) = 0.00e+00 rel. dual " " " = 0.00e+00 norm(X), norm(y), norm(Z) = 1.5e+01, 3.2e-10, 4.3e-10 norm(A), norm(b), norm© = 3.2e+00, 2.2e+00, 1.0e+00 Total CPU time (secs) = 3.17 CPU time per iteration = 0.40 termination code = 0 DIMACS: 6.3e-15 0.0e+00 1.6e-10 0.0e+00 -3.8e-10 1.6e-09

Status: Solved
Optimal value (cvx_optval): +0

After cvx_end, P is available in MATLAB as a regular MATLAB variable, and has the optimal value computed by CVX/solver. This is covered in the CVX User’s Guide, which you should read before using CVX.