%优化Pa(n) CVX

Pak(n) = 0;

for i = 1:200

cvx_begin

variable Pa(n)

maximize( sum(log(1+an(n)-an(n)*bn(n)*inv_pos(bn(n)+Pa(n)))-((cn(n)

*dn(n))/((Pak(n)+dn(n))*(dn(n)+(cn(n)+1)

*Pak(n))))*

sum(Pa(n))/N <= 0.03;%Paba = lamdaPave/N < Pafeng

*Pa(n)) )*

subject to

0<= Pa(n) <= 4Paveba;%Pafeng = 4Pavebasubject to

0<= Pa(n) <= 4

sum(Pa(n))/N <= 0.03;%Paba = lamda

cvx_end

if Pa(n) == Pak(n)

break

end

Pak(n) = Pa(n);

end