# 在某一次迭代过程中出现索引超出数组范围。

P = P( :, colX ) + P( :, cols ) * temp;

[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );

solve( prob );

cvx_end

code:
cvx_solver Mosek
cvx_save_prefs
cvx_begin quiet
variable W_r(N,N) hermitian semidefinite
variable W_t(N,N) hermitian semidefinite
variable F_f(J,J) hermitian semidefinite
variables lamda_1r lamda_2r lamda_3r chi_1r(L1) chi_2r(L1) chi_3r(L1)
variables lamda_1t lamda_2t lamda_3t chi_1t(L2) chi_2t(L2) chi_3t(L2)

``````        variables x1 x2
expressions  T_burr T_bu_rr T_jurr ...
T_butt T_bu_tt T_jutt ...
B1t(M,M,L2)  B2t(M,1,L2)   B3t(1,M,L2)   B4t(1,L2)   Abt(M+1,M+1,L2) ...
B1_t(M,M,L2) B2_t(M,1,L2)  B3_t(1,M,L2)  B4_t(1,L2)  Ab_t(M+1,M+1,L2)...
J1t(M,M,L2)  J2t(M,1,L2)   J3t(1,M,L2)   J4t(1,L2)   Ajt(M+1,M+1,L2) ...
B1r(M,M,L1)  B2r(M,1,L1)   B3r(1,M,L1)   B4r(1,L1)   Abr(M+1,M+1,L1)...
B1_r(M,M,L1) B2_r(M,1,L1)  B3_r(1,M,L1)  B4_r(1,L1)  Ab_r(M+1,M+1,L1)...
J1r(M,M,L1)  J2r(M,1,L1)   J3r(1,M,L1)   J4r(1,L1)   Ajr(M+1,M+1,L1)...
Pha1_r Pha2_r Pha1_t Pha2_t
%%%%r区

T_bur=(trace(HH_bu_r*Wr));%%%%%SDR开始
T_bu_r=(trace(HH_bu_r*Wt));
T_jur=trace(GG_ju_r*Ff);
t_ur=1/((T_bu_r+T_jur)+a0);

T_burr=trace(HH_bu_r*W_r);
T_bu_rr=trace(HH_bu_r*W_t);
T_jurr=trace(GG_ju_r*F_f);

Pha1_r=real(-t_ur*((T_bu_rr+T_jurr)+a0)+log(t_ur)+1)+...
log_det(real(T_burr+(T_bu_rr+T_jurr)+a0));
%%%%t区
T_but=trace(HH_bu_t*Wt);%%%%%SDR开始
T_bu_t=trace(HH_bu_t*Wr);
T_jut=trace(GG_ju_t*Ff);
t_ut=1/((T_bu_t+T_jut)+a0);%%%%%引用引理

T_butt=trace(HH_bu_t*W_t);%%%%%SDR开始
T_bu_tt=trace(HH_bu_t*W_r);
T_jutt=trace(GG_ju_t*F_f);

Pha1_t=real(-t_ut*((T_bu_tt+T_jutt)+a0)+log(t_ut)+1)+...
log_det(real(T_butt+T_bu_tt+T_jutt+a0));

