hw2a.asv

来自「To calculation the BER of BPSK over AWG」· ASV 代码 · 共 24 行

ASV
24
字号
close all;
clear all;
clc
echo on
%Input snr_in_db for test
snr_in_db=0:0.2:10;
%thorey  BER
for i=1:length(snr_in_db)
    snr=10^(snr_in_db(i)/10);
    theory_Pe(i)=erfc(sqrt(snr))/2;
end
%simulated BER
for i=1:length(snr_in_db)
    simulated_Pe(i)=bpsk_over_awgn(snr_in_db(i));
    echo off;
end
%plot in log(db)
semilogy(snr_in_db,theory_Pe);
xlabel('SNR(dB)');
hold;
semilogy(snr_in_db, simulated_Pe,'*');

legend(' theoretical result',' simulated result');
hold off	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?