*Here is my code:

cvx_begin

variables Wc(n,n) symmetric

variables Z(n,n)

for i = 1:n

for j = 1:n

if(i ~= j)

Z(i,j) == 0;

else

Z(i,j) >= 0;

Z(i,j) <= 1;

end

end

end

sum(trace(Z)) == k;

Wc == semidefinite(n);

A * Wc + Wc * A’ + V * Z * V’ == 0;

%% The Cost Function which needs to be Maximized

maximize(log_det(Wc));

cvx_end

with A being a random stable square matrix. I get this error message:

Error using det_rootn (line 28)

Matrix input 1 expected to be symmetric (deviation: 2).

— If this number is small (<1e-6), it may simply be due to roundoff error.

This can be corrected by applying the SYM(X) function.

— Otherwise, this is likely due to a modeling error. Did you declare the

relevant matrix variables to be “symmetric” or “hermitian”?

Error in log_det (line 27)

Error in ConvexRelaxation (line 33)

maximize(log_det(Wc));

The matrix Wc is declared to be symmetric. can anybody help me figure out how to solve this problem.