Dear Mark,

The reason why I did’t include the constrain sum(tau)=1 was I thought it should be iterated by one dimension search method. so I consider it as a new AO variable.

I try to add this constrain to the optimization problem,but the optimal value still is zero.

here’s my program.

```
function [W,flag] = Generate_TS_W(N, M, K, H, G,...
W_ini,Fi_ini_TS,t_ini,noise_maxpower, trans_maxpower)
```

%%

%cvx_solver mosek

%cvx_save_prefs

cvx_begin %quiet

variable W(N,K) complex

variable tau(K)

```
expressions POLY_TS(K) ;
%obj_function=polynomial 1-polynomial 2 +polynomial 3 are scalar
Phi=Fi_ini_TS;
%Fi_k=zeros(1,M);
k=1:1:K;%该两个条件必须并列执行
u=K:-1:1;%k,u的维度必须相同！
for i=1:length(k)
if k(i)==1 && u(i)==1
a(k(i))=0.5;
H_eqvi(k(i),:)=H(:,k(i))'+Fi_ini_TS(k(i),:)*G(:,:,k(i));
H_eqvi(u(i),:)=H(:,u(i))'+Fi_ini_TS(u(i),:)*G(:,:,u(i));%两种fi反射系数两种用户。
H_eqv(k(i),:)=H(:,k(i))'+Phi(k(i),:)*G(:,:,k(i));
H_eqv(u(i),:)=H(:,u(i))'+Phi(u(i),:)*G(:,:,u(i));
B_g1(k(i))=H_eqvi(k(i),:)*W_ini(:,k(i));%四种beamforming组合 for given point.
B_g2(k(i))=H_eqvi(k(i),:)*W_ini(:,u(i));
B_g3(k(i))=H_eqvi(u(i),:)*W_ini(:,k(i));
B_g4(k(i))=H_eqvi(u(i),:)*W_ini(:,u(i));
B_1(k(i))=H_eqv(k(i),:)*W(:,k(i));%四种beamforming组合
B_2(k(i))=H_eqv(k(i),:)*W(:,u(i));
B_3(k(i))=H_eqv(u(i),:)*W(:,k(i));
B_4(k(i))=H_eqv(u(i),:)*W(:,u(i));
%%%%% Generate Polynomial 1 %%%%%
POLY_1(k(i))=2/noise_maxpower*real(B_1(k(i))'*B_g1(k(i)));
%%%%% Generate Polynomial 2 %%%%%
c(k(i))=(abs(B_g1(k(i)))^2)/(noise_maxpower*(noise_maxpower+abs(B_g1(k(i)))^2));
POLY_2(k(i))=c(k(i))*(abs(B_1(k(i)))^2+noise_maxpower);
%%%%% Generate Polynomial 3 %%%%%
f(k(i))=1/(noise_maxpower+abs(B_g3(k(i)))^2);
POLY_3(k(i))=f(k(i))*abs(B_3(k(i)))^2;
%%%%% final polynomial %%%%%
POLY_TS(k(i))=a.*tau(k(i))*(POLY_1(k(i))- POLY_2(k(i))-POLY_3(k(i)));
end
end
maximize sum(POLY_TS)
subject to
for i=1:length(k)
if k(i)==1 && u(i)==1
norm(W,'fro')^2<=trans_maxpower;
sum(tau)==1;
%z(k)>=noise_maxpower;
end
end
cvx_end
if cvx_status(1)=='S' || cvx_status(3)=='a'
flag=1;
else
flag=0;
end
end
```

input data:

```
N=3;M=6;K=2;noise_maxpower = 1;trans_maxpower=100 ;
b=2*pi;a=0;
Fi_temp=(b-a).*rand(2,M) + sqrt(-1)*(b-a).*rand(2,M);
Fi_amp=rand(2,M);
Fi_ini_TS=Fi_amp.*exp(1j*angle(Fi_temp));
W_ini=randn(N,K)*sqrt(trans_maxpower/(N*K));
H=rand(N,K);
G=rand(M,N,K);
```