Use cvx to solve convex problem

RSS is matrice,as is a vector,Why the solution turns out to be infeasible and wrob is a NaN vector,what’s the problem?

              variables wrob(n);
              variable u(1);
              subject to

What does the matrix Rss look like? Are you certain that it is positive definite?

If it weren’t positive definite, CVX would have rejected the problem.

Looks to me like you intended for wrob to be complex, but you did not declare it as complex. (Otherwise, why have imag(wrob'*as)==0?

What is your evidence that this is feasible?

Well, to be a stickler, CVX would have rejected the problem if RSS was not positive semi-definite.

Is it possible that the matrix is just barely positive semi-definite? Enough to not throw an error, but not enough to prevent numerical problems?

I’m not sure the solvers are sensitive in that manner.

Another error appeared every time I declare" variable wrob(n) complex;",it said “??? Error using ==> variable at 133
Index exceeds matrix dimensions.”

For n=10; “imag(wrob’as)==0" is for "u>=3norm(wrob)+1;”, or it may appear “complex> constant” as a error, right?

No because u is real. CVX assumes a variable is real until you tell it otherwise. You cannot force a variable to be complex by putting it an equality constraint; it will instead force the complex part to have a zero imaginary part.

As for the odd error message I suggest you submit a bug report to with a small snippet of code that reproduces the error,