for l=1:L1
%wl
B1r(:,:,l)=lamda_1r*eye(M)-h_be_r*W_r*h_be_r';
B2r(:,:,l)=-h_be_r*W_r*h_be_r'*H_ie_r(:,l);
B3r(:,:,l)=-H_ie_r(:,l)'*h_be_r*W_r*h_be_r';
B4r(:,l)=-lamda_1r*E_error_r(l)^2-...
H_ie_r(:,l)'*h_be_r*W_r*h_be_r'*H_ie_r(:,l)+chi_1r(l) ;
Abr(:,:,l)=[B1r(:,:,l),B2r(:,:,l);B3r(:,:,l),B4r(:,l)];
Gamma_wr=trace(Wrx*(H_ie_r(:,l)*H_ie_r(:,l)'+E_error_r(l)^2*eye(M)+...
2*E_error_r(l)*sqrt(eye(M)*(H_ie_r(:,l)'*Wrx*H_ie_r(:,l))/trace(Wrx))));
%wl'
B1_r(:,:,l)=lamda_2r*eye(M)+h_be_r*W_t*h_be_r';
B2_r(:,:,l)=h_be_r*W_t*h_be_r'*H_ie_r(:,l);
B3_r(:,:,l)=H_ie_r(:,l)'*h_be_r*W_t*h_be_r';
B4_r(:,l)=-lamda_2r*E_error_r(l)^2+...
H_ie_r(:,l)'*h_be_r*W_r*h_be_r'*H_ie_r(:,l)-chi_2r(l) ;
Ab_r(:,:,l)=[B1_r(:,:,l),B2_r(:,:,l);B3_r(:,:,l),B4_r(:,l)];
Gamma_w_r=trace(Wrxx*(H_ie_r(:,l)*H_ie_r(:,l)'+E_error_r(l)^2*eye(M)-...
2*E_error_r(l)*sqrt(eye(M)*(H_ie_r(:,l)'*Wrxx*H_ie_r(:,l))/trace(Wrxx))));
%g
J1r(:,:,l)=lamda_3r*eye(M)+h_je_r*F_f*h_je_r';
J2r(:,:,l)=h_je_r*F_f*h_je_r'*H_ie_r(:,l);
J3r(:,:,l)=H_ie_r(:,l)'*h_je_r*F_f*h_je_r';
J4r(:,l)=-lamda_3r*E_error_r(l)^2+...
H_ie_r(:,l)'*h_je_r*F_f*h_je_r'*H_ie_r(:,l)-chi_3r(l) ;
Ajr(:,:,l)=[J1r(:,:,l),J2r(:,:,l);J3r(:,:,l),J4r(:,l)];
Gamma_fr=trace(Frx*(H_ie_r(:,l)*H_ie_r(:,l)'+E_error_r(l)^2*eye(M)-...
2*E_error_r(l)*sqrt(eye(M)*(H_ie_r(:,l)'*Frx*H_ie_r(:,l))/trace(Frx))));

tr=real((Gamma_wr+Gamma_w_r+Gamma_fr+a0)^(-1));

Pha2_r(:,l)=real(tr*(chi_1r(l)+chi_2r(l)+chi_3r(l)+a0)-log(tr)-1)-log(real(chi_2r(l)+chi_3r(l)+a0));
end

for l=1:L2
%wl
B1t(:,:,l)=lamda_1t*eye(M)-h_be_t*W_t*h_be_t';
B2t(:,:,l)=-h_be_t*W_t*h_be_t'*H_ie_t(:,l);
B3t(:,:,l)=-H_ie_t(:,l)'*h_be_t*W_t*h_be_t';
B4t(:,l)=-lamda_1t*E_error_t(l)^2-...
H_ie_t(:,l)'*h_be_t*W_t*h_be_t'*H_ie_t(:,l)+chi_1t(l) ;
Abt(:,:,l)=[B1t(:,:,l),B2t(:,:,l);B3t(:,:,l),B4t(:,l)];
Gamma_wt=trace(Wtx*(H_ie_t(:,l)*H_ie_t(:,l)'+E_error_t(l)^2*eye(M)+...
2*E_error_t(l)*sqrt(eye(M)*(H_ie_t(:,l)'*Wtx*H_ie_t(:,l))/trace(Wtx))));
%wl'
B1_t(:,:,l)=lamda_2t*eye(M)+h_be_t*W_r*h_be_t';
B2_t(:,:,l)=h_be_t*W_r*h_be_t'*H_ie_t(:,l);
B3_t(:,:,l)=H_ie_t(:,l)'*h_be_t*W_r*h_be_t';
B4_t(:,l)=-lamda_2t*E_error_t(l)^2+...
H_ie_t(:,l)'*h_be_t*W_r*h_be_t'*H_ie_t(:,l)+chi_2t(l) ;
Ab_t(:,:,l)=[B1_t(:,:,l),B2_t(:,:,l);B3_t(:,:,l),B4_t(:,l)];
Gamma_w_t=trace(Wtxx*(H_ie_t(:,l)*H_ie_t(:,l)'+E_error_t(l)^2*eye(M)+...
2*E_error_t(l)*sqrt(eye(M)*(H_ie_t(:,l)'*Wtxx*H_ie_t(:,l))/trace(Wtxx))));
%g
J1t(:,:,l)=lamda_3t*eye(M)+h_je_t*F_f*h_je_t';
J2t(:,:,l)=h_je_t*F_f*h_je_t'*H_ie_t(:,l);
J3t(:,:,l)=H_ie_t(:,l)'*h_je_t*F_f*h_je_t';
J4t(:,l)=-lamda_3t*E_error_t(l)^2+...
H_ie_t(:,l)'*h_je_t*F_f*h_je_t'*H_ie_t(:,l)-chi_3t(l) ;
Ajt(:,:,l)=[J1t(:,:,l),J2t(:,:,l);J3t(:,:,l),J4t(:,l)];
Gamma_ft=trace(Ftx*(H_ie_t(:,l)*H_ie_t(:,l)'+E_error_t(l)^2*eye(M)-...
2*E_error_t(l)*sqrt(eye(M)*(H_ie_t(:,l)'*Ftx*H_ie_t(:,l))/trace(Ftx))));

tt=real((Gamma_wt+Gamma_w_t+Gamma_ft+a0)^(-1));
Pha2_t(:,l)=real(tt*(chi_1t(l)+chi_2t(l)+chi_3t(l)+a0)-log(tt)-1)-log(real(chi_2t(l)+chi_3t(l)+a0));
end

maximize B/log(2)*(nr*(Pha1_r-x1))+...
B/log(2)*(nt*(Pha1_t-x2))
subject to
x1>=0;
x2>=0;

real(trace(W_r+W_t)+trace(F_f))<=P1_max(ll);

for  l=1:L1
real(Pha2_r(:,l)-x1)<=0;
real(Abr(:,:,l)) == hermitian_semidefinite(M+1);
real(Ab_r(:,:,l)) == hermitian_semidefinite(M+1);
real(Ajr(:,:,l)) == hermitian_semidefinite(M+1);

end
for  l=1:L2
real(Pha2_t(:,l)-x2)<=0;
real(Abt(:,:,l)) == hermitian_semidefinite(M+1);
real(Ab_t(:,:,l)) == hermitian_semidefinite(M+1);
real(Ajt(:,:,l)) == hermitian_semidefinite(M+1);

end
cvx_end
``````