I’m trying to do an optimization where my original problem contained a Heaviside step function, u(x) = 0 (x<=0); 1 (x>0). It’s easy to write a MATLAB function for u(x), but in its simplest form it doesn’t conform to DCP rules. So, I rewrote an approximation to u(x) which I thought conformed to DCP rules, but I still get an error. My approximation is actually for u(x-xth) with x, xth > 0:

```
function u = ua( x, xth )
N = 100;
u = pow_p( x ./ xth, -N );
u = pow_p( 1 + u, -1 );
return;
end
```

However, CVX issues the following error message:

```
Error using cvx/pow_cvx (line 144)
Disciplined convex programming error:
Illegal operation: pow_p( {convex}, {-100} )
```

The CVX documentation for `pow_p(x,p)`

seems to clearly allow for p < 0 and x real.

Here is the use in context:

```
cvx_begin
variable W( N, P ) complex;
variable err( P, 1 );
for p = 1 : P
err(p) = max( abs( ( Phi{p} * W(:,p) - vF{p} ) ./ d ) );
end; % for p ...
minimize sum( ua( sum( ua( abs(W), Wmin ), 2 ), 0.5 ) );
subject to
max( abs( W(:) ) ) <= Wmax;
max( err ) <= err_thr;
cvx_end;
```

N, P, Wmin, Wmax, and err_thr are scalar constants; Phi and vF are cell arrays of complex constants; d is an array of complex constants.