Articles

# Derivation of BPSK BER in Rayleigh channel

This is a guest post by Jose Antonio Urigüen who is an Electrical and Electronic Engineer currently studying an MSc in Communications and Signal Processing at Imperial College in London. This guest post has been created due to his own curiosity when reviewing some concepts of BER for BPSK in Rayleigh channnel published in the dsplog.com

From the post on BER for BPSK in Rayleigh channnel, it was shown that, in the presence of channel $h$, the effective bit energy to noise ratio is $\frac{|h|^2E_b}{N_0}$.

The bit error probability for a given value of $h$is,

$P_{b|h}=\frac{1}{2}erfc\left({\sqrt{\frac{|h|^2E_b}{N_0}}}\right)=\frac{1}{2}erfc\left(\sqrt{\gamma}\right)$, where

$\gamma = \frac{|h|^2E_b}{N_0}$ .

The resulting BER in a communications sytem in the presence of a channel $h$, for any random values of $|h|^2$, must be calculated evaluating the conditional probability density function $P_{b|h}$ over the probability density function of $\gamma$.

$P_{b}=\int_0^\infty\frac{1}{2}erfc\left(\sqrt{\gamma}\right)p\left(\gamma\right)d\gamma$ where,

the probability density function of $\gamma$ is

$p\left(\gamma\right) = \frac{1}{\bar{\gamma}}e^{\frac{-\gamma}{\bar{\gamma}}},\ \gamma \ge 0$ and $\bar{\gamma} = \frac{E_b}{N_0}$.

First, we are going to derive the result for the definite integral using a different notation, and then we will apply the result to the concrete expression obtained for the BER.

Using the definitions for the ‘erfc’ and ‘erf’ functions, we can directly compute the first derivative:

$erfc(x) = \frac{2}{\sqrt{\pi}}\int_x^{\infty}e^{-t^2}dt$

$erf(x) = \frac{2}{\sqrt{\pi}}\int_0^{x}e^{-t^2}dt$

$\frac{d}{dx}erf(x) = -\frac{2}{\sqrt{\pi}}e^{-x^2}$

And also the definite integral, simply calculating it by parts:

$\begin{eqnarray}\int erfc(x) dx & = & x erfc(x) + \int x \frac{2}{\sqrt{\pi}}e^{-x^2}dx \\
& = & x erfc(x) -\frac{1}{\sqrt{\pi}}e^{-x^2}\end{eqnarray}$

In the following steps we will use the next also straightforward results:

$\frac{d}{dx} erfc (\sqrt{x}) = -\frac{1}{\sqrt{\pi}}e^{-x}x^{-1/2}$

$\frac{d}{dx} erf (\sqrt{x}) = \frac{1}{\sqrt{\pi}}e^{-x}x^{-1/2}$

In total, we want to derive the following integral, which can be solved by parts:
$\int erfc(\sqrt{x})e^{-\frac{x}{a}}dx = -a erfc({\sqrt{x}})e^{-\frac{x}{a}} - \int (-a)e^{-\frac{x}{a}} (-)\frac{1}{\sqrt{\pi}}e^{-x}x^{-\frac{1}{2}}dx$

Lets find the last term applying the previous result for the ‘erf’ function, and doing a change of variable:

$\begin{eqnarray}\int e^{-\frac{x}{a}}e^{-x}x^{-\frac{1}{2}}dx & = & \int e ^{-x\left(\frac{a+1}{a}\right)}x^{-\frac{1}{2}}dx\\ & = & \int e^{-u} \left(\frac{a}{a+1}\right)^{-\frac{1}{2}}u^{-\frac{1}{2}}\left(\frac{a}{a+1}\right)du\\ & = & \left(\frac{a}{a+1}\right)^{\frac{1}{2}} \int e^{-u}u^{-\frac{1}{2}}du\\ & = & \sqrt{\pi}\sqrt{\frac{a}{a+1}} erf(\sqrt{u})\\&=&\sqrt{\pi}\sqrt{\frac{a}{a+1}} erf\left(\sqrt{\frac{a+1}{a}}\sqrt{x}\right)\end{eqnarray}$.

