Why do we need to write the noise as randn(2,1)./sqrt(2*SNR) instead of randn(1,1)/sqrt(2)?

9 ビュー (過去 30 日間)
yang-En Hsiao
yang-En Hsiao 2019 年 4 月 21 日
編集済み: yang-En Hsiao 2019 年 4 月 21 日
I saw this code, about the error probability of on/off signal ,on the internet
Ts=10^4;
SNR_dB=[-3 0 3 6 9];
Ne=zeros(1,length(SNR_dB));
for i=1:length(SNR_dB)
SNR=10^(SNR_dB(i)/10);
for t=1:Ts
s=((sign(rand()-0.5))+1)/2;%create the "on"signal or "off" signal ."on"signal=1,"off" signal=0
r=randn(2,1)./sqrt(2.*SNR);%it seems that it is noise
if (s+r)>0.5
s_hat=1;
else
s_hat=0;
end
if abs(s_hat-s)>0
Ne(i)=Ne(i)+1;
end
y=Ne./Ts;
end
end
Pe=zeros(1,5);
for i=1:5
SNR=10^(SNR_dB(i)/10);
Pe(i)=erfc(sqrt(SNR/2)/(2^0.5))/2;
end
semilogy(SNR_dB,y,'-r',SNR_dB,Pe,'-k')
I don't understand why can the noise be written as
r=randn(2,1)./sqrt(2.*SNR)
,why do we need to write as randn(2,1)./sqrt(2*SNR) instead of randn(1,1)/sqrt(2)?Is anyone know about this?

回答 (0 件)

カテゴリ

Help Center および File ExchangeCommunications Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by