function[U,V,T,x,B,W1,W2]=CVX_solver_P2(v,t,a,g,gama2,H1,H2)

cvx_begin sdp

variable W1(N,N)

variable W2(N,N)

variable U

variable V

variable x nonnegative

variable B nonnegative

maximize(U)

subject to

2*v*V-square(v) >=U;

2*t*T-square(t) >= gama2-x;

square(a*x)+square(trace(H2*W1)*inv_pos(a)) <= 2*trace(H2*W2)-2*x;

0<= trace(W1+W2) <=1;

W1==semidefinite(N);

W2==semidefinite(N);

0<=B<=1;

trace(H1*W1)-gama2*trace(H1*W1)>= gama2*inv_pos(1-B);

[1-B V;V trace(H1*W1)]==semidefinite(2);

[B*g T,T trace(H1*(W1+W2))]==semidefinite(2);

cvx_end

end

there is an error in the 3rd constraint(invalid constraint: convex<= complex affine)