BER calculation BPSK simulation with Rayleigh channel

16 visualizzazioni (ultimi 30 giorni)
Den
Den il 9 Ago 2011
Risposto: Veera Kanmani il 20 Apr 2018
Hello! I am writing the simulaton code for BPSK simulation with Rayleigh channel.My results are far from the theoretical. If anyone can help me to find the problem, I'll apreciate.
Many thanks, Den.
Here is my code:
function [ bs ] = bpskray2 ( EbNo )
% Define parameters.
M = 2; % Size of signal constellation
k = log2(M); % Number of bits
per symbol
n = 3e6; % Number of bits to process = 3,000,000
nsamp = 1; % Oversampling rate
%%Signal Source
% Create a binary data stream
data = randint(n,1); % Random binary data stream
% Create an Rayleigh channe object
rayChanObj = rayleighchan;
rayChanObj
% Create an error rate calculator
hError = comm.ErrorRate;
% Create a BPSK modulator System object
hModulator = comm.BPSKModulator;
% Create a BPSK demodulator System object
hDemodulator = comm.BPSKDemodulator;
for i= 0:EbNo
% Modulate the data
modData = step(hModulator, data);
%%Channel
% Send signal over an AWGN channel.
snr = i + 10*log10(k) - 10*log10(nsamp);
noisysig=awgn(modData,snr);
% Apply channel object on the modulated data using the FILTER function
txdatach=filter(rayChanObj,noisysig);
%%Demodulation
demodData=step(hDemodulator,txdatach);
%%BER Calculation
ber = step(hError, x, demodData);
EBNO(i+1)=i
BER(i+1)=ber(1)
end;
semilogy(EBNO,BER);
xlabel('Eb/No [dB]');
ylabel('BER');
axis([0 EbNo(length(EbNo)) 1e-8 .9]);
title('Bit error probability curve for BPSK modulation');
legend ('BER');
grid on;
end

Risposte (1)

Veera Kanmani
Veera Kanmani il 20 Apr 2018
https://in.mathworks.com/matlabcentral/fileexchange/30477-ber-curve-for-bpsk-in-rayleigh-channel?focused=5186361&tab=function

Community Treasure Hunt

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

Start Hunting!

Translated by