How can I express the square of Frobenius norm of a matrix in cvx?

Hi, all.
I want to express the square of Frobenius norm of a matrix in cvx. For example, when I want to slove the problem \mathop {\min }\limits_{\mathbf{A}} \;\left\| {{\mathbf{A}} - {\mathbf{B}}} \right\|_{\text{F}}^2 and I express it in matlab as

B = ones(2,2);
cvx_begin quiet
variable A(2,2)
minimize square(norm(A-B,‘fro’))

the cvx gives me an error as

Disciplined convex programming error:
Illegal operation: pow_abs( {convex}, {2} ).

Is there anything wrong with my expression? I really appreciate your help.

There are several options, including

  1. If there is no other term in the objective function, you might be content with
    i.e., not squaring. It will have the same argmin as if the objective function were squared.

  2. Use square_pos

  3. minimize(sum(sum_square(A-B)))

  4. If using CVX 3.0beta, you have the additional option of coding as you did, i.e.,

I suggest you read or re-read the CVX Users’ Guide , including the function reference section. and .

1 Like