Please help me to fix the CVX error. I am maximizing a provably concave function below.
n_dash, M, and Nf are integers. q_i is a row of size 1Nf and the decision vector is a vector x of size Nf1.

Consider the simple case, with x a scalar: objective = x + x*(1-x)*exp(-x)
Its second derivative is negative for x < 1 and positive for x > 1. The switchover point is different if n_dash is a number other than 1. For instance, if n_dash = 2, objective is convex for x >= 0.634. .Regardless of what positive value is used for n_dash, the function is not concave for all of 0 <= x <= 1.

Thanks Ms Mark for your reply. If x either as scalar or vector is between 0 and 1. And for some values of n_dasy, the second derivative is negative. Can I solve this problem as a concave problem for this specific parameters or assumptions?

Doubtful. But please provide a complete reproducible example, i.e., with all input values, of the problem you want to solve, even though the code will not be accepted by CVX. It would be preferable for you to show the simplest, lowest dimension (one, if possible) problem of any interest to you - that will make things easier to analyze. And please provide the proof of concavity of the objective function for the problem instance you provide.

Can you please show this as a complete MATLAB/CVX code, even though CVX will not accept it?

As for concavity (which need to be joint concavity) proof by 2nd derivatives, you need to show that the Hessian is negative semidefinite over the constraint region. It is not sufficient to show that partial derivatives are non-positive.

%Calculating Zipf’s distribution
q_i = zeros(1,Nf);
for i=1:Nf
num = (i)^(-beta) ;
den = 0;
for j = 1:Nf
den = den + j^-(beta);
end
q_i(1,i) = num / den; % 1XNf row
end

Thanks. Now I got it. My question is as you said earlier it is a partial derivative that you disproved its concavity. As we deal with the function of x as a vector, i.e., x(Nf). Can it still be concave, especially, when we consider the following:

Summation over x == M. If for instance x(1) and/or x(2) have their values making the second derivative positive, others x’s. i.e., x(3:Nf) are expected to be much smaller since the constraint (Summation over x == M) . How can I approve or disapprove the joint concavity?

Presuming existence of the 2nd partial derivatives, It is necessary, but not sufficient for joint concavity that all 2nd partial derivatives be <= 0. As I wrote previously, also presuming existence of the 2nd partial derivatives, negative semidefiniteness of the Hessian is sufficient to prove joint concavity.