# ? Error using ==> subsindex Function 'subsindex' is not defined for values of class 'cvx'

(alice lee) #1

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’.

(alice lee) #2

I changed the expression of the first constraint, and there is no error now~

(Neelu Gupta) #3

My question is regarding this topic sir, my constraint is

where phi{m} is a cell array of dual variable of size m, Gamma(m) , qm (m) are given array of size m
and Pi Pj are optimization parameters
my cvx code is as,
for m = 1:10
A = sum(-Gamma_m(1,m)+ qmx(1,m).*(Pi+Pj));
phi{m}: A<=0;
end

(Mark L. Stone) #4

Please show the completer code and error message.