Q=[
0 0.8797 0.9302 0.9628 0.8300 0.0000 0.0000 0.0000 0.0000 0.0000;
0.8797 0 0.9912 0.7415 0.8794 0.0000 0.0000 0.0000 0.0000 0.0000;
0.9302 0.9912 0 0.8132 0.9033 0.0000 0.0000 0.0000 0.0000 0.0000;
0.9628 0.7415 0.8132 0 0.7555 0.0000 0.0000 0.0000 0.0000 0.0000;
0.8300 0.8794 0.9033 0.7555 0 0.0000 0.0000 0.0000 0.0000 0.0000;
0.0000 0.0000 0.0000 0.0000 0.0000 0 0.8216 0.9995 0.8781 0.8874;
0.0000 0.0000 0.0000 0.0000 0.0000 0.8216 0 0.8365 0.8695 0.9543;
0.0000 0.0000 0.0000 0.0000 0.0000 0.9995 0.8365 0 0.8825 0.8965;
0.0000 0.0000 0.0000 0.0000 0.0000 0.8781 0.8695 0.8825 0 0.9754;
0.0000 0.0000 0.0000 0.0000 0.0000 0.8874 0.9543 0.8965 0.9754 0];
e=ones(n,1);
cvx_begin
variable x(n,1);
maximize(quad_form(x,Q) );
subject to
e'*x == 1;
x >= 0
x<=1
cvx_end
pstar = cvx_optval;
%/////////////
Error using cvx/quad_form (line 211)
The second argument must be positive or negative semidefinite.
%//////////
when I change it to maximize(-quad_form(x,Q) ); and the value of diagonal Q set to one ,it works but the result is wrong.
Can anyone help me???