Hi. I want to solve a convex optimization problem in following article:

[Li, Quanzhong, et al. “Optimal relay selection and beamforming in MIMO cognitive multi-relay networks.” *IEEE Communications Letters* 17.6 (2013): 1188-1191.]

i have to solve two problems:

but the matrices A1,A2,A3,Bm,S and W is not real. (is complex). but all trace(.) are real beacause original problem was real.

but my results arent true. my codes:

```
cvx_begin
variable S(N*N,N*N) hermitian
variable v(1) nonnegative
maximize (real(trace(A11*S)))
subject to
real(trace(A21*S))+sigma2*v==1;
real(trace(A31*S))<=v*PR(ii);
real(trace(B1_1*S))<=v*I1;
real(trace(B2_1*S))<=v*I2;
imag(trace(B2_1*S))==0
imag(trace(A11*S))==0;
imag(trace(B1_1*S))==0;
imag(trace(A31*S))==0;
imag(trace(A21*S))==0;
S==hermitian_semidefinite(N*N);
cvx_end
gamma1=cvx_optval;
cvx_begin
variable W(N*N,N*N) hermitian
minimize (real(trace(A31*W)))
subject to
real(trace(A11*W))-(gamma1-delta_gamma)*real(trace(A21*W))-(gamma1-delta_gamma)*sigma2>=0;
real(B1_1*W)<=I1;
real(B2_1*W)<=I2;
imag(B2_1*W)==0;
imag(B1_1*W)==0;
imag(trace(A11*W))==0;
imag(trace(A21*W))==0;
imag(trace(A31*W))==0;
W==hermitian_semidefinite(N*N);
cvx_end
```

could you help me please?