Simulation of BPSK in fading channels

I'm trying to simulate BPSK in a channel with Rayleigh fading and AWGN, then obtain the Bit Error Probability (BEP). My program is written in C.

I compared my BEP vs $\frac{E_b}{N_0}$ (SNR per bit) plot with one generated using the formula BEP = $\frac{1}{2}(1-\sqrt{\frac{\bar{\gamma_b}}{1+\bar{\gamma_b}}})$. It appears that my simulated BEP is always about twice that of the theoretical BEP.

In my simulation, the received BPSK signal model is given by $r(k) = \sqrt{E_s}\alpha e^{j\phi(k)}+n(k)$ where k is the time step, alpha is the Rayleigh distributed random variable, and n(k) is the noise due to AWGN.

$E[\alpha^2] = 2\sigma^2$, and $\alpha$ is generated as $\alpha = \sqrt{w_1^2 + w_2^2}$ where $w_1, w_2 \sim N(0,\sigma^2)$. Here, $\sigma^2 = 0.25$.

This is how my program is implemented.

1) Set the message phase in 2D (msg_phase[0] = 0.0, msg_phase[1] = $\pi$)

2) For different SNR values, do the following:

2a) Calculate $E_s = E_b = 10^\frac{SNR}{10} * N_0$

2b) Randomly select signal to transmit, with each signal equally likely to be sent.

2c) Generate $\alpha$ by first generating a pair of independent, zero-mean gaussian random variables with variance equal to 0.25, then setting $\alpha$ based on the equation above.

2d) Generate another pair of independent standard gaussian random variables as AWGN.

2e) Set the received signal to ($\alpha$ * transmitted_signal + AWGN noise)

2f) Calculate the received signal magnitude and phase as follows:

$\text{Magnitude} = \sqrt{\text{Rx}_0^2 + \text{Rx}_1^2}$

$\text{phase} = \text{tan}^{-1}\frac{\text{Rx}_1}{\text{Rx}_0}$

They are used in my receiver decision.

2g) Receiver decision. For incorrect decision, count the number of error bits.

Repeat Step 2b to 2g until 500 error bits are obtained, then calculate BEP.

The same code was used to simulate differential BPSK and the results matched the formula for BDPSK. The received signal model for the differential simulations is $r(k) = \sqrt{E_s}\alpha e^{j(\phi(k)+\theta)}+n(k)$, so I've basically used the same code but with $\theta = 0$ and the generation of $\alpha$.

I don't know why my BEP is twice the BEP obtained from the formula.

I've seen a few Matlab simulations that do something called "equalization" to remove the fading effect at the receiver, before computing the decision metric.

For example,

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);


I don't do that, but is that necessary? As the Matlab simulations are implemented rather differently from my program, I'm not sure how the "equalization" would work for my case.

• A note about "equalization". It has absolutely nothing to do with MATLAB. Equalizer is a part of the receiver. You yourself need to determine if the system you're simulating has an equalizer at the receiver, and if it does, what kind of equalizer. As you noted, equalizer is placed in the receiver block diagram before the decision element, so that the output of the EQ does into the decision element. That's how it attempts to deal with fading and other troubles. Commented Feb 22, 2016 at 17:45
• So for fading channels, it is necessary to do this equalization before the decision element? How it is done when my fading effect is due to the $\alpha$ variable? Commented Feb 22, 2016 at 17:48
• As I mentioned, whether you do equalization or not is property of your receiver. If you want an ultra-cheap receiver and have transmit power, you don't do equalization. If you have money for receiver, but have limited transmit power, you do equalization. Equalization for Rayleigh channels is such a big topic that there are many books written and countless articles/patents about it. I can't explain that in a comment. Commented Feb 22, 2016 at 17:59
• My advice now is to try to look up some equalization articles for Rayleigh fading. Usually, they'll have comparison of EQs with theoretical BER, BER without equalization and BER with different types of equalizers and different modulations. This way, you'll be able to compare your results and then see if they're making sense and if it's just the lack of equalization. Unfortunately, I'm too tired now to think, so I can't give you any useful starting points. Commented Feb 22, 2016 at 18:00