Information Technology Reference
In-Depth Information
Appendix B
Code of Examples of Chapter 5
Code of Example 5.4 Using YALMIPSOS
sdpvar x %Define independent variables
%Create the Psatz multiplier xˆ2
[s,coef,monom]=polynomial(x,2,2);
%Define SOS constraints
constr=[sos(1-xˆ3-s*(0.25-xˆ2)),sos(s)];
obj=[]; %No objective to minimize
sol=solvesos(constr,obj,[],coef) %Solve SOS problem
%Display solution (the Psatz multiplier found)
disp('S='), sdisplay(double(coef)*monom) S = '1.4076*xˆ2'
Code of Example 5.7 Using YALMIPSOS
sdpvar x1$\,\times\,$2 x3 sg1 sg2 %Define independent variables
% Defining system derivatives
dx1=-(sg1ˆ2+sg2ˆ2)*(x1ˆ3)-(sg1ˆ2+0.05*sg2ˆ2)*x1*x3ˆ2;
dx2=-sg1ˆ2*x2-2*sg2ˆ2*x2-(sg1ˆ2+sg2ˆ2)*x1ˆ2*x2;
dx3=(sg1ˆ2+sg2ˆ2)*(3*x1ˆ2*x3-4*x3);
% Tolerance epsilon and Lyapunov function
eps1=0.01*(x1ˆ4+x2ˆ4+x3ˆ4);
eps2=0.01*(x1ˆ4+x2ˆ4+x3ˆ4)*(sg1ˆ2+sg2ˆ2);
[V,coef,monom]=polynomial([x1,x2,x3],4,2);
% Define SOS constraints
dV=jacobian(V,x1)*dx1+jacobian(V,x2)*dx2+jacobian(V,x3)*dx3;
Constr=[sos(V-eps1),sos(-dV-eps2)];
obj=[]; %Minimization objective is not relevant
sol=solvesos(Constr,obj,[],coef) %Solve SOS problem
disp('V='), sdisplay(clean(double(coef)'*monom,1e-7)) %Display sol.
 
Search WWH ::




Custom Search