POW_Pr=linspace(0.1,1,500);
for k=1:length(POW_Pr)
cvx_begin
variable Ps(k)
expressions S_sd S_rd S_sr S_mrc
S_sd=((abs(H_sd))^2./POW_N).*Ps;
S_rd=POW_Pr(k).*((abs(H_rd))^2./POW_N) ;
S_sr=((abs(H_sr))^2./POW_N).*Ps;
S_mrc=S_sd+(S_rd.*S_sr).*inv_pos((S_rd+S_sr+1));
maximize (S_mrc)
subject to
Ps(k)>0;
Ps(k)+POW_Pr(k)<=p0;
cvx_end
end
错误使用 .* (line 173)
Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {convex}
出错 main_ (line 24)
S_mrc=S_sd+(S_rd.*S_sr).*inv_pos((S_rd+S_sr+1));