0
$\begingroup$

I have altered a MATLAB code that simulates the BPSK modulation using a raised cosine filter at the transmitter and a matched filter at the receiver to study how the signal changes in each step. But, the final plot of the BER versus SNR is not decreasing as the SNR increases. I have no clue how to fix this. I would appreciate any help. The image and code is below

BER vs SNR

BER vs SNR

clear
N  = 10^6; % number of bits or symbols
T  = 1; % symbol duration of 1us 
os = 5; % oversampling factor
fs = 5/T; % sampling frequency in MHz
rolloff = 0.05;

Eb_N0_dB = [0:10]; % multiple Eb/N0 values

for ii = 1:length(Eb_N0_dB)
    filter = rcosine(1/T,os,'sqrt',rolloff);
   % Transmitter
   ip = rand(1,N)>0.5; % generating 0,1 with equal probability
   s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1 

   % up sampling the signal for transmission
   sU = [s;zeros(os-1,length(s))];
   sU = sU(:).';
   sFilt = 1/sqrt(os)*conv(sU,filter);
   sFilt = sFilt(1:N*os);


   % Noise addition
   y= awgn(sFilt,ii,0); 

   % mathched filter
   yFilt = conv(y,fliplr(filter)); % convolution
   ySamp = yFilt(os:os:N*os);  % sampling at time T

   % receiver - hard decision decoding
   ipHat = real(ySamp)>0;

   % counting the errors
   nErr(ii) = size(find([ip- ipHat]),2);

end

simBer = nErr/N; % simulated ber
semilogy(Eb_N0_dB,simBer,'mx-');
grid on
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('Bit error probability curve for BPSK modulation');
$\endgroup$
3
  • $\begingroup$ I seems to me that you are not considering the delay induced by both filtering stages. $\endgroup$ – vaz Dec 10 '15 at 15:10
  • $\begingroup$ @vaz Could you please elaborate further? $\endgroup$ – user29568 Dec 10 '15 at 15:31
  • 1
    $\begingroup$ With a BER hovering around $0.5$ regardless of the SNR, whatever you are doing with your modified code is so destructive of the receiver performance that you might as well junk the whole thing and choose the value of the output bits by tossing a coin! $\endgroup$ – Dilip Sarwate Dec 10 '15 at 15:53
2
$\begingroup$

There are a few problems with your code:

  • You are using the index ii not the actual SNR in DB in this line: y= awgn(sFilt,ii,0);

  • You are not taking into account the filter delay in ySamp = yFilt(os:os:N*os);. Your filter is filter = rcosine(1/T,os,'sqrt',rolloff); which will design a root-raised cosine FIR filter. Your filter delay will be (length(filter)-1)/2.

$\endgroup$
6
  • $\begingroup$ If ip=0, then isn't s=0-1 =-1? Also, I didn't quite understand how I can take the filter delay into account. $\endgroup$ – user29568 Dec 10 '15 at 15:23
  • $\begingroup$ You are correct! I missed the s line. I'm just reading code, I have no way to run it. $\endgroup$ – Peter K. Dec 10 '15 at 15:58
  • $\begingroup$ @user29568 : See my addition about how to deal with filter delay. $\endgroup$ – Peter K. Dec 10 '15 at 16:04
  • $\begingroup$ Wouldn't that change the vector size, causing the comparison to produce a dimension error? $\endgroup$ – user29568 Dec 10 '15 at 16:08
  • $\begingroup$ or should I prepend the zeros before filtering $\endgroup$ – user29568 Dec 10 '15 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.