Finally, we conclude the expected result:
$\begin{eqnarray}\int erfc (\sqrt{x}) e^{-\frac{x}{a}}dx & = &-a erfc(\sqrt{x})e^{-\frac{x}{a}}-\frac{a}{\sqrt{\pi}}\sqrt{\pi}\sqrt{\frac{a}{a+1}}erf\left(\sqrt{\frac{a+1}{a}}\sqrt{x}\right)\\ & = & -a erfc(\sqrt{x})e^{-\frac{x}{a}}-{a}\sqrt{\frac{a}{a+1}}erf\left(\sqrt{\frac{a+1}{a}}\sqrt{x}\right) \end{eqnarray}$

With the above demonstration, we can easily derive the BER for a Rayleigh channel using BPSK modulation:

$\begin{eqnarray}P_{b} & = & \frac{1}{2\bar{\gamma}}\int_0^{\infty} erfc (\sqrt{\gamma}) e^{-\frac{\gamma}{\bar{\gamma}}}d\gamma \\ & = & \frac{1}{2\bar{\gamma}}\left[\bar{\gamma}erfc(\sqrt{\gamma})e^{-\frac{\gamma}{\bar{\gamma}}} + \bar{\gamma}\sqrt{\frac{\bar{\gamma}}{\bar{\gamma}+1}}erf\left(\sqrt{\frac{\bar{\gamma}}{\bar{\gamma}+1}}\sqrt{{\gamma}}\right) \right]_\infty^0\\ & = & \frac{1}{2} \lef(1-\sqrt{\frac{\bar{\gamma}}{\bar{\gamma}+1}}\right)\\ & = & \frac{1}{2} \lef(1-\sqrt{\frac{(E_b/N_0)}{(E_b/N_0)+1}}\right)\end{eqnarray}$.

This forms the proof for BER for BPSK modulation in Rayleigh channel. 🙂

## 49 thoughts on “Derivation of BPSK BER in Rayleigh channel”

1. Shawn says:

Great work. Thank you very much.

2. moonriver says:

Hi sir… i am doing ofdm for my thesis. I want to ask if BER for flat fading Rayleigh channel is similar to Rayleigh flat fading with OFDM…?

Thank you

3. krishna says:

hi sir,

iam trying to do ber for bpsk with differential stbc using matlab.

can you help me with this.

1. @krishna: Sorry, I have not discussed differential STBC in any posts till date.

4. SHAKSHI says:

I HAVE TRIED FOR MIMO ESTIMATION AS WELL AS OFDM BUT WEN BOTH WOULD BE TRIED AT THE SAME TIME I HAVE TO INVOLVE THE STBC I AM NOT CLER WITH THAT

THANKS

5. SHAKSHI says:

Respected sir,

I am working on channel estimation for mimo-ofdm system using pilot method

I have worked on ofdm system as well as mimo

but i am having problem with pilot method involving both

can u plz give me guidance

1. SHAKSHI says:

I HAVE TRIED FOR THE PILOT CHANNEL OFDM SYSTEM & MIMO BUT WEN BOTH USED AT THE SAME TIME STBC SHOULD BE INVOLVED & I AM HAVING PROB WITH IT

THANKS

1. @SHAKSHI: Well, ok. But, what is the problem and how did you solve it?

6. SHITAL BHATT says:

RESPECTED SIR,
I M WORKING ON PILOT BASED CHANNEL ESTIMATION FOR MIMO SYSTEM
IN IT I HV TO COMPARE ML & MMSE

CAN U PLEASE HELP ME

7. samta says:

hi..
please tell me what if i need expression of probability of error(BER) for QPSK,in presence of rayleigh fading(you have done for BPSK).
thanks in advance. 🙂

8. Mohammed says:

Hi all
could you please help me to get the simulation code for the BER in rayleigh channel with BPSK …thank you very much indeed
Regards

9. student says:

Hello

I am working on a paper in which i am trying to plot ber for bpsk using rayleigh channel. but, the thing is, i need to use estimated SNR including the pilot symbols and noise samples as parameters. I tried with the corresponding SNR estimate equations in the paper, but, i am experiencing constant BER.
I have followed the same steps posted by you in “BER for BPSK in Rayleigh channel” to produce the rayleigh output and later used estimated SNR to calculate BER, so that i can vary pilot symbols(N) and Noise samples(L). But, i am stuck. can you please refer my paper and guide me, whether i am in right way..??
http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=01437347&tag=1

1. @student: Sorry, due to time constraints I wont be able to help with the coding part. Good luck.

