Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about sosdemo2 #17

Open
Yngjx opened this issue Dec 3, 2023 · 2 comments
Open

A question about sosdemo2 #17

Yngjx opened this issue Dec 3, 2023 · 2 comments

Comments

@Yngjx
Copy link

Yngjx commented Dec 3, 2023

Hi,djagt

I encountered a problem about sosdemo2. The reason was that I made the following changes:
% Constructing the vector field dx/dt = f f = [-x1^3-x1*x3^2; -sin(x2)-x1^2*x2; -x3+3*x1^2*x3-3*x3/(x3^2+1)];
I'm using a sin function here

Then I encountered an error like this, which I couldn't solve, so I asked you for help.
`Unable to convert expression containing symbolic variables into double array. Apply 'subs' function first to substitute values for variables.

Error in sym/double (line 872)
Xstr = mupadmex('symobj::double', S.s, 0);

Error getequation (line 346)
At(:,(i-1)dimp^2+1:idimp^2) = sparse(-double(jacobian(Mivec,decvartable))');

Error sosconstr (line 104)
getequation(char(symexpr),sos.vartable,sos.decvartable,sos.varmat.vartable);

Error sosineq (line 125)
sos = sosconstr(sos,'ineq',symexpr);

Error demo2test (line 29)
prog = sosineq(prog,expr)`

Looking forward to your reply!

@djagt
Copy link
Collaborator

djagt commented Dec 3, 2023

Hey Yngjx,

I'm afraid SOS programming really only works when the vector field f is polynomial. There are some cases in which vector fields with trigonometric functions (such as your sin) can be represented using polynomials, using a suitable change of variables. See for example Section 3.3. in

A. Papachristodoulou, S. Prajna, "On the Construction of Lyapunov Functions using the Sum of Squares Decomposition, Proceedings of the 41st Conference on Decision and Control, 2002.

However, I'm not sure such a polynomial representation is possible for the particular example you consider.

@Yngjx
Copy link
Author

Yngjx commented Dec 5, 2023

Thank you for your very prompt response!

I read the literature you provided, which means that SOSTOOL can only be used to solve polynomial problems. Therefore we need to convert non-polynomial functions into polynomial functions. For example:

y = sin(x);
y1 = x-1/6*x^3+1/120*x^5;#Taylor expansion approximation at 0 point

I understand the problem. In addition, I don’t know if you know another method, which is to use LQR to find the lyapunov function of a nonlinear system.

Thanks again and wish you a happy life!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants