# Disciplined convex programming error: Matrix powers not permitted

(李忘言) #1

Dear Friends, I’m trying to solve a minimization problem by using CVX, here is my problem:

Assume we have an unknown Q with parameter q1, q2, q3, q4, and a given matrix G, that is,
Q=\bigl(\begin{smallmatrix} q1&q2 \\ q3&q4 \end{smallmatrix} \bigr), G=\bigl(\begin{smallmatrix} 0.4&0.6 \\ 0.4&0.6 \end{smallmatrix} \bigr),

The problem is how to find the values of q1, q2, q3, q4, such that the square of Q is very close to matrix G. I choose to minimize the Frobenius norm of their difference, that is,

minimize \| Q^2-G\|_F
s.t. 0\leq q1\leq 1, 0\leq q2\leq 1, 0\leq q3\leq 1, 0\leq q4\leq 1.

The following are my codes:

G=[0.4 0.6; 0.4 0.6];
cvx_begin  quiet
variables  q1 q2 q3 q4
minimize( norm([q1 q2;q3 q4]^2-G, 'fro') )
subject to
0 <= q1 <= 1;
0 <= q2 <= 1;
0 <= q3 <= 1;
0 <= q4 <= 1;
q1+q2==1;
q3+q4==1
cvx_end

q1
q2
q3
q4


But, the output is an error which reads

Error using  ^  (line 11)
Disciplined convex programming error:
Matrix powers not permitted.
Error in sub_optimal (line 6)
minimize( norm([q1 q2;q3 q4]^2-G, 'fro') )


How could I circumvent this problem? Thanks

Is there any cvx function to express a matrix as a constraint?
(Michael C. Grant) #2