⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 experiment3.m

📁 舍选法仿真rayleigh fading channel
💻 M
字号:
clear all;close all;
N=500000;
deta=1.5;
u1=rand(1,N);
u2=10*rand(1,N);
Mu1=1/(sqrt(2)*deta)*u1;
fu2=u2/deta^2.*exp(-u2.^2/2/deta^2);
j=0;
for i=1:N
    if Mu1(i)<=fu2(i)
        j=j+1;
        R_simulation(j)=u2(i);
    end
end
R_number=hist(R_simulation,50);
R_step=max(R_simulation)/50;
R_pdf_simulation=R_number/j/R_step;
R_label=(1:50)/50*max(R_simulation);
R_pdf_theory=R_label/deta^2.*exp(-R_label.^2/2/deta^2);
R_cdf_simulation(1)=R_pdf_simulation(1)*R_step;
for i=2:50
    R_cdf_simulation(i)=R_cdf_simulation(i-1)+R_pdf_simulation(i)*R_step;
end
R_cdf_theory=1-exp(-R_label.^2/2/deta^2);
figure
hist(R_simulation,50)
title('瑞利衰落信号包络仿真样值分布图')
xlabel('R(V)')
ylabel('样值数')
figure
plot(R_label,R_pdf_theory,R_label,R_pdf_simulation,'*')
title('概率密度仿真')
xlabel('R(V)')
ylabel('pdf')
legend('理论值','仿真值')
figure
plot(R_label,R_cdf_theory,R_label,R_cdf_simulation,'*')
title('累计概率密度仿真')
xlabel('R(V)')
ylabel('cdf')
legend('理论值','仿真值')
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -