|
- function [subgradient_elipsoid,x_optimal,y_optimal,H_optimal,Rate,Rate_max]=dualfunction_PM(x_k,y_k,K,T,lamb,P,sigma)
-
-
- x_k_origin=x_k;%save orgin x_k location set
-
- %obtain lamda according to user locations decent
- L=length(lamb);
- for i=1:L-1
- for j=i+1:L
- if lamb(i)<lamb(j)
- temp=lamb(j);
- lamb(j)=lamb(i);
- lamb(i)=temp;
- tempx=x_k(j);
- x_k(j)=x_k(i);
- x_k(i)=tempx;
- tempy=y_k(j);
- y_k(j)=y_k(i);
- y_k(i)=tempy;
- end
- end
- end
-
- lambda=lamb(1:K);
- beta_0=1e-3;
- lamb(K+1)=0;%notational convenience
- r=zeros(K,1);
- SNR_k=zeros(K,1);
- h_k=zeros(K,1);
- Rate=[];
- H=200;
-
- index_x=0;
- for x=1:8000
- index_x=index_x+1;
- x_U=0.1*x;
- for k=1:K
- h_k(k)=beta_0/((x_k(k)-x_U)^2+(y_k(k))^2+H^2);
- end
- %objective function
- for k=1:K
- snr_k_i=zeros(k,1);
- for i=1:k
- snr_k_i(i)=(P*h_k(i))/(sigma^2);
- end
- SNR_k(k)=sum(snr_k_i);
- r(k)=(lamb(k)-lamb(k+1))/(T)*(T*log2(1+SNR_k(k)));
- end
- Rate(index_x)=sum(r);%sum rate throughput under given xyH
- end
-
-
-
- Rate_max=max(Rate(:));
- [x_maxindex]=find(Rate==Rate_max);
- x_max=(x_maxindex(1))*0.1;
-
- %obtain the channel gain under optimal hovering location
- h_kmax=zeros(K,1);
- for k=1:K
- h_kmax(k)=beta_0/((x_k(k)-x_max)^2+(y_k(k))^2+H^2);
- end
-
- %obtain subgradient
- subgradient=zeros(K,1);
- subgradient(1)=log2((sigma^2+P*h_kmax(1))/(sigma^2));
- for k=2:K
- ph_numerator=zeros(k,1);
- for i=1:k
- ph_numerator(i)=P*h_kmax(i);
- end
- ph_denominator=zeros(k-1,1);
- for j=1:k-1
- ph_denominator(j)=P*h_kmax(j);
- end
- subgradient(k)=log2((sigma^2+sum(ph_numerator))/(sigma^2+sum(ph_denominator)));
- end
-
- user_number=length(x_k);
- user_index=zeros(user_number);
- subgradient_elipsoid=zeros(user_number,1);
- for n=1:user_number
- [user_index(n)]=find(x_k==x_k_origin(n));
- end
- for n=1:user_number
- subgradient_elipsoid(n)=subgradient(user_index(n));
- end
-
- x_optimal=x_max;
- y_optimal=0;
- H_optimal=H;
-
-
|