利用蒙特卡算法仿真二进制双极性基带通信系统
2019獨角獸企業重金招聘Python工程師標準>>>
主程序:SNRindB1=0:1:12
SNRindB2=0:0.01:12;
for i=1:length(SNRindB1)?
?smld_err_prb(i)=exa038_Fun_doublePe(SNRindB1(i));
end
semilogy(SNRindB1,smld_err_prb,'r*');
for i=1:length(SNRindB2)
??? SNR=10^(SNRindB2(i)/10);
??? theo_err_prb(i)=(1/2)*erfc(sqrt(SNR/2));
end
hold on
semilogy(SNRindB2,theo_err_prb);
grid on
子程序:
function [p]=exa038_Fun_doublePe(snr_in_dB)
E=1;
SNR=10^(snr_in_dB/10);
sgma=E/sqrt(SNR);
N=10000;
disource=(sign(rand(1,N)-0.5)+1)/2;
numoferr=0;
for i=1:length(disource)
??? if disource(i)==1
??????? r=E+randn*sgma;
??? else
??????? r=-E+randn*sgma;
??? end
??? if(r>0)
??????? decis=1;
??? else
??????? decis=0;
??? end
??? if(decis~=disource(i))
??????? numoferr=numoferr+1;
??? end
end
p=numoferr/N;
?
轉載于:https://my.oschina.net/annieduoduo/blog/71429
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的利用蒙特卡算法仿真二进制双极性基带通信系统的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SQL Server,Could not
- 下一篇: 以太网单播、组播、广播