Respected Professor Johan,
I was trying to reproduce an example given in documentation of sostool. Its about computing Lyapunov function. I was trying to compare solution using sostool for sosdemo2 example and using yalmip to solve the same problem.
System dynamics are given as follow
f = [-x1^3-x1*x3^2;
-x2-x1^2*x2;
-x3+3*x1^2*x3-3*x3/(x3^2+1)];
V is supposed to have only quadaratic terms. The candidate Lyapunov function must satisfy the following condition
V- (x1^2+x2^2+x3^2) > 0,
-(diff(V,x1)*f(1) + diff(V,x2)*f(2) + diff(V,x3)*f(3) )*(x3^2+1) > 0
The solution when solved using sostools give the following
7.02*x1^2 + 4.767*x2^2 + 1.984*x3^2
(They did reported in manual 5.5489x1^2 + 4.1068x2^2 + 1.7945x3^2, which may be o since solution looks closer). Code is provided in demo of sostool
I code the following equivalent problem in yalmip
clear;
close all;
sdpvar x1 x2 x3;
% f = [-x1^3 - x1*x3^2;-x2 - x1^2*x2; -x3 + 3*x1^2*x3 - (3*x3)/(x3^2+1) ];
f = [-x1^3-x1*x3^2;
-x2-x1^2*x2;
-x3+3*x1^2*x3-3*x3/(x3^2+1)];
% v1 = monolist([x1 x2 x3],2);
% c1 = sdpvar(length(v1),1);
% V = c1'*v1;
c1 = sdpvar(3,1);
V = c1'*[x1^2;x2^2;x3^2];
options = sdpsettings('solver','sedumi');
Model = [sos(V-1*(x1^2+ x2^2+ x3^2)), sos(-jacobian(V,[x1])*(x3^2+1)*f(1) + ...
-jacobian(V,[x2])*(x3^2+1)*f(2) + -jacobian(V,[x3])*(x3^2+1)*f(3))];
[sol,v,Q] = solvesos(Model,[],options,c1)
valc1 = value(c1)
It gives me PRIMAL_INFEASIBLE error
yalmipversion: '20181012'
yalmiptime: 0.5126
solvertime: 0.1354
info: 'Unbounded objective function (SeDuMi-1.3)'
problem: 2
Can you let me know where I am doing wrong here. I tried with mosek and it gave me the same error. I did with sedumi since sostools uses sedumi.