I am a bachelor student and have the following question.
I am currently working on converting constraint functions into new constraints as sum of squares since I would like to solve the optimization problem through SDP-solvers.
Thanks to SOS-Tools in MATLAB I have obtained the following sum of squares variables:
$s=(238.3)t^4-(425.3)t^3+(223.7)t^2-(20.63)t+1.0$
$q=(50.84)t^2-(18.86)t+9.438$
where $t$ is an independent variable.
What I need is the $S$ & $Q$ Matrices where
$[1, t, t^2]\cdot S\cdot[1, t, t^2]T = s$
$[1, t]\cdot Q \cdot[1, t]T = q$
$S,Q \ge 0$
The next logical step would be to use another function of SOS-Tools and find such matrices with findsos(s) or findsos(q). This function; however, returns for some reason wrong matrices.
If the equations are calculated by hand, one can obtain the $Q$ matrix.
$q = Q(2,2) \cdot t^2 + 2 \cdot Q(1,2) \cdot t + Q(1,1)$
It's a little bit tricky for the other one.
$s = S(3,3) \cdot t^4 + 2\cdot S(2,3) \cdot t^3 + 2 \cdot (S(1,3) + S(2,2)) \cdot t^2 + 2\cdot S(1,2) \cdot t + S(1,1)$
$S(1,3)$ and $S(2,2)$ have to be decided in such a way that the matrix $(S)$ will be positive semi-definite.
As my problem gets more complex, the size of the matrices will also get bigger. That's why it is important for me to generalize things. Does anybody happen to know a trick on how to do it?
I'd very much appreciate your answer.
Kind regards
You have not explained in what sense they are wrong. I strongly doubt they are as this really is a trivial SOS problem.
As an alternative solution to double-check your results, here is the solution computed using YALMIP instead (disclaimer, MATLAB toolbox written by me).