Hi, when I want to solve a convex problem with respective to F, which is as follows, how can I write all these sum terms into my code? can I use for loop in the objective function?
for loop can be used in the objective function and/or constraints
objective = 0
for i=1:N
objective = objective + ith_summand
end
minimize(objective)
Of course, nested for loops can also be used.
But next I get this error
The first line of Chinese says that I misused & and the operation number must be real number.
Based on the code extract in the image, I have no idea what is going on. You should examine each portion of the expression in the statement triggering the error message until you see where the difficulty is. I don’t even see where the code has &
If you assign numerical values to all the CVX variables, instead of declaring them as variables, your statements need to evaluate without triggering any MATLAB error message. That is necessary, but not sufficient, for the code to run in CVX. So get that working first.