How to epress the square of norm?

x, y are two optimization variables in cvx, and each of them is a vector. a, b are two given scalars. one constraint includes (x-a).^2+(y-b).^2. how can I express this constraint in cvx?

square_pos(norm([x-a;y-b]))

However, if you want norm^2 <= constant, it is better to use norm([x-a;y-b]) <= sqrt(constant)

okay, thank you! and I wonder if there is a function in cvx or matlab that returns the max value of 0 or itself. for example, f(-1)=0, f(2)=2

CVX has a function pos(x)

I recommend you re-read the CVX User’s Guide, as it is listed there http://cvxr.com/cvx/doc/funcref.html#new-functions

help pos

pos Positive part.
pos(X) = MAX(X,0). X must be real.

 Disciplined convex programming information:
     pos(X) is convex and nondecreasing in X. Thus when used in CVX
     expressions, X must be convex (or affine).

Or you can just use max(x,0)

thank you!i will try max().