# Error of {convex}-{convex}

my error:
Disciplined convex programming error:
Illegal operation: {convex} - {convex}
the code:

for n=1:N
for k=1:K
0<=y(k)<=2*x(n,k)*x(k)-x(n,k)^2 %%%Taylor series’s approximation
end
end

``````     It is part of constraints in minimization of objective function
n: No of iteration
``````

I read the " Why doesn’t CVX accept my model" and “DCP rules” but I couldn’t figure out sth.
I had searched the Forum Topics as well.

What does this mean in your code? Can you explain why this is convex?

Actually the nonconvex constraint is y(k)<=u(k)v(k) and we defined a variable x as an additional such as y(k)<=x(k)^2 (a) and x(k)^2<=u(k)v(k) (b),
the y(k)<=x(k)^2 is approximated by second order of Taylor Series then
y(k)<=x(n,k)^2+ 2
x(n,k)(x(k)-x(n,k))
eventually it is y(k)<=2
x(n,k)*x(k)-x(n,k)^2 approximated with N iteration in loop of ‘for n=1:N’
by (a) x(k) approximated and then used in (b)

x(n,k) is a known scalar, but x(k) is a variable? I don’t know how it works. If you doing sucessive convex appoximation, you can put the n-loop outside cvx lines rather than inside. use `square(x)` instead of `x^2` if x is a variable. These might help.

The loop " for k=1:K " is inside of CVX but the loop " for n=1:N " is outside of CVX and the x(k) is changing in any step of k
Yes, that is sucessive because of x(n,k) in any n the amount of x(n,k) is changing in any step of n