cvx_clear

cvx_begin quiet

variable x_hat(d,d,K,K) complex

expression obj(1)

expression cons(K)

```
for k = 1:K
obj = obj - real(weights(k) * trace(W(:,:,k) * x_hat(:, :, k, k)' + W(:,:,k) * x_hat(:, :, k, k)));
for m = 1:K
obj = obj + weights(k) * square_pos(norm(sqrtm(W(:,:,k))*x_hat(:,:,k,m),'fro'));
% underlined part
obj = obj + real(trace(lamda(:, :, k, m)*(U(:,:,k)'*H(:,:,k)*V(:,:,m) - x_hat(:, :, k, m))));
obj = obj + 0.5 * rho * square_pos(norm(U(:,:,k)'*H(:,:,k)*V(:,:,m) - x_hat(:, :, k, m), 'fro'));
end
end
for k = 1:K
cons(k) = cons(k) - real(trace(W(:,:,k) * x_hat(:, :, k, k)' + W(:,:,k) * x_hat(:, :, k, k)));
for m = 1:K
cons(k) = cons(k) + square_pos(norm(sqrtm(W(:,:,k))*x_hat(:,:,k,m),'fro'));
end
end
minimize (obj)
subject to
for k = 1:K
cons(k) <= e(k);
end
cvx_end
X(:, :, :, :) = x_hat(:, :, :, :);
```

The convex problem is shown in the figure, where W is a positive semidefinite hermitian matrix . And i am trying to solve it with CVX. However, the trace of the underlined part is a complex value. The error occurred when i just used trace(), so i changed the code with real(trace())

(obj = obj + real(trace(lamda(:, :, k, m)*(U(:,:,k)’*H(:,:,k)*V(:,:,m) - x_hat(:, :, k, m))));),

but actually it is a complex value. I did not get the results I want, and I think there might be something wrong here. Or is there anything wrong with my code?

Anyone can help me to solve this problem ? thank you so much