10. mahesh gupta says:

my topic is walsh coded time domain mimo channel estimation.i face difficulty in programing of multipath rayleigh fading channel.in this their are 2 transmitter and 2 receiver and 6 path rayleigh fading channel.so in the paper delay and gain for 6 path is given for transmitter 1 to receiver 1 ,transmitter 2 to receiver 1 ,transmitter 1 to receiver 2 ,transmitter 2 to receiver 2.i can not do the program for this.and also i can not understand where to put the walsh code.if possible then please give me program for mimo ofdm channel estimation.the name of reference paper is ‘walsh coded training signal aided time domain channel estimation for mimo ofdm systems.

1. @mahesh gupta: Well, there are multiple aspects to the problem which you are stating. Let me try to break this down for you
(if you have not done that already):
a) Try to get the simulation up for a one transmit one receive ofdm system in a rayleigh fading channel. Hopefully the post on https://dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/ might be of help
b) Try to get a 2 transmit 2 receive mimo channel simulation up and running. Hope this post might be of help
https://dsplog.com/2008/10/24/mimo-zero-forcing/
c) Try to combine (a) and (b) i.e. perform 2 x 2 MIMO link with OFDM
d) In (c), the channel is assumed to be known. Apply your proposed Walsh coding to estimate the channel sequence.

Good luck.

11. sara says:

you can help me in simulation for calculate BER in selective frequency fading channel in OFDM

12. Ahsan says:

i have learned alot from your SNIPPETS you leave here and there..
🙂
kindly write one for the explanation of this CIR as well, and if possible, the translation of these parameters into dBs or something
bestest regards

13. Ahsan says:

Thanx, i got what you said
just one thing, how do you define the CIR parameters defined
like i know its freq response is a deep null…
but what does it imply in terms of the number of multipaths? and does it take into consideration, the rms delay as well?
i know how the filter command works, just want to know whats the relevance of the values and the number of values in CIR

14. Ahsan says:

im stuck with frequency selective fading aspect of my project
today i went to see my supervisor
to show her the codes i had and the results(which are a bit off target in terms of Eb/No)
supervisor gave me hell
asking me why i had not implemented frequency selective fading
now she wants me to do this
IMPLEMENT A CHANNEL THAT EXHIBITS FREQUENCY SELECTIVE FADING!!!

now consider the code below!

% ——————————————————————- %
% Parameters Declaration %
% ——————————————————————- %
% Initialize the parameters
FrameNum = input(‘number of frames transmitted is(default=5000) =’);
if isempty(FrameNum)
FrameNum = 5;
end
FrameSize = input(‘size of each frame is(default=256) =’);
if isempty(FrameSize)
FrameSize = 256;
end
Chan =input(‘channel IR is(default=[0.227 0.46 0.688 0.46 0.227]) =’);
if isempty(Chan)
Chan = [0.227 0.46 0.688 0.46 0.227]; !!!!!!!!!!!!!!===============
end
CPLen = FrameSize/8;
% ——————————————————————- %
% Generate Transmit Signal & BPSK Modulation %
% ——————————————————————- %
% generate the random binary stream for transmitting
BitsTranstmp = randint(1,FrameNum*FrameSize);
% modulate ,generate the BPSK symbols
Table=[-1 1];
% After the step upon,Table = [-1.0000-0.0000i 1.000]
BitsTrans = Table(BitsTranstmp+1);
% ——————————————————————- %
% Add CP %
% ——————————————————————- %
% the function RESHAPE is to rearrange the BitsTrans to add cp for con-
% venience
AddCPtmp = reshape(BitsTrans,FrameSize,FrameNum);
AddCP = zeros(FrameSize+CPLen,FrameNum);
AddPrefix = FrameSize-CPLen+1:FrameSize;
% the matrix below is as the same function of add cp to each frame one
% by one
AddCP = [AddCPtmp(AddPrefix,:);AddCPtmp];
% ——————————————————————- %
% Go Through The Channel %
% ——————————————————————- %
RecChantmp = filter(Chan,1,AddCP); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!====================

notice the two lines with the marks of exclamation followed by ========= sign
first one
there is some declaration of CIR parameters which are applied to our bits to be sent in the second HILIGHTED command
now
what exactly is the function of doing this??
and how this affects our data??

