MATLAB Answers

BER calculation BPSK simulation with Rayleigh channel

36 ビュー (過去 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;
% 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);
% Send signal over an AWGN channel.
snr = i + 10*log10(k) - 10*log10(nsamp);
% Apply channel object on the modulated data using the FILTER function
%%BER Calculation
ber = step(hError, x, demodData);
xlabel('Eb/No [dB]');
axis([0 EbNo(length(EbNo)) 1e-8 .9]);
title('Bit error probability curve for BPSK modulation');
legend ('BER');
grid on;

回答 (1 件)

Veera Kanmani
Veera Kanmani 2018 年 4 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by