The error is in the line

`r'*exp(P'*tk)*(C*X+D*U)'*diag(1,0)*(C*X+D*U)*exp(P*tk)*r<=0.16;`

This is in violation of CXV’s DCP rules Why isn’t CVX accepting my model? READ THIS FIRST! . DCP rules do not allow this because it may be non-convex.

I don’t know what you are really trying to do, and whether that is convex. Therefore, I don’t know whether it can be written in a form which CVX will accept… Nevertheless, I will mark is as non-convex until such time as you show a convex model formulation.

Your code has some strange things, including:

The objective function evaluates to s scalar (it does not involve any CVX variables o expressions); therefore, your problem in effect has no objective function, i.e., is a feasibility problem.

The constraints inside the for loop do not involve the for loop index, `i,`

. Therefore, the exact same constraints are repeated each time through the loop, i.e., 101 times. Obviously, this is not what you want to do.

`diag(1,0)`

is the same as the scalar `1.`