📄 relationship between snr and eb_n0.txt
字号:
%what in world is the relationship between SNR and Eb/N0
%Eb/N0=1/(2*r*(sigma)^2)
clc
clear all
%close all
givenSNR=[1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10] %dB
r=1;
k=5000000;
Eb_N0=10.^(givenSNR./10);
sigma=(1./(2*r.*Eb_N0).^0.5)
source=1-2*randint(1,k,[0,1]);
for noise_i=1:length(givenSNR)
noise=sigma(noise_i)*randn(1,k);
receive=source+noise;
error_num=0;
for i=1:k
if receive(i)>0&&source(i)==-1||receive(i)<0&&source(i)==1
error_num=error_num+1;
end
end
error_rate(noise_i)=error_num/k;
end
hold on
grid minor
semilogy(givenSNR,error_rate,'g')
%what in world is the relationship between SNR and Eb/N0
%Eb/N0=1/(2*r*(sigma)^2)
clc
clear all
%close all
givenSNR=[1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10] %dB
r=1;
k=5000000;
Eb_N0=10.^(givenSNR./10);
sigma=(1./(2*r.*Eb_N0).^0.5)
source=1-2*randint(1,k,[0,1]);
for noise_i=1:length(givenSNR)
noise=sigma(noise_i)*randn(1,k);
receive=source+noise;
error_num=0;
for i=1:k
if receive(i)>0&&source(i)==-1||receive(i)<0&&source(i)==1
error_num=error_num+1;
end
end
error_rate(noise_i)=error_num/k;
end
hold on
grid minor
semilogy(givenSNR,error_rate,'g')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -