%系统为x(k+1)=Ax(k)+w(k)
clc;clear;close
H=[2/7 0; 0 1 ];D=[20 0; 0 20];P=[-18,-55;18,55;55,-18;55,-18];
x1=[155.2844 10.1128;10.1128 34.6520];x2=[157.9370 18.2825;18.2825 60.6887];
x3=[157.9242 18.2798;18.2798 60.6883];x4=[ 157.9242 18.2798;18.2798 60.6883];
w1=[151.4106 18.1135;18.1135 55.0114];
cvx_begin sdp
variable W(2,2) ;
variable T(2,2) symmetric ;
variable W1(2,1);%W1=W*\theta
variable r1(1,1) nonnegative;
variable r2(1,1) nonnegative;
variable r3(1,1) nonnegative;
variable r4(1,1) nonnegative;

variable a1(40,40) semidefinite diagonal;
variable a2(40,40) semidefinite diagonal;
variable a3(40,40) semidefinite diagonal;
variable a4(40,40) semidefinite diagonal;

variable b1(2,2) semidefinite diagonal;
variable b2(2,2) semidefinite diagonal;
variable b3(2,2) semidefinite diagonal;
variable b4(2,2) semidefinite diagonal;

variable v1(2,2) ;variable X1(2,2) symmetric;
variable v2(2,2) ;variable X2(2,2) symmetric;
variable v3(2,2) ;variable X3(2,2) symmetric;
variable v4(2,2) ;variable X4(2,2) symmetric;

minimize -log_det(T)
subject to
HW[0.011;-0.0218]>=-ones(2,1);HW[0.011;-0.0218]<=ones(2,1);
HW[0.0218;0.011]>=-ones(2,1);HW[0.0218;0.011]<=ones(2,1);
e1=[1;0;0;0];e2=[0;1;0;0];e3=[0;0;1;0];e4=[0;0;0;1];
X=[-1.8696 -1.6901 -1.4009 -1.2051 -0.9362 -0.6580 -0.4271 -0.2652 0.0238 0.2752 0.4896 0.7643 0.9432 1.2131 1.5232 1.8959 2.3419 2.9012 3.4746 3.9773;
0.2448 0.2230 0.2837 0.2635 0.2469 0.2725 0.2588 0.3556 0.2769 0.2165 0.1844 0.2684 0.3160 0.3006 0.3891 0.4857 0.5260 0.5338 0.5671 0.4927];
d=[D*[-1.6901; 0.2230 ];D*[-1.4009;0.2837];D*[-1.2051;0.2635];D*[ -0.9362;0.2469];D*[ -0.6580;0.2725 ];D*[ -0.4271;0.2588];D*[-0.2652;0.3556];D*[ 0.0238;0.2769];D*[ 0.2752 ;
0.2165 ];D*[ 0.4896;0.1844];D*[0.7643 ;0.2684 ];D*[0.9432 ;0.3160 ];D*[1.2131;0.3006];D*[1.5232;0.3891];D*[1.8959;0.4857];D*[ 2.3419; 0.5260 ];D*[2.9012;0.5338];D*[3.4746;
0.5671];D*[ 3.9773;0.4927];D*[ 4.5698;0.4269]];
z=kron(X’,D);
g=kron(W1’,eye(2));

