Hi! i have a problem of how to edit the equation by CVX.

.

where c is the speed of light and f0=700 MHz is the center frequency

of the carrier signal

where N_F=6; K=6; N=24;r[n] is the transmit node location,

```
for n=1:1:N
q1x(n,1)=-600+1193.5*(cos((2*pi*(n-1)*delta_t)/(T-delta_t)));
q1y(n,1)=233+1193.5*(sin((2*pi*(n-1)*delta_t)/(T-delta_t)));
end
r_k denote the receiver node location,
k1=[-1100,600,0];
k2=[-700,-600,0];
k3=[-400,400,0];
k4=[200,200,0];
k5=[600,1200,0];
k6=[800,-400,0];
w=[k1;k2;k3;k4;k5;k6];
H_i_k[n]=beta/delta;
p_i[n] exression the transmission power from the transmit node,
delta= 1.0000e-11;H=100;beta=0.001;p=0.1,B=5e+6;
R_req set as follow
R_1=2e+7*ones(N,1);
R_2=3e+7*ones(N,1);
R_3=4e+7*ones(N,1);
R_4=2e+7*ones(N,1);
R_5=3e+7*ones(N,1);
R_6=2e+7*ones(N,1);
R_req=[R_1,R_2,R_3,R_4,R_5,R_6];
```

Note: The variate is s_i_k_n.

What is your difficulty? If `s_i_k_n`

. is the only optimization (decision) variable, and all other symbols are input data, then C12 and C14 are affine (linear) inequalities. So it’s really a matter of correctly indexing in MATLAB relative to however you are storing the data.

thankyou reply, Mark. My problem is C14. I don,t know how to edit it by CVX. this inequality holds for any i,n,k .

You can use sum to sum over the dimension you want and write am element-wise vector or matrix inequality . In the worst case, you can always specify constraints inside for loops, but it might take longer for CVX to build the model to send to the solver.

You basically just need to follow MATLAB’s rules for indexing, sun, for loops, etc., and the same rules will apply to CVX.

Thankyou! Mark. Now, i have two code for C12,C13, C14, the one is,

M1=4e+7;

M2=Bt*log(1+(p*beta)/(H^2*delta));*

cvx_begin

cvx_solver mosek

variable s(N,K) binary;

for n=1:1:N

for k=1:1:K

R_req(n,k)-RR(n,k)<=M1(1-s(n,k))-1;

RR(n,k)-R_req(n,k)<=M2*s(n,k);*

end

end

x1=sum(s,2);

for n=1:1:N

x1(n,:)<=1;

end

where the RR_n_k caculate as follow

for n=1:1:N

for k=1:1:K

gamma(n,k)=(pbeta)/(((norm(q1(n,:)-w(k,:)))^2)*delta);*

end

end

for n=1:1:N

for k=1:1:K

RR(n,k)=Btlog(1+gamma(n,k));

end

end

when I use thist method to calculate , i can obtain the sub-optimail value. But the second sub-optimal problem have error when i use a(n,k) as input.

Here, i have another method to obtain s(n,k) as follow

cvx_begin

variable s(N,K);

dual variable tt

for n=1:1:N

for k=1:1:K

FF(n,k)=s(n,k)*RR(n,k)

end

end

tt:FF>=R_req;

for n=1:1:N

for k=1:1:K

0<=s(n,k)<=1

end

end

x1=sum(s,2);

for n=1:1:N

x1(n,:)<=1;

end

Using this method, I can’t obtain optimal solution, because the constraint

for n=1:1:N

for k=1:1:K

FF(n,k)=s(n,k)*RR(n,k)

end

end

tt:FF>=R_req;

cannnot satisfy. How can i do.

The complete code i have put inhttp://ask.cvxr.com/t/how-to-edit-the-following-expression-in-cvx/6075/7?u=huzhenzhen2018

Are you saying your model is infeasible? Please read https://yalmip.github.io/debugginginfeasible/ .