# Status: Unbounded

what’s reason about "Trivial infeasibilities detected; solution determined analytically.
Status: Unbounded
Optimal value (cvx_optval): +Inf "
thanks。

clc; clear all;
cvx_solver sdpt3
H=50; %% height
V=10; %% speed
noise_pw = 10^(-14); %% -170dBm/hz 1 MHz, noise power: -110dBm
reference = 10^(-6); %% channel power at reference distance
gamma=10^8;
ur0=[155;250]; %无人机R初始位置
urN=[155;-250];
uj0=[145;250]; %无人机J初始位置
ujN=[145;-250];

xs=[0;0]; %就是 S 的坐标
xe=[125;-50]; %窃听者 E 的坐标
xd=[300;0]; %就是 D 的坐标

N=61; % T=60s, dt=1s;
i=1:N;
Qr_r=zeros(2,N);
Qr_r=[ur0(1).ones(1,N);ur0(2)+(urN(2)-ur0(2))/(N-1).(i-1)]; %%无人机s初始轨迹

Qj_r=zeros(2,N);
Qj_r=[uj0(1).ones(1,N);uj0(2)+(ujN(2)-uj0(2))/(N-1).(i-1)]; %%无人机j初始轨迹

Ps=1;
avg_Pr=10^(1)/1000;
avg_Pj=10^(1)/1000; %%%%%平均功率

Pr_r=avg_Prones(1,N);
Pj_r=avg_Pj
ones(1,N);

Pr_max=4avg_Pr; %%%最大功率
Pj_max=4
avg_Pj;

dt=1; %每个时隙

BisecConvergenceThreshold = 10^(-4); %收敛阈值

