# Why does the BER rate change randomly versus the SNR?

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

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

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

• I seems to me that you are not considering the delay induced by both filtering stages. – vaz Dec 10 '15 at 15:10
• @vaz Could you please elaborate further? – user29568 Dec 10 '15 at 15:31
• 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! – Dilip Sarwate Dec 10 '15 at 15:53

• 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.