My code is as follows:
cvx_begin
variable traj(para.T+1, 2)
variable u(1, para.T)
variable v(1, para.T)
variable t(1, para.T)
expression lower_bound(1, para.T)
expression D(1, para.T)
for ii=1:para.T
lower_bound(ii) = coe3(ii)*u(ii) + coe4(ii)*v(ii);
D(ii)=log2(1+gamma0*pow_abs(A.*inv_pos(t(ii).^(para.kappa_UG/2))+C.*inv_pos(v(ii)),2));
end
maximize(1/para.T*(sum((lower_bound)-D)))
subject to
80 <= u;
40 <= v;
80 <= t;
for jj=1:para.T
pow_pos(norm(traj(jj, :)-para.place_user(1:2)),2)+6400+u0(jj)^2-2*u0(jj)*u(jj)<=0;
pow_pos(norm(traj(jj, :)-para.place_IRS(1:2)),2)+1600+v0(jj)^2-2*v0(jj)*v(jj)<=0;
pow_pos(norm(traj(jj, :)-para.place_eve(1:2)),2)>=0;
end
for ii=1:para.T
pow_pos(norm(traj(ii+1,:)-traj(ii, :)),2)<=para.Vmax^2;
end
cvx_end
Unfortunately, every time I run this code, cvx gives me this type of error:
Error using cvx/pow_cvx (line 144)
Disciplined convex programming error: Illegal operation: pow_p( {convex}, {-1} )
Error in cvx/inv_pos (line 5)
y = pow_cvx( x, -1, ‘pow_p’ );
Error in opt_traj (line 47)
D(ii)=log2(1+gamma0*pow_abs(A.*inv_pos(t(ii).^(para.kappa_UG/2))+C.*inv_pos(v(ii)),2));
Maybe it is written in a manner that violates the CVX rules so that it is rejected. I have read the guide for this kind of Disciplined convex programming error but I’ve no idea how to rewrite the expression for D(ii). Any help from your guys would be appreciated.