Is my code right?it can run,but i am not sure this code is right or wrong

The code  of problem is as the picture shown

K=4;
N=4;
nois_var_ak=1;
nois_var_dk=1;
bar_r=[10 10 10 10];
P_hat=0.00001;
h_k=sqrt(1/2)*(randn(1,K)+1i*randn(1,K));
cvx_begin
variable Fk(N,K)   semidefinite;% c7
variable rho_k(K)  ;
%variable mu_k(K)   nonnegative;
all_F_k=0;
for k=1:K
   all_F_k=all_F_k+trace(Fk(k))
end
minimize( all_F_k )
subject to
% c3
    0<=rho_k(k)<=1;
 %========================================================
   %c5
   total = 0;
    for k = 1:K
        sumj = 0;
        for j = 1:K
            if j ~= k  
             sumj = sumj +  h_k(k) * Fk(j) * h_k(k)' ;
            end
        end
        %total = total + mu(k) * (h_k(k) * Fk(k) * h_k(k)' - sumj) * inv_pos( bar_r(k) );
        total = total + mu(k) * ( ( h_k(k) * Fk(k) * h_k(k)'* inv_pos( bar_r(k) ) )- sumj) ;
    end
   %=============================================================      
    %c10
    sumj_10=0
    for j=1:K
       sumj_10=sumj_10+(h_k(k)'*Fk(j)*h_k(k));
       sumj_10+(nois_var_ak)*(nois_var_ak) >= P_hat * inv_pos(1- rho_k(k));%c10
    end
 %=============================================================      
cvx_end

So in fact,i want to minimize the F_k,and find the optimal value of F_k and rho_k,but after finishing runing this code,the window just show me one optimal value,and i am not sure that this optimal value is min F_k , F_k or rho_k

Status: Solved
Optimal value (cvx_optval): -0.86155

You have declared Fk as a single matrix. There are not K different Fk(j) matrices…

Declare as
variable Fk(N,N,K) semidefinite
This will make Fk(:,:,k) be semidefinite for each k from 1 to K; so that takes care of c7.

c3 should be
0 <= rho_k <= 1

Your constraint
0<=rho_k(k)<= 1
only constrains rho_k(K) , because k has the value K when that line of code is executed.

With these hints, hopefully you will go carefully through your code and figure out what needs to be fixed. I think you will benefit by carefully re-reading the CVX Users’ Guide, ans start with simpler example, then perhaps modify them, Then come back to the problem you really want to solve.

Edit: Here is what your code

for k=1:K
   all_F_k=all_F_k+trace(Fk(k))
end

actually does. Because F_k(k) is the kth element, as stored, of the matrix F_k , all_F_k sums the elements of the first column of F_k , Because F_k is symmetric due to being declared semidefinite, that is the same as the sum of the elements of the first row of F_k , which of course is not what you want.

Maybe you misunderstand my thinking,in fact,j and k are the same,but also not totally the same.let me take an example
If K is 4,and the range of k is 1 to 4,so k can be 1,2,3,4.in fact , j can also be 1,2,3,4.however,if there is one constraint between k and j ,that is if k=1,then j can just be 2,3,4.if k=2,j can just be 1,3,4.in short,the range of k and j are the same,but the value of k and j cannot be the same.that’s why i will write Fk(j)

Given MATLAB’s and CVX’s syntax, your code does not properly implement the model you displayed. I gave you some hints of some of what needs to be fixed. You seem to be trying to impose your own desired syntax onto MATLAB/CVX, but that will not work.

then how do i describe the Fk(j)??

As I wrote previously

Declare as
variable Fk(N,N,K) semidefinite
This will make Fk(:,:,k) be semidefinite for each k from 1 to K; so that takes care of c7.

OH yes,i found that i am wrong the other side,thx for replying