CVX for loop for differential equations

Looking around from previous forum posts its clear that CVX should not have any for loops within its cvx_begin and cvx_end lines.

However, for my model, I have a non-convex approximation of the motion of a rocket. This is subjected to non-conservative forces, meaning the values of the force, which is also a variable in the optimization process, varies based on the path taken. This also means there is no closed form solution, i.e. cannot be modeled analytically, but rather numerically.

Is this a possible exception to the use of for loops?

CVX can have for loops inside of cvx_begin to cvx_end. An objective function expression can be built up inside a for loop, and constraints may be specified inside for loops.

I do not understand what you are trying to do, and whether that is or is not possible. One other way for loops can be used is outside of CVX, i.e., with cvx_begin to cvx_end inside a for loop. So a separate CVX optimization problem is formulated and solved each time through the outer for loop. This can be used for a higher level non-convex optimization algorithm, such as Successive Convex Approximation (SCA).