original
cvx_begin quiet
variable w(L*N,K) complex
expression f_n(K,M)
expression f_n_part1(K,M)
for s = 1:M
for k = 1:K
f_n_part1(k,s)=0;
for i = 1:K
for m = 1:M
if i == k && m==s
f_n_part1(k,s) = f_n_part1(k,s) + 0;
else
f_n_part1(k,s) = f_n_part1(k,s) + p(i)*(weight_n(:,k,s)'*dki(:,k,i,s,m))^2;
end
end
end
f_n(k,1) = a_bar(k,1) - abs(h_k’ * sqrt_p * w_n(:,k))^2 * inv_pos(2 * real( sqrt_p * w_n(:,k)’ * h_k * h_k’ * sqrt_p * w(:,k)) - abs(h_k’ * sqrt_p * w_n(:,k))^2);
end
end
my version
cvx_begin quiet
variable p(K,1)
expression f_n(K,M)
expression f_n_part1(K,M)
for s = 1:M
for k = 1:K
f_n_part1(k,s)=0;
for i = 1:K
for m = 1:M
if i == k && m==s
f_n_part1(k,s) = f_n_part1(k,s) + 0;
else
f_n_part1(k,s) = f_n_part1(k,s) + p(i)*(weight_n(:,k,s)'*dki(:,k,i,s,m))^2;
end
end
end
f_n(k,s) = a_bar(k,s) - abs(p_n(k)*(weight_n(:,k,s)'*b(:,k))^2) * inv_pos(2 * real(sqrt(p_n(k))*(weight_n(:,k,s)'*b(:,k))'*(weight_n(:,k,s)'*b(:,k))*sqrt(p(k))) - abs(p_n(k)*(weight_n(:,k,s)'*b(:,k))^2));
end
end
I just changed the variable from w to p and started reporting errors
Error using + (line 83) Disciplined convex programming error: Illegal operation: {complex constant} - {convex}
Error - (Line 21) z = plus( x, y, true, cheat );
How to solve this problem?