📄 draw_ber.asv
字号:
% QPSK System Simulation, Pe evaluation
clear all;
clc;
%AWGN
SNRindB1=0:0.1:10; % 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:10; % simulated bit error rates
smld_awgn=[5.000000e-002,3.000000e-002 ,1.250000e-002 ...
5.555556e-003,1.527778e-003,2.500000e-004];
% Plotting commands follow
semilogy(SNRindB1,theo_err_prb,'g');
hold on;
plot(ebn01,smld_awgn,'gs')
%Rayleigh
SNRindB2=0:0.1:20; % 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:20; % simulated bit error rates
smld_Rayleigh=[3.550000e-001,2.900000e-001,2.200000e-001,2.300000e-001,1.600000e-001,...
9.500000e-002,6.250000e-002,1.833333e-002,1.000000e-002,1.666667e-003,3.000000e-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 + -