Thank you for your reply.
My program are as follows:
detaT=0.5; % interval of time
T=60; % total time
NNN=T/detaT; %number of intervals
Vmax=50; %the max velocity of UAV
Vmin=14; %the min velocity of UAV
cvx_begin
expression B;
variable qn(2,NNN);
variable vn(2,NNN);
variable an(2,NNN);
for j=1:NNN
ee(j)=pow_pos(norm(vn(:,j)),3);
ee2(j)=sum_square_abs(an(:,j))/g^(2);
B=B+ee(j)+ee2(j);
end
maximize(B);
subject to
for t=1:NNN
if(t==1)
(qn(1,1)-x0)^(2)+(qn(2,1)-y0)^(2)<=(VmaxdetaT)^(2);
qn(:,t)=[x0;y0];
vn(:,t)=[0;30];
else
(qn(1,t)-qn(1,t-1))^(2)+(qn(2,t)-qn(2,t-1))^(2)<=(VmaxdetaT)^(2);
qn(:,t)=qn(:,t-1)+vn(:,t-1)detaT+0.5an(:,t-1)*power(detaT,2);
vn(:,t)=vn(:,t-1)+an(:,t-1)*detaT;
end
end
cvx_end
When the program run to cvx_end, it shows the error. Actually, i used ‘expression’ instead of ‘variable’ to allow the coordinate and velocity be assigned. Then the program ran out without error but with a NaN or -Inf results.
In my question, i need obtain a optimal location and velocity. In my opinion, location and velocity can’t be declared as expression, they must be variables.
Hope you can answer my doubts.