007 - Bit Error Rate
007 - Bit Error Rate
by Krishna Sankar on August 5, 2007 ShareThis In this post, we will derive the theoretical equation for bit error rate (BER) with Binary Phase Shift Keying (BPSK) modulation scheme in Additive White Gaussian Noise (AWGN) channel. The BER results obtained using Matlab/Octave simulation scripts show good agreement with the derived theoretical results. With Binary Phase Shift Keying (BPSK), the binary digits 1 and 0 maybe represented by the analog levels and respectively. The system model is as shown in the Figure below.
Channel Model
The transmitted waveform gets corrupted by noise Gaussian Noise (AWGN). , typically referred to as Additive White
Additive : As the noise gets added (and not multiplied) to the received signal White : The spectrum of the noise if flat for all frequencies. Gaussian : The values of the noise with follows the Gaussian probability distribution function, and .
1
Figure: Conditional probability density function with BPSK modulation Assuming that and decision boundary. are equally probable i.e. , the threshold 0 forms the optimal
was
was
i.e. and .
was transmitted
is transmitted is (the area in blue region):
was transmitted
is transmitted is (the area in green region):
.
3
Simulation model
Matlab/Octave source code for computing the bit error rate with BPSK modulation from theory and simulation. The code performs the following: (a) Generation of random BPSK modulated symbols +1s and -1s (b) Passing them through Additive White Gaussian Noise channel (c) Demodulation of the received symbol based on the location in the constellation (d) Counting the number of errors (e) Repeating the same for multiple Eb/No value. Click here to download Matlab/Octave script for simulating BER for BPSK modulation in AWGN chnanel.
Figure: Bit error rate (BER) curve for BPSK modulation theory, simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Creative Commons
% % % % % % % % % % % % % % % % % % % % % % % % %
Attribution-Noncommercial 2.5 India You are free: to Share to copy, distribute and transmit the work to Remix to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial. You may not use this work for commercial purposes. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights. http://creativecommons.org/licenses/by-nc/2.5/in/ Script for simulating binary phase shift keyed transmission and reception and compare the simulated and theoretical bit error probability Checked for proper operation with Octave Version 3.0.0 Author : Krishna Email : [email protected] Version : 1.0 Date : 5 August 2007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear N = 10^6 % number of bits or symbols rand('state',100); % initializing the rand() function randn('state',200); % initializing the randn() function % Transmitter ip = rand(1,N)>0.5; % generating 0,1 with equal probability s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0 n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance Eb_N0_dB = [-3:10]; % multiple Eb/N0 values for ii = 1:length(Eb_N0_dB) % Noise addition y = s + 10^(-Eb_N0_dB(ii)/20)*n; % additive white gaussian noise % receiver - hard decision decoding ipHat = real(y)>0; % counting the errors nErr(ii) = size(find([ip- ipHat]),2); end simBer = nErr/N; % simulated ber
theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber % plot close all figure semilogy(Eb_N0_dB,theoryBer,'b.-'); hold on semilogy(Eb_N0_dB,simBer,'mx-'); axis([-3 10 10^-5 0.5]) grid on legend('theory', 'simulation'); xlabel('Eb/No, dB'); ylabel('Bit Error Rate'); title('Bit error probability curve for BPSK modulation');
is called a Rayleigh random variable. This model, called Rayleigh fading channel model, is reasonable for an environment where there are large number of reflectors.
System model
The received signal in Rayleigh fading channel is of the form, , where is the received symbol, is complex scaling factor corresponding to Rayleigh multipath channel is the transmitted symbol (taking values +1s and -1s) and is the Additive White Gaussian Noise (AWGN) Assumptions 1. The channel is flat fading In simple terms, it means that the multipath channel has only one tap. So, the convolution operation reduces to a simple multiplication. For a more rigorous
7
discussion on flat fading and frequency selective fading, may I urge you to review Chapter 15.3 Signal Time-Spreading from [DIGITAL COMMUNICATIONS: SKLAR] 2. The channel is randomly varying in time meaning each transmitted symbol gets multiplied by a randomly varying complex number . Since is modeling a Rayleigh channel, the real and imaginary parts are Gaussian distributed having mean 0 and variance 1/2. 3. The noise has the Gaussian probability density function with
with
and
4. The channel is known at the receiver. Equalization is performed at the receiver by dividing the received symbol by the apriori known i.e.
However in the presence of channel , the effective bit energy to noise ratio is bit error probability for a given value of is,
. So the
where
To find the error probability over all random values of , one must evaluate the conditional probability density function over the probability density function of . Probability density function of From our discussion on chi-square random variable, we know that if is a Rayleigh distributed is chi is,
random variable, then is chi-square distributed with two degrees of freedom. since square distributed, is also chi square distributed. The probability density function of
. Note: 1. I have not yet figured out the math to reduce the above integral to the answer. If some one knows, kindly drop in a comment. 2. Another way for finding the bit error rate might be to find the pdf of . However, I do not know how to find pdf following the division of two random variables.
Simulation Model
It will be useful to provide a simple Matlab/Octave example simulating a BPSK transmission and reception in Rayleigh channel. The script performs the following
9
(a) Generate random binary sequence of +1s and -1s. (b) Multiply the symbols with the channel and then add white Gaussian noise. (c) At the receiver, equalize (divide) the received symbols with the known channel (d) Perform hard decision decoding and count the bit errors
Click here to download Matlab/Octave script for BER computation of BPSK in Rayleigh fading channel
Figure: BER plot of BPSK in Rayleigh fading channel When compared to the AWGN case, around 25dB degradation due to the multipath channel (at the point). This is both good and bad: bad because we need to spend so much energy to get a reliable wireless link up (in this era of global warming), and good because we signal processing engineers are trying to figure out ways for improving the performance.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % All rights reserved by Krishna Pillai, http://www.dsplog.com % The file may not be re-distributed without explicit authorization % from Krishna Pillai.
10
% % % % % %
Checked for proper operation with Octave Version 3.0.0 Author : Krishna Pillai Email : [email protected] Version : 1.0 Date : 8 August 2008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Script for computing the BER for BPSK modulation in a % Rayleigh fading channel clear N = 10^6 % number of bits or symbols % Transmitter ip = rand(1,N)>0.5; % generating 0,1 with equal probability s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0 Eb_N0_dB = [-3:35]; % multiple Eb/N0 values for ii = 1:length(Eb_N0_dB) n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel % Channel and noise Noise addition y = h.*s + 10^(-Eb_N0_dB(ii)/20)*n; % equalization yHat = y./h; % receiver - hard decision decoding ipHat = real(yHat)>0; % counting the errors nErr(ii) = size(find([ip- ipHat]),2); end simBer = nErr/N; % simulated ber theoryBerAWGN = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber EbN0Lin = 10.^(Eb_N0_dB/10); theoryBer = 0.5.*(1-sqrt(EbN0Lin./(EbN0Lin+1))); % plot close all figure semilogy(Eb_N0_dB,theoryBerAWGN,'cd-','LineWidth',2); hold on semilogy(Eb_N0_dB,theoryBer,'bp-','LineWidth',2); semilogy(Eb_N0_dB,simBer,'mx-','LineWidth',2); axis([-3 35 10^-5 0.5])
11
grid on legend('AWGN-Theory','Rayleigh-Theory', 'Rayleigh-Simulation'); xlabel('Eb/No, dB'); ylabel('Bit Error Rate'); title('BER for BPSK modulation in Rayleigh channel');
, where
. The resulting BER in a communications sytem in the presence of a channel , for any random
values of , must be calculated evaluating the conditional probability density function over the probability density function of .
12
and
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:
In the following steps we will use the next also straightforward results:
In total, we want to derive the following integral, which can be solved by parts:
13
Lets find the last term applying the previous result for the erf function, and doing a change of variable:
With the above demonstration, we can easily derive the BER for a Rayleigh channel using BPSK modulation:
.
This forms the proof for BER for BPSK modulation in Rayleigh channel.
by Krishna Sankar on July 17, 2008 ShareThis In the post on Rayleigh channel model, we stated that a circularly symmetric random variable is of the form , where real and imaginary parts are zero mean independent and identically distributed (iid) Gaussian random variables. The magnitude which has the probability density,
is called a Rayleigh random variable. Further, the phase is uniformly distributed from . In this post we will try to derive the expression for probability density function (PDF) for and . The text provided in Section 5.4.5 of [ELECTRONIC-COMMUNICATION:PRADIP] is used as reference.
Joint probability
The probability density function of is
. As and are independent random variables, the joint probability is the product of the individual probability, i.e,
. The joint probability that the random variable variable lies between and is, lies between and and the random
.
15
Figure: Cartesian co-ordinate to polar co-ordinate The area form. is Cartesian co-ordinate form is equal to the area in the polar co-ordinate
16
Since and are independent, the individual probability density functions are,
Simulation Model
Simple Matlab/Octave simulation model is provided for plotting the probability density of and . The script performs the following: (a) Generate two independent zero mean, unit variance Gaussian random variables (b) Using the hist() function compute the simulated probability density for both and
(c) Using the knowledge of the equation (which we just derived), compute the theoretical probability density function (PDF) (d) Plot the simulated and theoretical probability density functions (PDF) and show that they are in good agreement. Click here to download Matlab/Octave script for simulating the probability density function (PDF) of Rayleigh random variable
17
18
Multipath environment
In a multipath environment, it is reasonably intuitive to visualize that an impulse transmitted from transmitter will reach the receiver as a train of impulses.
Figure: Impulse response of a multipath channel Let the transmit bandpass signal be, , where is the baseband signal, is the carrier frequency and is the time. As shown above, the transmit signal reaches the receiver through multiple paths where the path has an attenuation and delay . The received signal is,
. Plugging in the equation for transmit baseband signal from the above equation,
19
20
The statistics of a circularly symmetric complex Gaussian random variable is completely specified by the variance, . The magnitude which has a probability density,
is called a Rayleigh random variable. This model, called Rayleigh fading channel model, is reasonable for an environment where there are large number of reflectors.
21