The error.
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To
perform elementwise multiplication, use '.*'.
Error in cvxprob/eliminate (line 137)
P = P * cvx_invert_structure( xR );
Error in cvxprob/solve (line 18)
[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );
Error in cvx_end (line 88)
solve( prob );
Error in svm_primal_2 (line 78)
cvx_end
Error in opt_phase_shift_matrix (line 168)
[V] = svm_primal_2(para,h_RU,h_RE,h_iR,h_iU,h_iE,h_UE,h_UR,para.M+1,S,scheduling2,transmit_p,jamming_p);
Error in main (line 114)
[theta_t, sec_rate2] = opt_phase_shift_matrix(para,h_hat,Theta,Q_r,Z_0,scheduling2,transmit_p,jamming_p);
The code.
function [V] = svm_primal_2(para,h_RU,h_RE,h_iR,h_iU,h_iE,h_UE,h_UR,M,S,scheduling2,transmit_p,jamming_p)
sigma2 = 10^(para.sigma2_dBm/10)/1000;
sigma_RSI2 = 10^(para.sigma2_dBm/10)/1000;
Tao_0 = zeros(para.K,para.T);
cvx_begin
cvx_solver mosek
%cvx_begin sdp
variable X(M,M,para.T) complex
variable miu(1,para.T) nonnegative
variable S(M,M,para.T) complex
variable Tao(para.K,para.N)
variable elta nonnegative
expression secRate(para.K,para.N);
for k = 1:para.K
for n = 1:para.T
if scheduling2(k,n) > 0
AW_1 = (transmit_p(n)/(sigma2+jamming_p(n)*sigma_RSI2))*diag(conj(h_RU(:,n)'))*conj(h_iR(:,k))*(h_iR(:,k).')*diag(h_RU(:,n)');
AW_2 = (transmit_p(n)/(sigma2+jamming_p(n)*sigma_RSI2))*diag(conj(h_RU(:,n)'))*conj(h_iR(:,k))*(h_iE(k).');
AW_3 = (transmit_p(n)/(sigma2+jamming_p(n)*sigma_RSI2))*conj(h_iU(k,n))*(h_iR(:,k).')*diag(h_RU(:,n)');
G_W = [AW_1,AW_2;AW_3,0];
h_W = transmit_p(n) * conj(h_iU(k,n)) * h_iU(k,n);
secRate(k,n) = log(1+real(trace(G_W*S(:,:,n))+h_W))./ log(2) - real(Tao(k,n))/((1+Tao_0(k,n))*log(2));
end
end
end
throughput_sec = sum(secRate,2);
maximize(elta)
subject to
throughput_sec >= elta %max-min
for k = 1:para.K
for n = 1:para.T
if scheduling2(k,n) > 0
AI_1 = (transmit_p(n))*diag(conj(h_RE'))*conj(h_iR(:,k))*(h_iR(:,k).')*diag(h_RE');
AI_2 = (transmit_p(n))*diag(conj(h_RE'))*conj(h_iR(:,k))*(h_iE(k).');
AI_3 = (transmit_p(n))*conj(h_iE(k))*(h_iR(:,k).')*diag(h_RE');
AU_1 = (jamming_p(n))*diag(conj(h_RE'))*conj(h_UR(:,n))*(h_UR(:,n).')*diag(h_RE');
AU_2 = (jamming_p(n))*diag(conj(h_RE'))*conj(h_UR(:,n))*(h_UE(n).');
AU_3 = (jamming_p(n))*conj(h_UE(n))*(h_UR(:,n).')*diag(h_RE');
G_I = [AI_1,AI_2;AI_3,0];
G_U = [AU_1,AU_2;AU_3,0];
h_U = jamming_p(n) * conj(h_UE(n)) * h_UE(n);
h_I = transmit_p(n) * conj(h_iE(k)) * h_iE(k);
real(trace(G_I*X(:,:,n)) + miu(n).*h_I) <= real(Tao(k,n));
trace(G_U*X(:,:,n)) + miu(n).*(h_U)+miu(n).*sigma2 == 1;
end
end
end
for n = 1:para.T
for z =1:M
for i = 1:M
for j = 1:M
if i == j && z == i && z == j
trace(X(i,j,n)) == miu(n);
end
end
end
end
end
for n = 1 : para.T
S(:,:,n) == semidefinite(M);
X(:,:,n) == semidefinite(M);
miu(n) >= 0
end
V = X;
cvx_end
I have checked that there is not problem with matrix dimension. But I don’t know why.
I’ll appreciate if there is anyone could found the way to solve this problem.
I had tested and founded that three subjects would lead to this problem.
real(trace(G_I*X(:,:,n)) + miu(n).*h_I) <= real(Tao(k,n));
trace(G_U*X(:,:,n)) + miu(n).*(h_U)+miu(n).*sigma2 == 1;
trace(X(i,j,n)) == miu(n);
But I still don’t understand.