p_ue=zeros(num_iter,J);
p_signal=zeros(1,J);%信号功率
p_noise=zeros(1,J);%噪声功率
%% 单用户载波间功率分配因子计算
for jj=1:1:J
a11=sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(1,jj,:))/(sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(2,jj,:))+sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(1,jj,:)));
a12=sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(2,jj,:))/(sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(2,jj,:))+sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(1,jj,:)));
a21=sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(1,jj,:))/(sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(3,jj,:))+sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(1,jj,:)));
a22=sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(3,jj,:))/(sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(3,jj,:))+sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(1,jj,:)));
a31=sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(1,jj,:))/(sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(4,jj,:))+sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(1,jj,:)));
a32=sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(4,jj,:))/(sum(sc_signal_TTI(1,jj,:))*sum(sc_noise_TTI(4,jj,:))+sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(1,jj,:)));
a41=sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(2,jj,:))/(sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(3,jj,:))+sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(2,jj,:)));
a42=sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(3,jj,:))/(sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(3,jj,:))+sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(2,jj,:)));
a51=sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(2,jj,:))/(sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(4,jj,:))+sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(2,jj,:)));
a52=sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(4,jj,:))/(sum(sc_signal_TTI(2,jj,:))*sum(sc_noise_TTI(4,jj,:))+sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(2,jj,:)));
a61=sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(3,jj,:))/(sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(4,jj,:))+sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(3,jj,:)));
a62=sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(4,jj,:))/(sum(sc_signal_TTI(3,jj,:))*sum(sc_noise_TTI(4,jj,:))+sum(sc_signal_TTI(4,jj,:))*sum(sc_noise_TTI(3,jj,:)));
%% 4个载波6个用户按照预先的准则进行映射
switch jj
case 1
p_signal(jj)=a11*sum(sc_signal_TTI(1,jj,:))+a12*sum(sc_signal_TTI(2,jj,:));%%载波1和2 这个算的是增益,sc_signal_TTI就是指载波传输中的增益,因为算容量所以不需要真值2
p_noise(jj)=sum(sc_noise_TTI(1,jj,:))+sum(sc_noise_TTI(2,jj,:));%%载波1和2
case 2
p_signal(jj)=a21*sum(sc_signal_TTI(1,jj,:))+a22*sum(sc_signal_TTI(3,jj,:));%%载波1和3
p_noise(jj)=sum(sc_noise_TTI(1,jj,:))+sum(sc_noise_TTI(3,jj,:));%%载波1和3
case 3
p_signal(jj)=a31*sum(sc_signal_TTI(1,jj,:))+a32*sum(sc_signal_TTI(4,jj,:));%%载波1和4
p_noise(jj)=sum(sc_noise_TTI(1,jj,:))+sum(sc_noise_TTI(4,jj,:));%%载波1和4
case 4
p_signal(jj)=a41*sum(sc_signal_TTI(2,jj,:))+a42*sum(sc_signal_TTI(3,jj,:));%%载波2和3
p_noise(jj)=sum(sc_noise_TTI(2,jj,:))+sum(sc_noise_TTI(3,jj,:));%%载波2和3
case 5
p_signal(jj)=a51*sum(sc_signal_TTI(2,jj,:))+a52*sum(sc_signal_TTI(4,jj,:));%%载波2和4
p_noise(jj)=sum(sc_noise_TTI(2,jj,:))+sum(sc_noise_TTI(4,jj,:));%%载波2和4
otherwise
p_signal(j