Hi. i have problem in cvx.
it looks completely simple

m = 3; n = 3;
A = randn(m,n); b = randn(m,n);
cvx_begin
variable x(m,n)
r= A * x*x - b ;
minimize(norm( r,2 ))
cvx_end

Error using * (line 5)
Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX
.please say me what should i do with this error.

I suspect you want r= A * x - b ;
for some conformal (compatible) dimensions of A,x,b.

If x and b are vectors, then minimize(norm( r,2 )) can be used. However, if x and b are matrices, then I suspect what you want is minimize(norm( r,'fro' )), which is very different than the matrix 2-norm which would be specified by minimize(norm( r,2 )) .

But it’s your problem, so I can’t say for sure what you really want. Note that your code x*x is conformal only when m = n, as it happens to be with your sample input data.

Thank you so much for your help but I cannot solve this problem, the main question is that I could not use expression x^2 in CVX
I wanted minimize Ax^2-b in previous part
But when I use x^2 DSP appears
How I could minimize expression Ax^2-b where A and b are matrixes

Or if you really do want x'*x, do as @Milad_A suggested, and declare y as a semidefinite (square) variable instead of declaring xas a variable, then after cvx_end, use the command x = chol(y) to find x. Or if you want x*x, do the same, except x = sqrtm(y).

It seems unlikely to me that you really want this.

I am really appreciate of your help ,sqrtm(x) is helpful but if I want use some expression in CVX like x^n or exp(x) where x is matrixes, what must I do because dcp error appears again
Also when objective is “x”
When I multiple another definite matrix like r*x, dcp error appears again
Please give me help
Tnx

It is possible CXVQUAD (add-on to CVX) has some additional matrix level functions which might be of interest to you. https://github.com/hfawzi/cvxquad But that is not likely to work out well unless you really understand what these functions mean mathematically.