📄 draw_ber.m
字号:
% QPSK System Simulation, Pe evaluation
clear all;
clc;
%AWGN
SNRindB1=0:0.1:8; % theoretical bit error rate
for i=1:length(SNRindB1),
SNR=exp(SNRindB1(i)*log(10)/10);
theo_err_prb(i)=0.5*erfc(sqrt(SNR));
end;
ebn01=0:2:8; % simulated bit error rates
smld_awgn=[5.000000e-002,3.000000e-002 ,1.250000e-002, ...
5.555556e-003,1.527778e-003];
% Plotting commands follow
semilogy(SNRindB1,theo_err_prb,'g');
hold on;
plot(ebn01,smld_awgn,'gs')
%Rayleigh
SNRindB2=0:0.1:30; % theoretical bit error rate
for ii=1:length(SNRindB2),
SNR_R=exp(SNRindB2(ii)*log(10)/10);
theo_err_prb_R(ii)=0.5*(1-1/sqrt(1+1/(SNR_R)));
end;
ebn02=0:2:24; % simulated bit error rates
smld_Rayleigh=[2.750000e-001,2.550000e-001,1.950000e-001,1.750000e-001,1.200000e-001,1.000000e-001,...
5.000000e-002,4.000000e-002,2.500000e-002,1.666667e-002,3.333333e-003,1.515152e-003,4.500000e-004];
% Plotting commands follow
semilogy(SNRindB2,theo_err_prb_R,'b');
plot(ebn02,smld_Rayleigh,'bo')
title('Performance of QPSK');
legend('QPSK AWGN (Theroy)','QPSK AWGN (Simulation)',...
'QPSK Rayleigh (Theroy)','QPSK Rayleigh (Simulation)');
xlabel('Eb/No(dB)');
ylabel('BER');
grid on;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -