Source: https://www.ljll.math.upmc.fr/postel/CoursMatlab/Poly_Optim_annexe_matlab.pdf