function Q=subprob3(ps,pu,q,num)

k=0.5772;

gamma0=10e9;

phi=0.1;

ps_max=10^(3.6);

dSD=300;

dSE=sqrt(2*40000);
wD=[300;0];
wE=[200;200];
H=100;
for i=1:num
c(i)=exp(-k)*pu(i))

*gamma0*dSD^(-phi)

*ps(i); d(i)=gamma0/(norm(q(i,:)’-wD,2)^2+H^2); e(i)=gamma0*dSE^(-phi)

*ps(i); f(i)=gamma0/(norm(q(i,:)’-wE,2)^2+H^2); end for i=1:num l(i)=norm(q(i,:)’-wD,2)^2+H^2; m(i)=norm(q(i,:)’-wE,2)^2+H^2; F(i)=gamma0*e(i)

*pu(i)/(log(2)*(m(i)+gamma0

*((e(i)+1)*

end

cvx_begin

variables L(num) M(num) T(num,2)

expression J(num)

for j=1:num

J(j)= pow_pos(norm(q(j,:),2),2)-2(q(j,:)’-wD)’*T(j,:)’-norm(wD,2)^2;

*m(i)+gamma0*pu(i)));end

cvx_begin

variables L(num) M(num) T(num,2)

expression J(num)

for j=1:num

J(j)= pow_pos(norm(q(j,:),2),2)-2

end

minimize(sum_func(c,F,pu,L,M,num))

subject to

L+J-H^2<=0;

for k=1:num

pow_pos(norm(T(k,:)’-wE,2),2)+H^2-M(k)<=0;

end

pow_pos(norm(T(1,:)’-[-100;100],2),2)<=2.25;

for k=1:num-1

pow_pos(norm(T(k+1,:)’-T(k,:)’,2),2)<=2.25;

end

T(num,:)==[500,100];

cvx_end

for i=1:num

for j=1:2

Q(i,j)=T(i,j);

end

end

end

function result=sum_func(c,F,pu,l,m,num)

gamma0=10e9;

result=0;

for i=1:num

result=result+F(i)*m(i)-log(1+c(i)-gamma0*(c(i)+1e-10)*(pu(i)+1e-10)*inv_pos(gamma0*pu(i)+l(i)));

end

The following is the test part, you can just run it.

clear all

N=410;

Q(1,:)=[-100,100];

for i=2:N

Q(i,:)=Q(i-1,:)+[600/(N-1),0];

end

pu=10*ones(N,1);
ps=1000*ones(N,1);

Q=subprob3(ps,pu,Q,N);