In BER SIMULATION of BPSK IN RAYLEIGH FADING ENVIRONMENT when I place h=sqrt(1/2)*(randn+j*randn) before while loop I don't get any curve and total BER result why is that ?
2 次查看(过去 30 天)
显示 更早的评论
clear
EbN0dB_vector=0:2:20
Eb=1;
for snr_i=1:length(EbN0dB_vector);
EbN0dB=EbN0dB_vector(snr_i);
EbN0=10.^(EbN0dB/10)
N0=Eb/EbN0;
sym_cnt=0
err_cnt=0
h=sqrt(1/2)*(randn+j*randn);
while err_cnt<500
s=sqrt(Eb)*sign(rand-0.5) ;
n=sqrt(N0/2)*(randn+j*randn);
r=h*s + n;
D=r*exp(-j*angle(h));
s_hat=sign(real(D));
if s_hat~=s
err_cnt=err_cnt+1;
end
sym_cnt=sym_cnt+1;
end
BER(snr_i)=err_cnt/sym_cnt
end
figure
semilogy(EbN0dB_vector, BER)%y in logarithm scale
xlabel('E_b/N_0 [dB]')
ylabel('BER')
grid
%Get result upto this
BER =
0.0543 0.0001 0.0057 0.0008 0.0007 0.0031 0.0049
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 BPSK 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!