|
楼主 |
发表于 2019-3-26 21:44:19
|
显示全部楼层
%{
作者:JamesWONG
%}
clc
clear all;
%图像的横坐标为平均接收信噪比(???=10log10?),纵坐标为归一化容量(C/B)
for each_SNR_dB = linspace(5,30,11)
index = ((each_SNR_dB-5)/2.5+1);
AWGN_lognormal(index)=log2(1+10^(0.1*(each_SNR_dB+8^2*log(10)/20)));
RX_CSI_lognormal_integrand=(@(x)log2(1+x).*10./((2*pi)^0.5.*x*8*log(10)).*exp(-(10*log10(x)-each_SNR_dB).^2/(2*(8)^2)));
RX_CSI_lognormal(index)=quadgk(RX_CSI_lognormal_integrand,0,inf);
TXnRX_CSI_lognormal_threshold_integrand=@(y) (quadgk((@(x)(1./y-1./x).*10./((2*pi)^0.5.*x*8*log(10)).*exp(-(10*log10(x)-each_SNR_dB).^2/(2*(8)^2))),y,inf)-1);
TXnRX_CSI_lognormal_threshold(index)=fzero(TXnRX_CSI_lognormal_threshold_integrand,1); %求收发两端都已知CSI时的中断门限
TXnRX_CSI_lognormal_integrand = (@(x) log2(x/TXnRX_CSI_lognormal_threshold(index)).*10./((2*pi)^0.5.*x*8*log(10)).*exp(-(10*log10(x)-each_SNR_dB).^2/(2*(8)^2)));
TXnRX_CSI_lognormal(index) = quadgk(TXnRX_CSI_lognormal_integrand,TXnRX_CSI_lognormal_threshold(index),inf);
Zero_outage_integrand=@(y) (quadgk((@(x)(y./x).*10./((2*pi)^0.5.*x*8*log(10)).*exp(-(10*log10(x)-each_SNR_dB).^2/(2*(8)^2))),0,inf)-1);
SNR_Zero_outage(index)=fzero(Zero_outage_integrand,1); %求零中断容量恒定信噪比
Zero_outage_logmormal(index)=log2(1+SNR_Zero_outage(index));
for k=(each_SNR_dB-10):(each_SNR_dB+10) %最大中断容量时对中断门限进行遍历
Max_outage_integrand=@(y) (quadgk((@(x)(y./x).*10./((2*pi)^0.5.*x*8*log(10)).*exp(-(10*log10(x)-each_SNR_dB).^2/(2*(8)^2))),10^(0.1*k),inf)-1);
SNR_Max_outage(51-each_SNR_dB+k)=fzero(Max_outage_integrand,1); %最大中断容量时求恒定信噪比
outrage_capacity(51-each_SNR_dB+k)=log2(1+SNR_Max_outage(51-each_SNR_dB+k))*(quadgk((@(x) 10./((2*pi)^0.5.*x*8*log(10)).*exp(-(10*log10(x)-each_SNR_dB).^2/(2*(8)^2))),10^(0.1*k),inf));
end
Maximum_outage_lognormal(index)=max(outrage_capacity); %取最大的中断容量
[ar_r,rcr_r,trcr_r,zon_r,mon_r] = Nakagami_fade(1,each_SNR_dB);
AWGN_Rayleigh(index) = ar_r;
RX_CSI_Rayleigh(index) = rcr_r;
TXnRX_CSI_Rayleigh(index) = trcr_r;
Zero_outage_Rayleigh(index) = zon_r;
Maximum_outage_Rayleigh(index) = mon_r;
[ar,rcr,trcr,zon,mon] = Nakagami_fade(2,each_SNR_dB);
AWGN_Nakagami(index) = ar;
RX_CSI_Nakagami(index) = rcr;
TXnRX_CSI_Nakagami(index) = trcr;
Zero_outage_Nakagami(index) = zon;
Maximum_outage_Nakagami(index) = mon;
end
figure(1)
E_SNR_dB=linspace(5,30,11);
plot(E_SNR_dB,AWGN_lognormal,'-*b',E_SNR_dB,RX_CSI_lognormal,'-+r',E_SNR_dB,TXnRX_CSI_lognormal,'-og',E_SNR_dB,Zero_outage_logmormal,'-.*y',E_SNR_dB,Maximum_outage_lognormal,'-ks');
hold on
legend('AWGN信道容量','RX CSI的香农容量','TX/RX CSI的香农容量','零中断容量','最大中断容量');
xlabel('平均接收信噪比(dB)');
ylabel('C/B (bit/s/Hz)');
title('对数正态衰落下的信道容量');
figure(2)
E_SNR_dB=linspace(5,30,11);
plot(E_SNR_dB,AWGN_Rayleigh,'-*b',E_SNR_dB,RX_CSI_Rayleigh,'-+r',E_SNR_dB,TXnRX_CSI_Rayleigh,'-og',E_SNR_dB,Zero_outage_Rayleigh,'-.*y',E_SNR_dB,Maximum_outage_Rayleigh,'-ks');hold on
legend('AWGN信道容量','RX CSI的香农容量','TX/RX CSI的香农容量','零中断容量','最大中断容量');
xlabel('平均接收信噪比(dB)');
ylabel('C/B (bit/s/Hz)');
title('瑞利衰落下的信道容量');
figure(3)
E_SNR_dB=linspace(5,30,11);
plot(E_SNR_dB,AWGN_Nakagami,'-*b',E_SNR_dB,RX_CSI_Nakagami,'-+r',E_SNR_dB,TXnRX_CSI_Nakagami,'-og',E_SNR_dB,Zero_outage_Nakagami,'-.*y',E_SNR_dB,Maximum_outage_Nakagami,'-ks');hold on
legend('AWGN信道容量','RX CSI的香农容量','TX/RX CSI的香农容量','零中断容量','最大中断容量');
xlabel('平均接收信噪比(dB)');
ylabel('C/B (bit/s/Hz)');
title('Nakagami衰落下的信道容量');
MATLAB程序,仿真无线信道容量对比(Goldsmith的教材)%{
Nakagami_fade函数功能:给定Nakagami衰落的参数m以及平均接受信噪比,
返回五种信道下的归一化容量C/B
示例:
>>
[ar_r,rcr_r,trcr_r,zon_r,mon_r] = Nakagami_fade(1,5)
得到:
ar_r =2.0574
rcr_r =1.7160
trcr_r =1.8451
zon_r = 0.0531
mon_r =1.6577
%}
function[AWGN_Rayleigh,RX_CSI_Rayleigh,TXnRX_CSI_Rayleigh,Zero_outage_Nakagami,Maximum_outage_Nakagami] = Nakagami_fade(m,E_SNR_dB)
AWGN_Rayleigh=log2(1+10^(0.1*E_SNR_dB));
RX_CSI_Rayleigh_integrand=(@(x)log2(1+x).*(m ./10^(0.1*E_SNR_dB)).^m .*x.^(m-1) /gamma(m) .*exp(-(x.*m ./10^(0.1*E_SNR_dB))));
RX_CSI_Rayleigh=quadgk(RX_CSI_Rayleigh_integrand,0,inf);
TXnRX_CSI_Rayleigh_threshold_integrand=@(y) (quadgk((@(x)(1./y-1./x).*(m ./10^(0.1*E_SNR_dB)).^m .*x.^(m-1) /gamma(m) .*exp(-(x.*m ./10^(0.1*E_SNR_dB)))),y,inf)-1);
TXnRX_CSI_Rayleigh_threshold=fzero(TXnRX_CSI_Rayleigh_threshold_integrand,0.55); %求收发两端都已知CSI时的中断门限,通过迭代初值所得
TXnRX_CSI_Rayleigh_integrand=(@(x) log2(x/TXnRX_CSI_Rayleigh_threshold).*(m ./10^(0.1*E_SNR_dB)).^m .*x.^(m-1) /gamma(m) .*exp(-(x.*m ./10^(0.1*E_SNR_dB))));
TXnRX_CSI_Rayleigh=quadgk(TXnRX_CSI_Rayleigh_integrand,TXnRX_CSI_Rayleigh_threshold,inf);
Zero_outage_integrand=@(y) (quadgk((@(x)(y./x).*(m ./10^(0.1*E_SNR_dB)).^m .*x.^(m-1) /gamma(m) .*exp(-(x.*m ./10^(0.1*E_SNR_dB)))),0,inf)-1);
SNR_Zero_outage=fzero(Zero_outage_integrand,1); %求零中断容量恒定信噪比
Zero_outage_Nakagami=log2(1+SNR_Zero_outage);
for k=(E_SNR_dB-10):(E_SNR_dB+10) %最大中断容量时对中断门限进行遍历
Max_outage_integrand=@(y) (quadgk((@(x)(y./x).*(m ./10^(0.1*E_SNR_dB)).^m .*x.^(m-1) /gamma(m) .*exp(-(x.*m ./10^(0.1*E_SNR_dB)))),10^(0.1*k),inf)-1);
SNR_Max_outage(31-E_SNR_dB+k)=fzero(Max_outage_integrand,1); %最大中断容量时求恒定信噪比
max_outage_capacity(31-E_SNR_dB+k)=log2(1+SNR_Max_outage(31-E_SNR_dB+k))*(quadgk((@(x) (m ./10^(0.1*E_SNR_dB)).^m .*x.^(m-1)/gamma(m).*exp(-(x.*m ./10^(0.1*E_SNR_dB)))),10^(0.1*k),inf));
end
Maximum_outage_Nakagami=max(max_outage_capacity); %取最大的中断容量
end
|
|