lundi 17 septembre 2018

Plot Bit-Error-rate (BER) vs Eb_N0 of a discrete BPSK signal passed through integrator in MATLAB

I am a novice to communication systems but I am in need to solve this question. I would appreciate inputs in this regard. Apologies if you my question lengthy.

I have a BPSK signal such that the input to a low pass filter(LPF) is of the form

s(k) = A + nk (read n subscript k where k = 0,1...)

where A is a constant and nk, k=0,1....are independent zero-mean normal random variables with variance σ2.
Suppose the LPF is an integrator of the form

y=  1/N { ∑(k=0 to N-1)[s(k)] }  ( read ∑ from k = 0 as lower bound to N-1 as upper bound)

After applying this LPF the output y is a test statistic with bit-energy-tonoise ratio Eb/N0. We know that for BPSK the probability that we make a wrong decision using this test statistic is Pb = theoretical BER = 0.5 erfc{sqrt(Eb/N0)} If an Infinite impulse response(IIR) filter corresponds to

y ̃ (n)= (1 - α)s(n)+ αy ̃  (n - 1),n = 0,1....N-1    where y ̃ (-1) = 0

How can I use Matlab to simulate the signal s(k) and the filter operation producing y and y ̃ (n) respectively above for N = 8 and plot simulated bit error rate vs. Eb/N0 and theoretical BER vs. Eb/N0 to compare. Eb/N0 range should be from 0 to 10 dB.

Note: For the IIR filter I have already determined α = (N-1)/(N+1)

My code fails to achieve desired results as I am unaware of how to simulate a WGN with variance = σ2. The one I have coded is for zero variance. Additionally I don't know how to pass my signal through the filters mentioned above. Could somebody please help me rectify this piece of code. If yo could help with code snippet, would be a significant step forward for me. Thanks in advance! Here is my approach.

clc;
clear all;
close all;
N=8; % Number of Bits to be processed
Eb_N0_dB = 0 : 1: 10;
for i = 1:length(Eb_N0_dB)
    x = rand(1,N)>0.5;  %generating 0,1s
    xpolar = 2*x -1; %BPSK modulation
    noise = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; %noise
    y = xpolar + 10^(-Eb_N0_dB(i)/20)*noise;
    xdecode = real(y)>0;  %receiver hard decison decoding
    nErr(i) = size(find([x - xdecode]),2);
end
simulatedBER = nErr/N; %simulated BER
theoryBER = 0.5erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical BER
%plot
figre
semilogy(Eb_N0_dB,simulatedBER,'bs-');
hold on
semilogy(Eb_N0_dB,theoryBER,'mx-');
axis([0 10 10^-5 0.5])
grid on




Aucun commentaire:

Enregistrer un commentaire