📄 tu1-11.m
字号:
%非自适应功率分配时的信道容量,以信噪比为自变量,n_R=n_T=8
SNR_dB=0:2:26;
SNR=10.^(SNR_dB./10);
n_R=8;n_T=8;Cmean=zeros(1,14);s=1;
for SNR=[1.0000 1.5849 2.5119 3.9811 6.3096 10.0000 15.8489 25.1189 39.8107 63.0957 100.0000 158.4893 251.1886 398.1072]
P=1;
sigma2=P./SNR;
for simutimes=1:1000
H=(randn(n_R, n_T)+j*randn(n_R, n_T))./sqrt(2);
lamda=real(eig(H*H'));
Pri=lamda.*P./n_T;%eq1-20
C(simutimes)=sum(log2(1+Pri./sigma2));%eq1-21
end
Cmean(s)=mean(C);
s=s+1;
end
plot(SNR_dB, Cmean,'-*');
hold on;
axis([0,30,0,60]);
grid on;
%自适应功率分配时的信道容量,以信噪比为自变量,n_R=n_T=8
SNR_dB=0:2:26;
SNR=10.^(SNR_dB./10);
n_R=8;n_T=8;Cmean=zeros(1,14);s=1;
for SNR=[1.0000 1.5849 2.5119 3.9811 6.3096 10.0000 15.8489 25.1189 39.8107 63.0957 100.0000 158.4893 251.1886 398.1072]
P=1;
sigma2=P./SNR;
for simutimes=1:1000
H=(randn(n_R, n_T)+j*randn(n_R, n_T))./sqrt(2);
lamda=real(eig(H*H'));
mu=1/n_R;
for kk=1:100
Pi=max(mu-sigma2./(lamda+0.00001), 0);
Psum=sum(real(Pi));
if (Psum>1)
break;
else
mu=mu+0.01;
end
end
%mu jinsi
Pri=max(lamda.*mu-sigma2, 0);%eq1-33
C(simutimes)=sum(log2(1+Pri./sigma2));%eq1-34
end
Cmean(s)=mean(C);
s=s+1;
end
plot(SNR_dB, Cmean,'-o');
hold on;
axis([0,30,0,60]);
grid on;
xlabel('信噪比/dB');
ylabel('容量/(bit/s/Hz)');
legend('Tx=8,Rx=8,Non-Adaptive power allocation','Tx=8,Rx=8,Adaptive power allocation');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -