This looks totally unrelated to your original question, because I don’t see `log`

, `exp`

, or any such function hidden behind the scenes with use of another function, such as `entr`

.

Your use of` pow_p`

seems rather strange, because the 2nd argument is `1`

, so your objective winds up being `sum(Plegit)`

Is that really what you want? Perhaps you intended the 2nd argument of `pow_p`

not be 1?

The bottom line is that you seem to have entered a Linear Programming problem, which CVX can handle, but I suspect is not the problem you want to solve.

Also, I don’t think

```
for i = 1:N
Plegit(i) =(1+ P(i)*h(i).^2*(d(i).^-alpha));
end
for i = 1:N
Peve(i) = (1+ P(i)*h(N+1).^2*(d(i).^-alpha));
end
```

will work correctly, These are expression assignments to elements of an array. You need to declare `Plegit`

and `Peve`

as expression arrays (holders) as described in http://cvxr.com/cvx/doc/basics.html#assignment-and-expression-holders ,

```
cvx_begin
variable P(1,N)
expression Plegit(N)
expression Peve(N)
for i = 1:N
Plegit(i) =(1+ P(i)*h(i).^2*(d(i).^-alpha));
end
for i = 1:N
Peve(i) = (1+ P(i)*h(N+1).^2*(d(i).^-alpha));
end
...
```

The objective function you say you want has `log2`

, which you have not used in your program. Also, I presume you intend to sum that over the `i`

You ought to be able to enter that objective function in CVX.

So, bottom line, you need to more clearly specify the optimization problem yiu are trying to solve, including how something involving `i`

gets converted into a scalar objective function, whether by summation over `i`

, o otherwise.