How to write to find a non-zero solution x(n) in CVX

Hi,

If my optimization problem needs to find a non-zero vector solution x(n), how to write it in CVX? Thank you so much.

Best

For example, in the following problem, how to write z~=0?
image

You will have to pick a tolerance for what constitutes non-zero. Because the constraint is non-convex, you will need to introduce binary variables and use Big M.

YALMiP has a function, nnz https://yalmip.github.io/command/nnz/ . The web page https://yalmip.github.io/tutorial/logicprogramming/ shows the Big M formulation YALMIP uses to handle nnz. This formulation can also be used in CVX.