In my optimization problem I have two variables which are vectors x and y both have length N (N has a high value). My constraint is such that x(1)<=y(1), x(1)+x(2)<=y(1)+y(2), and so on. I do not know how to write this constraint in the CVX. Help needed

# How to write this kind of constraint in cvx

**Mark_L_Stone**(Mark L. Stone) #2

Maybe there is a better way, but this should work:

```
for i = 1:N
sum(x(1:i)) <= sum(y(1:i))
end
```