I’m trying to solve a problem by a special convex function define by myself.

The following is my code

cvx_begin

variable A(n,m)

minimize (trace(Y_2*(Y_2)’*A’*inv(M)*A))

subject to

for r=1:1:N

abs(A(r,r))==1;

end

But it pop up this error massage:

Only scalar quadratic forms can be specified in CVX

I can’t find out why, please help me.

Your objective function needs to evaluate to a real scalar. It appears to evaluate to a matrix, not a scalar.

Once you have an objective function which evaluate to a scalar, then it needs to be convex, and to be formulated in compliance with CVX’s DCP rules.

evaluate to a real scalar?

please help me

Given numerical values for all variables, if the objective function evaluates to 5, that is an example of a real scalar. if it evaluates to [8 2;2 1], which is a matrix, that is not a real scalar.

what should be done in this case?. I’m having a similar problem. how do solve my feasibility problem if my quadratic term is not scalar?

@Meghna_Singh if the above discussion does not adequately address your matter, you need to provide more information on your problem.

Perhaps you have specified this problem at How do I write this LMI constraint in cvx format? ? Or do you have another problem?