# BER calculation BPSK simulation with Rayleigh channel

조회 수: 38(최근 30일)
Den 2011년 8월 9일
답변: Veera Kanmani 2018년 4월 20일
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

댓글을 달려면 로그인하십시오.

### 답변(1개)

Veera Kanmani 2018년 4월 20일
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!