Nt=4;NR=4;
N0=1;
H=rand(4,4);
P=[0 0 0 1;0 0 1 0;0 1 0 0;1 0 0 0];
[QQ,RR]=qr(H'*P);
RRR=P*RR'*P;
QQQ=P*QQ';
Pmax=20;
B=inv(QQQ);
af=1.5;
for in = 1:NR
p(in) = (af^in-af^(in-1))*Pmax/(af^Nt-1);
end
Heff=RRR;
R = zeros(iternum,1);
tnt=zeros(iternum,NR);
for tt = 1:NR
if tt == 1
gamma(tt)= ((abs(Heff(tt,tt)).^2)*p(tt))./N0;
else
gamma(tt)= ((abs(Heff(tt,tt)).^2)*p(tt))./((Heff(tt,(tt+1):Nt).^2)*p((tt+1):Nt)+N0);
end
theta(tt)=sqrt((abs(Heff(tt,tt)).^2)*p(tt)*(1+gamma(tt)))./(log(2)*((Heff(tt,tt:Nt).^2)*p(tt:Nt)+N0));
end
detaI=min(BL-Il,Ih-BL);
cvx_begin
variable lambda(NR) nonnegative;
variable p(NR) nonnegative;
expression R1(Nt);
lambda=sqrt(p);
for i=1:NR
R1(i)=2*theta(i)*sqrt((Heff(i,i).^2)*p(i)*(1+gamma(i)))-theta(i).^2*log(2)*(((Heff(tt,tt:Nt)).^2)*p(tt:Nt)+N0)+(log(1+gamma(i))/log(2)-gamma(i)/log(2));
end
maximize(sum(R1(1:NR)));
subject to
for j = 1:NR
%p(j)>=lambda(j)^2;
abs(B(j,:)*lambda) <= detaI;%<------**-this code has problem???**
%p(j)>=lambda(j)^2;
p(j) > 1e-9;
end
sum(p) <= Pmax;
cvx_end
Error:
错误使用 * (line 306)
Disciplined convex programming error:
Illegal affine combination of convex and/or concave terms detected.
出错 R_SINR (line 172)
abs(B(j,:)*lambda) <= detaI;