Please find the code below:
cvx_begin sdp
variable W(M, M, N) hermitian semidefinite
variable W_tilde(M, M, N, J) hermitian semidefinite
variable c(N, J) nonnegative
expressions y(N, J) z(N, J) R(N, 1)
% Define the objective function
for n = 1:N
W_int_n = W_int(:, :, n);
W_n = W(:, :, n);
H_n = squeeze(H(n, :, :));
% Initialize x
x = cvx(zeros(1, 1));
% Loop over j
for j = 1:J
W_tilde_nj = W_tilde(:, :, n, j);
F_nj = squeeze(F(n, j, :, :));
alpha_nj = alpha(n, j);
% Update x
x = x + alpha_nj * trace(F_nj * W_tilde_nj)/sigma;
end
% Calculate constant terms
tr_Hn_Wn = trace(H_n * W_n);
tr_Hn_Wintn = trace(H_n * W_int_n);
% Update R
R(n) = real(log(x + beta_sic * tr_Hn_Wn + 1) / log2) ...
- real(log(beta_sic * tr_Hn_Wintn + 1) / log2) ...
- real(trace((beta_sic_log2 * H_n / (tr_Hn_Wintn + 1 / beta_sic)) * (W_n - W_int_n)));
end
obj = sum(R);
maximize(obj)
subject to
for n = 1:N
W_n = W(:, :, n);
H_n = squeeze(H(n, :, :));
for j = 1:J
G_jn = squeeze(G(n, j, :, :));
F_nj = squeeze(F(n, j, :, :));
W_tilde_nj = W_tilde(:, :, n, j);
a_m = squeeze(a(n, j, :));
alpha_nj = alpha(n, j);
y(n, j) = alpha_nj * trace(a_m * a_m' * W_tilde_nj);
z(n, j) = alpha_nj * trace(F_nj * W_tilde_nj);
% C3
real(trace(G_jn * W_tilde_nj) - P_th/(1 - alpha_nj)) >= 0;
imag(trace(G_jn * W_tilde_nj) - P_th/(1 - alpha_nj)) == 0;
% C5
real(W_tilde_nj - c(n, j) * PmaxEye) <= 0;
imag(W_tilde_nj - c(n, j) * PmaxEye) == 0;
% C6
real(W_tilde_nj - W_n) <= 0;
imag(W_tilde_nj - W_n) == 0;
% C7
real(W_tilde_nj - W_n + (1 - c(n, j)) * PmaxEye) >= 0;
imag(W_tilde_nj - W_n + (1 - c(n, j)) * PmaxEye) >= 0;
end
% C2
real((trace(H_n * W_n) / (gamma_t_th*sigma)) - sum(z, 2)/sigma - 1) >= 0;
imag((trace(H_n * W_n) / (gamma_t_th*sigma)) - sum(z, 2)/sigma - 1) >= 0;
% C4
trace(W_n) - Pmax <= 0;
end
% C1
real(sum(y, 1)/sigma - gamma_s_th) >= 0;
imag(sum(y, 1)/sigma - gamma_s_th) == 0;
% C8
sum(sum(c - c_int.^2 - 2 * c_int .* (c - c_int))) <= 0;
% C9
0 <= c <= 1;
cvx_end
Also, the error in the command window is given by:
Error using cvxprob/newcnstr
SDP constraint must be square.
Error in variable (line 191)
newcnstr( prob, v, 0, '>=', false );
Error in Optimiz_W_C (line 40)
variable c(N, J) nonnegative