We don’t offer general modeling assistance here. That’s what the reference manual and example library is for. If you start making progress entering your model into CVX and you have specific usage questions, you’re welcome to ask them. This is not specific enough.

However, I doubt your model is even convex. Have you proven it? Please read the FAQ.

F(x) certainly looks concave over most values. However, I believe it is not everywhere concave.

Presuming this formula for m is correct (I leave you to proofread), m := 2*x*sqrt(n^2+2*n*(r*C-x)+(r*C+x)^2)/(n^2+x*(r*C+x-sqrt((n+r*C)^2-2*x*(n-r*C)+x^2))+n*(r*C-2*x+sqrt((n+r*C)^2-2*x*(n-r*C)+x^2)));

Then at r = 0.1, n = 1, z = 200, C =-50, x = -51, at which point m = -0.98091249, the 2nd derivative of F = 0.0003714, i.e., convex at that point. This is as computed by MAPLE, using 100 digit floating point arithmetic to evaluate the symbolically calculated derivative, so the sign of the result should be correct.

Thank you very much for your kind cooperation. In fact, I believe m is correct. If we assume the scenario under interest in my case, r=0.1, n=10, z=100, and C integer e.g. (10 to 50), so that means the function is convex. x should be also positive since it depends on C. x \leq C. I hope this may help. Really appreciate your help.

At those parameter values and C = 30, F(x) is convex at x = 10 and concave at x = 30.

So CVX is out for your problem. You may need to use a non-convex optimization solver, of which there are several, of both the local and global variety.