How to deal with this SDP by CVX

First, the optimization variable is X, defining x=X*X’, matrix B, C1 and C2.Next,my code is as follows:

%----------------Parameter---------------

ZT = [13516 0.079 0.079 0.079;...
      0.079 13516 0.0152 0.0152;...
      0.079 0.0152 13516 0.0152;...
      0.079 0.0152 0.0152 13516];
ZR = [6402.3 0.0179;...
      0.0179 6402.3];
M = [-0.2527 0.0105 0.0046 0.0066;...
     -0.2527 0.0046 0.0105 0.0066];
Rm1 = [56 0;0 0]; 
Rm2 = [0 0;0 56]; 

w = 6.78*2*pi*10^6;
B = ZT+(w^2)*M.'*(ZR^-1)*M;
C1 = ((ZR^-1)*M)'*Rm1*(ZR^-1)*M;
C2 = ((ZR^-1)*M)'*Rm2*(ZR^-1)*M;
beta = linspace(0,80,9);

n = 4;
num = 2;
%----------------CVX-------------------
for k = 1:length(beta)
    cvx_begin sdp
        variables x(n)
        X = x*x';
        minimize( 0.5*trace(B*X) ) 
        subject to
            X == semidefinite(n);
            trace(C1*X)>=(2*beta(k))/w^2;
            trace(C2*X)>=(2*beta(k))/w^2;
    cvx_end
    obj1(k) = cvx_optval;
    obj2(k) = (num*beta(k))/cvx_optval;
end

so CVX does not support x*x’,error reporting.Is there any good way to solve it?

Are you trying to explicitly force X to be rank one? if so, that is a non-convex constraint.

A semidefinite relaxation would be
variable X(n,n) semidefinite

instead of

variables x(n)
 X = x*x';

But unless there are some specific properties in play here, this will not guarantee that the optimal X is rank one.

I am not saying this what you should do. I am not saying, what, if anything, is a good way to solve this.

thanks Mark.
In fact, I need to get a lowercase x instead of a semi-positive matrix X.This is why I will write like this,

variables x(n)
X = x*x’;

As you said, this will result in a non-convex condition with a rank of 1.
Actually, the original problem of the problem is a non-convex QCQP.Convert to a SDP problem with rank 1 by defining X=x*x’.Then semi-positive relaxation, remove the rank of 1,becoming a convex SDP.

So, can I really only get matrix X? Thank you for your reply!

You can do
[X x;x' 1] == semidefinite(n+1)
which by Schur Complement is equivalent to X \succeq x*x'

But because you are not otherwise using x in your formulation, I don’t believe this formulation accomplishes anything different than the formulation I provided in my previous post, which is why I didn’t mention it in that post.

Thank you again for your help.

Convert X = xx’ to X ⪰ xx’ by convex relaxation,

cvx_begin sdp
    variable x(n)
    variable X(n,n) symmetric
    minimize( 0.5*trace(B*X) ) 
    subject to
        [X x;x' 1] == semidefinite(n+1);
        trace(C1*X)>=(2*beta(k))/w^2;
        trace(C2*X)>=(2*beta(k))/w^2;
cvx_end

The final matrix X, whose rank is not 1,but full rank.
What I know is that only when the rank of matrix X is 1, there is X=x*x’, and x is the optimal solution of the original problem.

so,as you say, i’m not otherwise using x in my formulation.Is this the reason why my problem solving failed?
But when I assume a linear item, add and do this.

q = randn(n,1,3)
minimize( 0.5trace(BX)+q(:,:,1)'x )
subject to
[X x;x’ 1] == semidefinite(n+1);
trace(C1
X)+q(:,:,2)'x>=(2beta(k))/w^2;
trace(C2*X)+q(:,:,3)'x>=(2beta(k))/w^2;

Finally failed.

As I wrote above

But unless there are some specific properties in play here, this will not guarantee that the optimal X is rank one.

I don’t believe this formulation accomplishes anything different than the formulation I provided in my previous post

I don;t know whether there is some better convex relaxation or formulation. .But another option is to use a non-convex solver which can directly handle x*x'; this can not be done via CVX.