CVX code for solve a LMI resulting from Lyapunov inequality


(Mariana Uzeda) #1

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.


(Mark L. Stone) #2

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 ?


(Mariana Uzeda) #3

Thanks for the answer Mark,

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


version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|6.1e+00|2.4e+01|6.0e+02| 0.000000e+00 0.000000e+00| 0:0:01| chol 1 1
1|1.000|0.855|1.7e-06|3.6e+00|6.5e+01| 0.000000e+00 9.813350e+00| 0:0:02| chol 1 1
2|1.000|0.990|1.2e-06|4.6e-02|8.2e-01| 0.000000e+00 1.274646e-01| 0:0:03| chol 1 1
3|1.000|1.000|4.0e-07|1.0e-03|1.7e-02| 0.000000e+00 2.963161e-03| 0:0:03| chol 1 1
4|1.000|1.000|9.2e-08|1.0e-04|1.4e-03| 0.000000e+00 3.124637e-04| 0:0:03| chol 1 1
5|1.000|1.000|3.5e-10|1.0e-05|1.1e-04| 0.000000e+00 3.254527e-05| 0:0:03| chol 1 1
6|1.000|1.000|1.8e-11|1.0e-06|8.7e-06| 0.000000e+00 3.351492e-06| 0:0:03| chol 1 1
7|1.000|0.989|1.0e-12|1.1e-08|9.5e-08| 0.000000e+00 3.653098e-08| 0:0:03| chol 1 1
8|1.000|0.985|5.2e-15|1.6e-10|1.6e-09| 0.000000e+00 3.760171e-10| 0:0:03|
stop: max(relative gap, infeasibilities) < 1.49e-08

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


(Mark L. Stone) #4

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.


(Mariana Uzeda) #5

Thanks for the answer Mark,

I had read the user’s guide before actually, but frankly there are thing that i didn’t understaind. I’m new with LMIs and Convex Programming. I usually worked with analytic approaches.