How to convert a maximize function to a minimize function

I need to convert an objective function, Maximize log2(1+S/N)
to minimize - Log2(1+S/N)
-log(x)=1/log(x)

Hence, can it be Minimize [ log 1/(1+S/N) ].
Can the log be removed to incorporate it in CVX
Can the objective function be reduced to Minimize (1+S/N)^-1
Can a log function be directly given as an objective function in CVX?
eg:-Maximize log2(1+S/N)
How can it be framed as a CVX objective function

You haven’t said what the optimization variables are. My answer is predicated on the assumption that S is an optimization variable, and N is input data.

You can directly maximize that in CVX
maximize(log(1+S/N)/log(2))

If that is the only term in the objective function, you need not divide by log(2) and in fact, you need not have log at all, you can use 1+S/N, or even S/N,or even S`;

Thanks a lot for your valuable feedback.
Please find the CVX program that I modified based on your feedback.

In this optimization problem, I want to maximize [log2(1+ P(i)*h(i).^2*(d(i).^-alpha))]
subject to 4 constraints.Here h(i) and d(i) are unique to each user, i. and alpha ia a constant.Rs ,Rt and TP are also constants(but can be varied for different set of simulations.
Please comment on my code. Is it correct? Any modification required
I want to optimize the variable P(i)

cvx_begin 
variable P(1,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
maximize sum_power(Plegit)
% Trying to maximize sum rate taking path loss into account
subject to
    for i=1:N              
        P(i)>=0;
        sum(P)<=TP;%  total power constraint.
        Plegit(i)>=2.^Rt;%Data Rate Constraint        
        Plegit(i)>= Peve(i)*(2.^(2*Rs));%Secrecy Rate Constraint
    end
cvx_end
cvx_optval
P
function [ farg ] = sum_power(X)
farg = sum(pow_p(X,1));
end

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.