#Bertool# What theorical formula does bertool use?

6 views (last 30 days)

I carried out a simulation about BPSK-Awgn. But there is a 3dB difference between the bertool theory curve and the simulation curve. So I think maybe because bertool use the theorical formula of Match filtered which is while the theorical formula of my code is because I didn't use MF. This reason seems good.
clc
N = 1e8; % number of bits or symbols
Eb_N0_dB = 0:25; % multiple Eb/N0 values
nErr = zeros(1,length(Eb_N0_dB));
Power_noise= nErr;
for ii = 1:length(Eb_N0_dB)% Number of SNR
% Transmitter
ip = randi([0,1],1,N); % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0
% n = 1/sqrt(2)*(randn(1,N) + 1j*randn(1,N)); % white gaussian noise, 0dB variance, multiplied by 1/sqrt(2) to make the power be 1
% h = 1/sqrt(2)*(randn(1,N) + 1j*randn(1,N)); % Rayleigh channel,each of the symbol lasts for two symbol length
n = randn(1,N); % white gaussian noise, 0dB variance
h = ones(1,N);
% Channel and noise Noise addition
y = h.*s + 10^(-Eb_N0_dB(ii)/20)*n;
y = y./h;
ipHat = real(y)>0;
% counting the errors
nErr(ii) = size(find(ip- ipHat),2);
end
simBer = nErr/N; % simulated ber
semilogy(Eb_N0_dB,simBer,'b+-','LineWidth',2);
hold on;
grid on
legend('BER-SNR');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('BER for BPSK (and Awgn)');
But when I carry out simulation about Rayleigh channel, the code of which you can see in the annotation, the curve matches the theorical curve of it. But they shouldn't match if the bertool use the MF curve.
This makes me confused. Thanks in advance!

Categories

Find more on Propagation and Channel Models in Help Center and File Exchange

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!