function P = sm_polynomial(z,dim)
lz = length(z);
P = zeros(dim);
for k = 1:1:lz
  Pk = sdpvar(dim);
  P = P+Pk*z(k);
end