clear
N=5;
N0=-33;
Ps=16;
Pd=10;
Ek=0;
sigma=0.5;
round=3.5;
dt=10;
ds=20;
w1=unifrnd(0,2*pi,N,1);
w2=unifrnd(0,2*pi,N,1);
w3=unifrnd(0,2*pi,N,1);
wdk1=unifrnd(0,2*pi,N,1);
%wdk2=unifrnd(0,2*pi,N,1);
%wdk3=unifrnd(0,2*pi,N,1);
w4=unifrnd(0,2*pi,1,1);
w5=unifrnd(0,2*pi,1,1);
wsk1=unifrnd(0,2*pi,1,1);
%wsk2=unifrnd(0,2*pi,1,1);
%wsk3=unifrnd(0,2*pi,1,1);
hdd=(dt)^(-0.5*round)*exp(i*w1);
hdc=(dt)^(-0.5*round)*exp(i*w2);
g=(dt)^(-0.5*round)*exp(i*w3);
hddk1=(dt)^(-0.5*round)*exp(i*wdk1);
%hddk2=(dt)^(-0.5*round)*exp(i*wdk2);
%hddk3=(dt)^(-0.5*round)*exp(i*wdk3);
hsc=(ds)^(-0.5*round)*exp(i*w4);
hsd=(ds)^(-0.5*round)*exp(i*w5);
hsdk1=(ds)^(-0.5*round)*exp(i*wsk1);
%hsdk2=(ds)^(-0.5*round)*exp(i*wsk2);
%hsdk3=(ds)^(-0.5*round)*exp(i*wsk3);
Hdd=hdd*hdd';
Hdc=hdc*hdc';
Hddk1=hddk1*hddk1';
%Hddk2=hddk2*hddk2';
%Hddk3=hddk3*hddk3';
E=eye(N);
gammadk=0;
gammadk1=(gammadk-Ps*(abs(hsdk1))^2/N0)*(Ps*(norm(g))^2+N0)/(Ps*(norm(g))^2-(gammadk-Ps*(abs(hsdk1))^2/N0)*N0);
j=0;
for gammac=0:20;
j=j+1;
gammac1(j)=(gammac-Ps*(abs(hsc))^2/N0)*(Ps*(norm(g))^2+N0)/(Ps*(norm(g))^2-(gammac-Ps*(abs(hsc))^2/N0)*N0);
%gammdk2=(gammadk-Ps*(abs(hsdk2))^2/N0)*(Ps*(norm(g))^2+N0)/(Ps*(norm(g))^2-(gammadk-Ps*(abs(hsdk2))^2/N0)*N0);
%gammdk3=(gammadk-Ps*(abs(hsdk3))^2/N0)*(Ps*(norm(g))^2+N0)/(Ps*(norm(g))^2-(gammadk-Ps*(abs(hsdk3))^2/N0)*N0);
cvx_begin
variable lambda
variable thetak1
%variable thetak2
%variable thetak3
variable delta
variable beita
variable roundk1
%variable roundk2
%variable roundk3
minimize lambda
subject to
-(Hdd-gammac1(j)*Hdc*beita+gammadk1*Hddk1*roundk1+Hddk1*thetak1-E*delta)==hermitian_semidefinite(N)
%-(Hdd-gammac1*Hdc*beita+gammadk1*Hddk1*roundk1+gammadk2*Hddk2*roundk2+gammadk3*Hddk3*roundk3+Hddk1*thetak1+Hddk2*thetak2+Hddk3*thetak3-E*delta)==hermitian_semidefinite(N)
-(-Hdd*lambda+Hdc*beita-Hddk1*roundk1+Hddk1*thetak1-E*delta)==hermitian_semidefinite(N)
%-(-Hdd*lambda+Hdc*beita-Hddk1*roundk1-Hddk2*roundk2-Hddk3*roundk3+Hddk1*thetak1+Hddk2*thetak2+Hddk3*thetak3-E*delta)==hermitian_semidefinite(N)
-(-N0*lambda-gammac1(j)*N0*beita+gammadk1*N0*roundk1-(Ek/sigma-Ps*(abs(hsdk1))^2)*thetak1-Pd*delta)>=0
%-(-N0*lambda-gammac1*N0*beita+gammadk1*N0*roundk1+gammadk2*N0*roundk2+gammadk3*N0*roundk3-(Ek/sigma-Ps*(abs(hsdk1))^2)*thetak1-(Ek/sigma-Ps*(abs(hsdk2))^2)*thetak2-(Ek/sigma-Ps*(abs(hsdk3))^2)*thetak3-Pd*delta)>=0
lambda>=0
roundk1>=0
%roundk2>=0
%roundk3>=0
thetak1>=0
%thetak2>=0
%thetak3>=0
delta>=0
beita>=0
cvx_end
opt_lambda(j)=lambda;
opt_roundk1(j)=roundk1;
opt_thetak1(j)=thetak1;
opt_delta(j)=delta;
opt_beita(j)=beita;
temp1=Hdd-gammac1(j)*Hdc*opt_beita(j)+gammadk1*Hddk1*opt_roundk1(j)+Hddk1*opt_thetak1(j)-E*opt_delta(j);
%A(gammac+1)=-(Hdd-gammac1*Hdc*beita+gammadk1*Hddk1*roundk1+gammadk2*Hddk2*roundk2+gammadk3*Hddk3*roundk3+Hddk1*thetak1+Hddk2*thetak2+Hddk3*thetak3-E*delta);
temp2=-Hdd*opt_lambda(j)+Hdc*opt_beita(j)-Hddk1*opt_roundk1(j)+Hddk1*opt_thetak1(j)-E*opt_delta(j);
%B(gammac+1)=-(-Hdd*lambda+Hdc*beita-Hddk1*roundk1-Hddk2*roundk2-Hddk3*roundk3+Hddk1*thetak1+Hddk2*thetak2+Hddk3*thetak3-E*delta);
A(1:N,5*(j-1)+1:5*j)=temp1;
B(1:N,5*(j-1)+1:5*j)=temp2;
D(1:N,5*(j-1)+1:5*j)=temp1-(1+opt_lambda(j))*Hdd;
C(1:N,5*(j-1)+1:5*j)=temp2-opt_beita(j)*Hdc;
end
%A(1:N,1:21*N)=0;
%B(1:N,1:21*N)=0;
%C(1:N,1:21*N)=0;
%D(1:N,1:21*N)=0;
%for j=1:21
%end
评论1