/*
 * sdpsol source file for the Lyapunov exponent analysis problem
 * SEE:  S. Boyd and L El Ghaoui, "Method of Centers For Minimizing 
 *       Generalized Eigenvalues", Linear Algebra and Applications,
 *       special issue on Numerical Linear Algebra Methods in Control,
 *       Signals and Systems, Vol. 188, pp 63-111, 1993
 * NOTE: This file just tests a given Lyapunov exponent is feasible or not.
 *       The lowest upper bound on Lyapunov exponent is found via bisectioning
 *       a given interval of possible exponents, with the help of Matlab
 *       script lyapexp.m. The user should run this example by calling
 *       lyapexp.m under Matlab.
 * source code filename: lyapexp
 * Matlab script file:   lyapexp.m
 */
include("polytopicsys.mat");  /* load system data: A_j */
include("lyapexp.mat");       /* load alpha */

N = rows(A1);

variable P(N,N) symmetric;
initialize P = eye(N,N);

constraint sys1  A1'*P+P*A1-2*alpha*P < 0;
constraint sys2  A2'*P+P*A2-2*alpha*P < 0;
constraint sys3  A3'*P+P*A3-2*alpha*P < 0;
constraint sys4  A4'*P+P*A4-2*alpha*P < 0;
constraint nrml   Tr(P) == 1;
constraint pd     P > 0;
