# How to write the objective function in Matlab?

First time use CVX.Find it hard to write the objective function in Matlab.Too many errors made me worried.Is there any way to write it with no errors?In the function, L is constant, you can set it as 30.While Xi is variable, so there are 30 variables.

For L = 2, that is neither convex not concave, even if the x_i's are restricted to be nonnegative.

The objective function can be written in “MATLAB” (for example, using YALMIP)., but can’t be written in CVX.

Yes, one of the constraints is Xi’s are all nonnegative.So this is a nonconvex problem?Can YALMIP solve this kind of problem?By the way, thank you for your reply and suggestion.

Is is neither convex nor concave, even if all the variables are nonnegative.

The objective function can be entered in CVX (and presuming the constraints also can be), either a local optimization solver, such as FMINCON can be used, or a global optimization solver, such as BARON or YALMIP’s own solver, BMIBNB can be used to attempt to solve to global optimality. I don’t know how difficult this problem will be to solve to global optimality to a small optimality gap tolerance using a global optimization solver when L = 30 (the constraints may also matter).

Got it, thanks a lot for your help.