figure
plot(ur0(1),ur0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(urN(1),urN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(uj0(1),uj0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(ujN(1),ujN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(xs(1),xs(2),‘ko-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xe(1),xe(2),‘ks-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xd(1),xd(2),‘kp-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
xlim([-50,350]);%对X轴设定显示范围
ylim([-300,300]);%对Y轴设定显示范围
hold on;
plot(Qr_r(1,1:2:N),Qr_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;
plot(Qj_r(1,1:2:N),Qj_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;
%Q_r=Qr_r;
%Qj_r=zeros(2,N);
for i=1:N
en(i) = gamma.*Pr_r(i)./(H^2+norm(Qr_r(:,i)-xe).^2);
cn(i) = gamma.*Pr_r(i)./(H^2+norm(Qr_r(:,i)-xd).^2);
S_r(i)=H^2+norm(Qj_r(:,i)-xd).^2;
V_r(i)=H^2+norm(Qj_r(:,i)-Qr_r(:,i)).^2;
%V_r(i)=H^2+pow_pos(norm(Qj_r(:,i)-Qr_r(:,i)),2);
b2(i)=gamma.*Pj_r(i);
% RD_r(i)=log(1+cn(i)-cn(i).*b2(i).inv_pos(S_r(:,i)+b2(i)));
RD_r(i)=log(1+cn(i)-cn(i).b2(i)./(H^2+norm(Qj_r(:,i)-xd).^2+b2(i)));
u_r(i)=H^2+norm(Qj_r(:,i)-xe).^2;
%L(i)=Ps
gamma./power(H^2+norm(Qr_r(:,i)-xs(:,1),2));
L(i)=Ps
gamma./(H^2+norm(Qr_r(:,i)-xs).^2);
end

for i1=1:10

cvx_begin
variable Qj(2,N)
variable S(1,N)
variable V(1,N)
variable u(1,N)
variable RD(1,N)

``````expression W_r(1,N)     %%不用这些表达式，直接写出来

expression Z_r(1,N)
%expression u_r(1,N)
%expression u(1,N)
``````

% expression L(1,N)
expression k(1,N)
expression rate1(1,N)

``````% for i=1:N

%u_r=H^2+norm(Qj(:,i)-xe);
%L(i)=Ps.*inv_pos(H^2+norm(Qr_r(:,i)-xs,2));
%u(i)=H^2+norm((Qj(:,i)-xe),2);
% u(i)=H^2+norm(Qj_r(:,i)-xe).^2;
%b2(i)=gamma.*Pj_r(i);
%end

for i=1:N
%W_r(i)=en(i).*gamma.*Pj_r(:,i).*inv_pos((u_r(i)+gamma.*Pj_r(:,i)).*((en(i)+1).*u_r(i)+gamma.*Pj_r(:,i)));
%W_r(i)=en(i).*gamma.*Pj_r(:,i)./((u_r(i)+gamma.*Pj_r(:,i))*((en(i)+1).*u_r(i)+gamma.*Pj_r(:,i)));
% W_r(i)=en(i).*b2(i).*inv_pos(b2(i) + u(:,i)).*inv_pos(b2(i)+(en(i)+1).*u(:,i));
W_r(i)=en(i).*b2(i)./(b2(i)+u_r(i))./(b2(i)+(en(i)+1).*u_r(i));
% RD(i)=log(1+cn(i)-cn(i).*b2(i).*inv_pos(S(i)+b2(i)));

end

%for i=1:N
%Z_r(i)=power(norm(Qj_r(:,i)),2)-2*(Qj_r(:,i)-Q_r(:,i))'*Qj(:,i)-power(norm(Q_r(:,i)),2);
%end
``````

% for i=1:N
% W_r(i)=-en(i).*b2(i).*inv_pos(b2(i)+u_r(:,i)).*inv_pos(b2(i)+(en(i)+1).*u_r(:,i));
% end
% for i=1:N
% rate1(i)=W_r(i).*u(:,i) + log(1+cn(i)-cn(i).*b2(i).*inv_pos(S(:,i)+b2(i)));
%
% end

`````` for i=1:N
rate1(i)=RD(i)-W_r(i).*(H^2+pow_pos(norm(Qj(:,i)-xe),2));   %%这里的u直接用表达式替代
end
maximize sum(rate1(1:N))
subject to

for i=1:N
pow_pos(norm(Qj(:,i)-xd(:,1)),2)+power(norm(Qj_r(:,i)),2)-2*(Qj_r(:,i)-xd(:,1))'*Qj(:,i)-power(norm(xd(:,1)),2)-H^2<=0;   %%17b
end

for i=1:N
H^2+pow_pos(norm(Qj(:,i)-Qr_r(:,i)),2)+power(norm(Qj_r(:,i)),2)-2*(Qj_r(:,i)-Qr_r(:,i))'*Qj(:,i)-power(norm(Qr_r(:,i)),2)-H^2<=0;   %17c有错   把 V换掉 H^2+pow_pos(norm(Qj_r(:,i)-Qr_r(:,i)),2);
end                                                      %Z_r也换掉

for i=1:N
H^2+pow_pos(norm(Qj(:,i)-xe),2)-u(i)<=0;  %%15c有错
``````

% H^2+pow_pos(norm(Qj(:,i)-xe),2)-(H^2+pow_pos(norm(Qj(:,i)-xe(:,1)),2))<=0;%15c有错 已修改，但是u(i)带进去一样
end

``````   for n=2:N
%sum(RD(:,2:n))-sum(log(1+L(:,1:n)-L(:,1:n).*b2(:,1:n).*inv_pos(b2(:,1:n)+(H^2+pow_pos(norm(Qj(:,1:n)-Qr_r(:,1:n)),2)))))<=0;   %%15e有错
%sum(RD(:,2:n))-sum(log(1+L(:,1:n)-L(:,1:n).*b2(:,1:n).*inv_pos(b2(:,1:n)+(H^2+norm(Qj(:,i)-Qr_r(:,i)).^2))))<=0;
sum(RD(:,2:n))-sum(log(1+L(:,1:n)-L(:,1:n).*b2(:,i).*inv_pos(b2(:,i)+V(:,1:n))))<=0;
end                                    %(H^2+pow_pos(norm(Qj(:,i)-Qr_r(:,1)),2))换掉v

for i=2:N
%RD(:,i)-log(1+L(:,i)-L(:,i).*b2(i).*inv_pos(b2(i)+(H^2+pow_pos(norm(Qj(:,i)-xd(:,1)),2))))<=0;   %%%15f有错
RD(:,i)-log(1+L(:,i)-L(:,i).*b2(i).*inv_pos(b2(i)+S(i)))<=0;
end                                          %(H^2+pow_pos(norm(Qj(:,i)-xd(:,1)),2))换掉s

for i=1:N-1  %%（4-1=3  四个位置，三段距离）
norm(Qj(:,i+1)-Qj(:,i)) <= V*40/N;
end
Qj(:,1) == uj0;
Qj(:,N) == ujN;
cvx_end

A1(i1)=cvx_optval;
Qj_r=Qj;
plot(Qj_r(1,:),Qj_r(2,:));
hold on;
``````

end

figure
plot(ur0(1),ur0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(urN(1),urN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(uj0(1),uj0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(ujN(1),ujN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(xs(1),xs(2),‘ko-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xe(1),xe(2),‘ks-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xd(1),xd(2),‘kp-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
xlim([-50,350]);%对X轴设定显示范围
ylim([-300,300]);%对Y轴设定显示范围
hold on;
plot(Qr_r(1,1:2:N),Qr_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;
plot(Qj_r(1,1:2:N),Qj_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;

I will assume for now that this question has been superseded by your most recent question Status: Inaccurate/Unbounded Optimal value (cvx_optval): +Inf .