# Is there a way to formulate this constraint in a different way?

(Dipak Narayanan) #1

The following piece of code lies between cvx_begin and cvx_end

`````` for m=1:M
N = find(1:M ~=n);
intf = [1;diag(((reshape(H(:,N),T,[])).')*(W(:,N)))];
G(iUser)=abs(H(:,m).'*W(:,m))^2/((norm(intf))^2);
end
``````

I am getting the following error:

Error using cvx/pow_cvx (line 142)
Disciplined convex programming error:
Illegal operation: {convex} .^ {2}
(Consider POW_P, POW_POS, or POW_ABS instead.)

Can I write it differently?

(Mark L. Stone) #2

help square_pois

— help for square_pos —

square_pos Square of positive part.
square_pos(X) is the square of the postive parts of the elements of X;
i.e., square_pos(X)=MAX(X,0).^2. X must be real.

``````Disciplined convex programming information:
square_pos(X) is convex and nondecreasing in X. Thus when used in
CVX expressions, X must be convex (or affine).``````

(Dipak Narayanan) #3
`````` for m=1:M
N = find(1:M ~=n);
intf = [1;diag(((reshape(H(:,N),T,[])).')*(W(:,N)))];
G(iUser)=abs(H(:,m).'*W(:,m))^2/(square_pos(intf));
end
``````

gives me the same error.

(Mark L. Stone) #4

I meant that `square_pos` should be applied to `abs(H(:,m).'*W(:,m))`.

If `intf` is not a CVX expression, then you can use `^2` and don’t need to bother with `square_pos`. if `intf` is a CVX expression, then `G(iUser)` is non-convex and is not allowed by CVX