资源简介

本程序是mazen.O的经典论文:Performance Analysis of two-hop ralayed transmissions over rayleigh fading channels 的文章中所附的仿真图的程序,跑出的结果和文章中的附图是一样的!可以跑出里面的三张图,包括瑞利衰落下中继信道的中断概率的蒙特卡洛及公式的仿真,及选择不同的增益的性能差别曲线!

资源截图

代码片段和文件信息

clc
clear all;
close all;


% Monte Carlo simulation of two Exponential RVs
avg_y1=1;
avg_y2=2;
n_loop=100000;
MonteCarlo=[];
x=0.05:0.1:4-0.05;
y1=exprnd(avg_y1[1 n_loop]);
y2=exprnd(avg_y2[1 n_loop]);
y=y1.*y2./(y1+y2);
yy=y1.*y2./(y1+y2+1);
n=hist(yx)./n_loop*10;
figure(1);
bar(xn);
hold on
K1 = besselk(12*x./sqrt(avg_y1.*avg_y2));
K0 = besselk(02*x./sqrt(avg_y1.*avg_y2));
py=(2*x.*exp(-x.*(1/avg_y1+1/avg_y2))./(avg_y1.*avg_y2)).*((avg_y1+avg_y2)./sqrt(avg_y1.*avg_y2).*K1+2.*K0);
plot(x+0.05py‘r‘);
legend(‘\itsimulation‘‘\itanalysis‘);
ylabel(‘probability‘);
xlabel(‘SNR‘);

% outage probability of two gains
yth=1;
for avg=1:40
avg_y1=10^(avg/10);
avg_y2=10^(avg/10);
n_loop=1000000;
y1=exprnd(avg_y1[1 n_loop]);
y2=exprnd(avg_y2[1 n_loop]);
y=y1.*y2./(y1+y2);
yy=y1.*y2./(y1+y2+1);
gain1(avg)=sum(ygain2(avg)=sum(yyend 
figure(2)semilogy(gain1‘-*‘)hold on;
semilogy(gain2‘-‘)

评论

共有 条评论