hw2b.m

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

M
25
字号
close all;
clear all;
clc
echo on
%Input snr_in_db for test
snr_in_db=0:0.5:14;
%thorey  BER
for i=1:length(snr_in_db)
    snr=10^(snr_in_db(i)/10);
    theory_Pe(i)=(1-sqrt(snr/(1+snr)))/2;
     echo off;
end
%simulated BER
for i=1:length(snr_in_db)
    simulated_Pe(i)=RayleighAWGN(snr_in_db(i));
    echo off;
end
%plot in log(db)
semilogy(snr_in_db,theory_Pe);
xlabel('SNR(dB)');
ylabel('BER');
hold;
semilogy(snr_in_db, simulated_Pe,'*');
legend(' theoretical result',' simulated result');
hold off	

⌨️ 快捷键说明

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