clear all yalmip('clear'); % States... sdpvar x1 x2 x = [x1;x2]; % Non-quadratic Lyapunov z'Pz z = [x1;x2;x1^2]; P = sdpvar(3,3); V = z'*P*z; % Non-linear state feedback v = [x1;x2;x1^2]; K = sdpvar(1,3); u = K*v; % System x' = f(x)+Bu f = [1.5*x1^2-0.5*x1^3-x2; 3*x1-x2]; B = [0;1]; % Closed loop system, u = Kv fc = f+B*K*v; % Stability and performance constraint dVdt < -x'x-u'u % NOTE : This polynomial is bilinear in P and K F = set(sos(-jacobian(V,x)*fc-x'*x-u'*u)); % P is positive definite, bound P and K for numerical reasons F = F + set(P>0)+set(25>P(:)>-25)+set(25>K>-25); % Minimize trace(P) % Parametric variables P and K automatically detected % by YALMIP since they are both constrained solvesos(F,trace(P));
Output:
-------------------------------------------------------------------------
YALMIP SOS module started...
-------------------------------------------------------------------------
Detected 9 parametric variables and 2 independent variables.
Detected 0 linear inequalities, 0 equality constraints and 1 LMIs.
Using image representation (options.sos.model=2). Nonlinear parameterization found
Initially 7 monomials in R^2
Newton polytope (0 LPs).........Keeping 4 monomials (0.14063sec)
Finding symmetries..............Found no symmetries (0sec)
double(K)
ans =
NaN NaN NaN
Output with K = -0.0001*ones(1, 3) and F = F + set(P > 0)
-------------------------------------------------------------------------
YALMIP SOS module started...
-------------------------------------------------------------------------
Detected 6 parametric variables and 2 independent variables.
Detected 0 linear inequalities, 0 equality constraints and 1 LMIs.
Using kernel representation (options.sos.model=1).
Initially 7 monomials in R^2
Newton polytope (0 LPs).........Keeping 4 monomials (0.15625sec)
Finding symmetries..............Found no symmetries (0sec)
The coefficient matrix is not full row rank, numerical problems may occur.
SeDuMi 1.3 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, theta = 0.250, beta = 0.500
eqs m = 11, order n = 8, dim = 26, blocks = 3
nnz(A) = 34 + 0, nnz(ADA) = 121, nnz(L) = 66
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 5.98E+000 0.000
1 : 6.38E-001 1.81E+000 0.000 0.3032 0.9000 0.9000 1.52 1 1 1.7E+000
2 : 4.45E+000 6.17E-001 0.000 0.3400 0.9000 0.9000 -0.12 1 1 1.4E+000
3 : 1.23E+001 1.50E-001 0.000 0.2425 0.9000 0.9000 -0.28 1 1 8.8E-001
4 : 3.60E+001 4.52E-002 0.000 0.3020 0.9000 0.9000 -0.54 1 1 8.1E-001
5 : 3.20E+002 1.42E-002 0.000 0.3148 0.9000 0.9000 -1.26 1 1 2.6E+000
6 : 7.02E+002 2.88E-003 0.000 0.2026 0.9000 0.9000 -3.11 1 1 1.1E+000
7 : 7.07E+005 1.46E-005 0.000 0.0051 0.9990 0.9990 -1.15 1 1 5.4E+000
8 : 1.07E+012 2.47E-012 0.000 0.0000 1.0000 1.0000 -1.00 1 1
Primal infeasible, dual improving direction found.
iter seconds |Ax| [Ay]_+ |x| |y|
8 0.4 0.0e+000 0.0e+000 0.0e+000 7.4e+000
Detailed timing (sec)
Pre IPM Post
1.570E-001 2.810E-001 3.100E-002
Max-norms: ||b||=2.253167e-001, ||c|| = 1,
Cholesky |add|=0, |skip| = 1, ||L.L|| = 3.65754.
-> Solver reported unboundness of the dual problem.
-> Your SOS problem is probably infeasible.
F = sos(-jacobian(V,x)*fc-x'*x-u'*u);
F = [F, P>=0, 25>=P(:)>=-25, 25>=K>=-25];
[F,h] = compilesos(F,h,ops,parameters)
model = export(F,h,ops)
pen = model.penstruct
save uploadtoneos pen