Reputation: 1
My code in MATLAB is as follows:
syms y1 y2 y3;
%% Ini
alpha = 0.080000000000000;
C2 = 0.184517121059791; C1 = -0.004258087409072; C0 = -0.044890295109114;
x1e = 0.268756794252023;
V = 0.1*(y1 + y2 + y3)^2; % Example Lyapunov function
p = y1^2 + y2^2 + y3^2; % Example h(x1, x2)
q = 10^(-6)*(y1^2 + y2^2 + y3^2);
g = y1^2 + y2^2 - 1;
dV = jacobian(V, [y1; y2; y3]) * [y2*y3;-y1*y3;-alpha*y3 - C2*y1 - C1*y2 - C0]; % Derivative of V
gamma0 = 0.5;
%% Step 2
prog = sosprogram([y1, y2, y3]);
[prog, s1] = sospolyvar(prog, monomials([y1, y2, y3], 0:2));
[prog, s2] = sospolyvar(prog, monomials([y1, y2, y3], 0:2));
[prog, s3] = sospolyvar(prog, monomials([y1, y2, y3], 0:2));
[prog, v2] = sospolyvar(prog, monomials([y1, y2, y3], 0:1));
[prog, v3] = sospolyvar(prog, monomials([y1, y2, y3], 0:1));
[prog, c] = sospolyvar(prog, monomials([y1, y2, y3], 0));
prog = sosineq(prog, -s1*(gamma0 - p) - v2*g - (V - c));
prog = sosineq(prog, -s2*(c - V) - s3*dV - v3*g - q);
prog = sossetobj(prog,c);
prog = sossolve(prog);
s20 = sosgetsol(prog,s2);
s30 = sosgetsol(prog,s3);
My mistakes are as follows:
Error using symengine
Unable to convert expression into double array.
Error in sym/double (line 698)
Xstr = mupadmex('symobj::double', S.s, 0);
Error in getequation (line 346)
At(:,(i-1)*dimp^2+1:i*dimp^2) =
sparse(-double(jacobian(Mivec,decvartable))');
Error in sosconstr (line 104)
getequation(char(symexpr),sos.vartable,sos.decvartable,sos.varmat.vartable);
Error in sosineq (line 125)
sos = sosconstr(sos,'ineq',symexpr);
Error in Test_SOS2 (line 32)
prog = sosineq(prog, -s2*(c - V) - s3*dV - v3*g - q);
I think I have got mistakes regarding the formulation of the sum-of-square (SOS) problem when declaring the product s2*c. s2 and c are polynomials. What should I do to pass this error ?
Note that this is the initial step in the algorithm in the following article. https://www.researchgate.net/publication/338586868_Application_of_sum-of-squares_method_in_estimation_of_region_of_attraction_for_nonlinear_polynomial_systems_August_2019
Upvotes: 0
Views: 21