[r1-ones(40,1)‘a1ones(40,1)-[1;1]‘b1[1;1]+d’a1d,-d’a1z,zeros(1,2),zeros(1,2),zeros(1,2);-z’a1d,z’a1z,zeros(4,2),g’,zeros(4,2);zeros(2,1),zeros(2,4),D’b1D,eye(2),zeros(2,2);zeros(2,1),g,eye(2),v1+v1’,v1’;zeros(2,1),zeros(2,4),zeros(2,2),v1,X1] == semidefinite(11);
[r2-ones(40,1)‘a2ones(40,1)-[1;1]‘b2[1;1]+d’a2d,-d’a2z,zeros(1,2),zeros(1,2),zeros(1,2);-z’a2d,z’a2z,zeros(4,2),g’,zeros(4,2);zeros(2,1),zeros(2,4),D’b2D,eye(2),zeros(2,2);zeros(2,1),g,eye(2),v2+v2’,v2’;zeros(2,1),zeros(2,4),zeros(2,2),v2,X2] == semidefinite(11);
[r3-ones(40,1)‘a3ones(40,1)-[1;1]‘b3[1;1]+d’a3d,-d’a3z,zeros(1,2),zeros(1,2),zeros(1,2);-z’a3d,z’a3z,zeros(4,2),g’,zeros(4,2);zeros(2,1),zeros(2,4),D’b3D,eye(2),zeros(2,2);zeros(2,1),g,eye(2),v3+v3’,v3’;zeros(2,1),zeros(2,4),zeros(2,2),v3,X3] == semidefinite(11);
[r4-ones(40,1)‘a4ones(40,1)-[1;1]‘b4[1;1]+d’a4d,-d’a4z,zeros(1,2),zeros(1,2),zeros(1,2);-z’a4d,z’a4z,zeros(4,2),g’,zeros(4,2);zeros(2,1),zeros(2,4),D’b4D,eye(2),zeros(2,2);zeros(2,1),g,eye(2),v4+v4’,v4’;zeros(2,1),zeros(2,4),zeros(2,2),v4,X4] == semidefinite(11);

[W’*inv(x1)*w1+inv(x1)w1W-w1’*inv(x1)X1inv(x1)w1,r1P’e1;r1e1’*P,r1] == semidefinite(3);
[W’*inv(x2)*w1+inv(x2)w1W-w1’*inv(x2)X1inv(x2)w1,r2P’*e2;e2’Pr2,r2] == semidefinite(3);
[W’*inv(x3)*w1+inv(x3)w1W-w1’*inv(x3)X1inv(x3)w1,r3P’*e3;e2’Pr3,r3] == semidefinite(3);
[W’*inv(x4)*w1+inv(x4)w1W-w1’*inv(x4)X1inv(x4)w1,r4P’*e4;e2’Pr4,r4] == semidefinite(3);

T(2,2)-eye(2)==semidefinite(2);
X1(2,2)-eye(2)==semidefinite(2);
X2(2,2)-eye(2)==semidefinite(2);
X3(2,2)-eye(2)==semidefinite(2);
X4(2,2)-eye(2)==semidefinite(2);

W’*w1+w1’W-2(w1’*w1)-T==semidefinite(2);
cvx_end
cvx_optval

Follow the advice at Debugging infeasible models - YALMIP , all but section 1 of which also applies to CVX.

Here are some things which jumped out at me from a casual glance at your program.

Is

T(2,2)-eye(2)==semidefinite(2);
X1(2,2)-eye(2)==semidefinite(2);
X2(2,2)-eye(2)==semidefinite(2);
X3(2,2)-eye(2)==semidefinite(2);
X4(2,2)-eye(2)==semidefinite(2);


what you really want? T(2,2), X1(2,2), etc. are individual scalars, not the entire matrices. These constraints are equivalent to T(2,2) >= 1, X1(2,2) >= 1, etc. I doubt that’s what you want. Perhaps you want

T-eye(2)==semidefinite(2);
X1-eye(2)==semidefinite(2);
X2eye(2)==semidefinite(2);
X3-eye(2)==semidefinite(2);
X4-eye(2)==semidefinite(2);


Declaring a variable as semidefinite diagonal is just the same as declaring it diagonal nonnegative, although i don’t know whether CVX and/or the solver are smart enough to recognize that and simplify the model accordingly.

You can try omitting certain constraints until you get feasibility. Also, you can use nonnegative slacks, which in the case of semidefinite constraints would involve changing LHS to LHS + s*eye(n) (for appropriate value of n)., Then minimize sum of slacks instead of the original objective, to help you diagnose the infeasibility.

I have no idea what your model is supposed to represent, so i can’t tell you what is correct or not. But based on my observations above, perhaps there’s more wrong with your code than the suspicious things i pointed out.