The optimization problem is described below:
1:=================================================================
2:=================================================================
3:=================================================================
4:=================================================================
I wrote the following code, but it doesn’t seem to be correct. I hope someone can help me, I will be very grateful!
clc,clear;
%%========================Initialization parameter
T=400;%Total flight duration
N=T/0.5;%The flight time slot
D=3*0.5;%Maximum flight distance
H=100;%altitude
P=-5;%The initial power
Ppeak=4*P;%Maximum power value
r0=80;%SNR
Lambda=100;%A coefficient in a power expression
v=10^(-4);%The convergence accuracy
%++++++Initializes the coordinate value
xf=100;%UAV terminal coordinates
yf=-600;
x0=100;%UAV origin coordinates
y0=600;
xe=200;%Eavesdropper coordinates
ye=0;
xg=0;%Legitimate coordinates
yg=0;
%++++++Initialization variable
xfea=100;
yfea=600;
ufea=580000;
%%======================Use the CVX toolbox to find x, y
for k=1:N
cvx_begin
variables x(1,N) y(1,N) u(1,N) t(1,N);
%++++++Compute the concave function f
f=0;
for i=1:N
g=-P*u(1,i)/(log(2)*(ufea^2+P*ufea));
h=-(rel_entr(t(1,i),t(1,i)+P)+rel_entr(t(1,i)+P,t(1,i)))/log(2);
f=g+h+f;
end
maximize(f);
subject to
%+++++++C1
for n=1:N
t(1,n)+xfea^2-2*xfea*x(1,n)+2*xe*x(1,n)-xe^2+yfea^2-2*yfea*y(1,n) ...
+2*ye*y(1,n)-ye^2-H^2<=0;
end
%++++++++C2
(x(1,1)-x0)^2+(y(1,1)-y0)^2<=D^2;
for m=1:N-1
(x(1,m+1)-x(1,m))^2+(y(1,m+1)-y(1,m))^2<=D^2;
end
(xf-x(1,N))^2+(yf-y(1,N))^2<=D^2;
%++++++++C3
for n=1:N
x(1,n)^2-2*xg*x(1,n)+xg^2+y(1,n)^2-2*yg*y(1,n)+yg^2+H^2-u(1,n)<=0;
%++++++++C4
t(1,n)>=H^2;
end
cvx_end
fprintf('%f %f %f %f\n',x(1,k),y(1,k),u(1,k),t(1,k));
xfea=x(1,k);
yfea=y(1,k);
ufea=u(1,k);
end
It keeps displaying the following information after running. I don’t know why