Simple disciplined convex programming error

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.

Maybe you should solve it for r= Ay-b with symmetric positive definite y, and then use Cholesky factorization y=x’*x.

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 A
x^2-b where A and b are matrixes

You can’t do that in CVX. But do you really want to? Look again at my suggestion.

And of course, the objective function must evaluate to a scalar, so presumably you mean to apply a norm to that.

Are you confusing wanting a least squares solution with forming x*x (which you would never do in linear least squares)?

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

The first thing you must do is learn something about convex optimization.

Carefully read Why isn't CVX accepting my model? READ THIS FIRST!

Then perhaps the first 5 or so chapters of https://web.stanford.edu/~boyd/cvxbook/

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.