How can i solve this problem

Hello everyone,
I have the following problem and got stuck in it.
i want to maximize and objective function which is capacity given by

C = log_2(det(I_M+SNR.deltaH*H’))
where I_M is identity matrix of size M. SNR is scalar. delta is a diagonal matrix of size M. H is a random matrix or rayleigh distributed elements of size M.
the constraints are that elements of diagonal matrix must be random and must be always in the range of 0 to 1. The second constraint is that the sum of diagonal elements should be equal to M’ which is integer smaller or equal to M.
I have written the following code for this. i have used log_rootn in instead of log_det. This code gives some values of C but elements of delta matrix always are the same. Please help me in this regards

rng(0,‘twister’);
SNR = .2;
M = 10;
M_sel = 2;
I_M = eye(M);
H = randn(M,M);
cvx_begin
variable delta(M,M) diagonal
C = I_M+SNR.deltaH*H’;
maximize(det_rootn©)
subject to
for i = 1:M
delta(i,i) <= 1
delta(i,i) >= 0
trace(delta)<= M_sel
end
cvx_end

I believe you are noting that all diagonal elements of the maximizing value of delta are equal to M_sel/M, regardless of the random instantiation of H. This is a mathematical consequence of your model. Essentially, you are maximizing det©, i.e., maximizing the product of the eigenvalues of C. Because delta is psd due to your constraints, C is psd. So for purposes of finding the argmax, we can ignore the additive eigenvalue shift of 1 induced by I_M. So now we’re left with maximizing

det(SNR*delta*H*H'), which equals 
det(SNR)*det(delta)*det(H*H')

Given that SNR is positive and det(H*H’) is non-negative, this is thus equivalent to maximizing det(delta), which, given the constraints, is achieved by setting all diagonal elements of delta to M_sel/M, and is independent of the particular H matrix.

Well it works but the diagonal elements of delta that i get are all the same. i want random values which are less than 1 and greater than 0. and if u sum them they should be = M_sel

I explained why you are getting those results. If they are are not to your liking, then your model is inadequate. I don’t know what you are really trying to do. If you just want your stated result, you can just generate random numbers and normalize them, using acceptance/rejection if necessary.