this is my convex problem; and here is my code.

cvx_begin

variable x(S);

variable d(N);

expression Flow_of_Link(N,N);

expression sum(1);

```
maximize ((-1)*sum(pow_p(((Dist_SP_BA.^2).*(x(1:S))),(-1))))
subject to
sum(d(1:N)) == M
x(1:S) <= up_flow
x(1:S) >= lb_flow
d(1:N) >= lb_node
Flow_of_Node*x(1:S) <= d(1:N)
for m=1:N
for n=1:N
sum = 0
for i=1:S
if (Flow(i,4+m)==1 && Flow(i,4+n)==1 && T(m,n)==1)
sum = sum + x(i)
end
end
Flow_of_Link(m,n) = sum
Flow_of_Link(m,n) <= T(m,n)*(1+p)*(d(m,1)+d(n,1))
end
end
```

cvx_end

However, I get error

??? Error using ==> subsindex

Function ‘subsindex’ is not defined for values of class ‘cvx’.