where x is a matrix variable and y is a scaler variable. I have a doubt about how to implement the above summation in CVX. Based on your previous answers, the guide, and MATLAB, I tried to do the following in CVX
As you can see, I introduced a new variable, s, to represent the summation. I have a doubt about the introduction of the variable s. Please, will s properly hold the summation? Or, is there a better way of doing this? How should it be if y was a scaler constant instead of a variable?
Don’t declare s as a variable,. Let is be an expression, which doesn’t have to be declared.
I don’t think it’s necessary, but it won’t hurt to start with s = 0
prior to a for loop.
Then have inside the for loop s = s + <ith term to be added>
which is an expression assignment, not a constraint.
Do not use >= as you have.
You may also find norms to be convenient.for some of your problems.
Thanks a lot for your guidance. I have used the following based on your advice:
Just verifying, I noticed in the guide that expressions are usually addressed with index (e.g. i) inside the loop, so is it still ok not to index the expression s here? Also, if y is a constant, does the constraint s<=y still hold here?