利用蒙特卡算法仿真二进制双极性基带通信系统
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
主程序: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;
?
轉(zhuǎn)載于:https://my.oschina.net/annieduoduo/blog/71429
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的利用蒙特卡算法仿真二进制双极性基带通信系统的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: SQL Server,Could not
- 下一篇: 以太网单播、组播、广播