now the task she has given me is…
implement freuency selective fading…
i have no idea of how to achieve that…

at present, just help me with the frequency selective part!
howto implement a channel that exhibits frequency fading……..
HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP!!!!!!!!!!!!!!????????????

1. @Ahsan: Though I do not understand your code completely, some suggestions will be
a/ Oversample your transmit signal (i.e insert zeros between your samples) and then pass it through a filter which does not cause inter symbol interference. Make your AddCP variable a single row vector.
The post on https://dsplog.com/2008/04/14/transmit-pulse-shape-nyquist-sinc-rectangular/
b/ The filter() command looks correct. The frequency selective fading channel can indeed be modeled as a filter.

15. yazeed Kh says:

Hi;
what about DPSK instead of BPSK, and how i can generate DPSK sequence?
tahnk u

16. farrakh says:

thnx krishna for emil me the ebook.
do u have BER equations of different modulations in other wireless channels(rayleigh,nakagami) plz send me if u have. and plz tell me if u have any type of simulations in nakagami_m channel.

thkx

1. @farrakh: I have mailed you the instructions to obtained the e-Book.
Sorry, I have not posted on Nakagami channel.

17. leth says:

i do this paper
“An Adaptive Modulation Scheme for Simultaneous
Voice and Data Transmission over Fading Channels
Mohamed-Slim Alouini, Member, IEEE, Xiaoyi Tang, and Andrea J. Goldsmith, Member, IEEE”

i make for example figure 10, i need how to make figure 10 in simulation(monte carlo) ?

regards

18. leth says:

thanks for replay, can you tell me as steps how to do that

thanks in advance

1. @leth: I have not tried modeling adaptation myself. Hence I am unable to provide you with precise steps. Good luck in your investigations.

19. leth says:

can you tell me how to make adaptive modulation ?

regards

1. @leth: I do not have a code combining BPSK/QPSK/QAM etc to do adaptive modulation. However, you may find individual posts describing these modulation schemes @ https://dsplog.com/2008/10/01/download-free-e-book/
As you said, one way to make an adaptive modulation scheme is to define a BER threshold (lets say 10^04) to switch from one modulation scheme to another.

20. MsBee says:

Can you help me out with the similar expression for the ber over a rician channel?
Also the expresssion for the ber for rayleigh channel those it still hold for both bpsk and qpsk modulation over this channel?
Thanks.

1. @MsBee: My replies:
1/ Sorry, I have not tried modeling Rician channel.
2/ BER vs EB/N0 should be same for both QPSK and BPSK

21. shomapto says:

i need matlab code for an ofdm system using rayleigh fading channel

1. nirmaladevi rangisetty says:

iam need of what is the use of non gaussian noise in channels

22. oyou says:

Hi sir,

thanks a lot!

i’m try to realize the method mentioned in Cui’s paper in “Energy-Efficiency of MIMO and Cooperative MIMO Techniques in Sensor Networks”.
In this paper, Cui writes “we find the required average Eb by evaluating average Pb over 10000 randomly generated channel samples according to (6)(just like the 1st equation in your article) at each transmission distance and then invertion to obtain the average Eb that yields the desired average Pb”.
I can’t understand how i can get average Eb from average Pb and how i can get Pb without knowing average Eb…(*_*!) using matlab…
Please help me…

1. @oyou: Well, given that you know the value of channel gain h, transmission power Eb, and noise power N0, we can compute the resultant Eb/N0 for each channel realization. If we average over all channel realizations, we get the average BER.
Agree?

1. oyou says:

Thanks for your reply.

I agree what you said. But what i want to ask is: given average BER, N0 in flat Rayleigh-fading channel, how can i calculate average Eb?

1. @oyou: Given that average BER = function of average Eb/N0, maybe we can back-calculate?

23. wil says:

thanks i need it too,..

24. debabandana says:

hello sir
sir my work is in antenna-diversity(MIMO).i have to find SNR~Pe of different diversity scheme(sc,mrc,egc).using bpsk modulation i have to proceed.but i am unable to do that.
please help me.

25. lia says:

thanks a lot!!
this is a great help!
i’ve been trying to work this out ever since the post on BER for Rayleigh – till the point of give up!
love all dsplog.com publish!

1. @lia: Thanks, Jose for providing the proof to be published in dsplog.com ! 🙂