Matched Filter BER vs SNR curve does not match the theoretical curve I am creating a matched filter using filter command. The coefficients are also generated in another file using sigma delta modulator these are ternary coefficients (+1,-1,0). I have generated 1 and 0 with equal probability, mapped the bits with a rectangular pulse then added noise and used filter command to filter the received signal with ternary coefficients. After retrieving of the bits when I try to calculate the bit error, the plot comes out to be flat, it does not resemble the theoretical curve and the error rate gives strange values. I'll really appreciate it if someone helps me, please.

The Pb values does not seem to be right. There is not much difference that is why the plot is flat
I dont know, if this is exactly what you wanted to do, but here's a script that creates your theoretic curve. I used your mirrored coefficients as the transmit pulse, and the coefficients as the filter coefficients. This way, the pair becomes a matched filter pair.

N=10^4;        %No: of bits
 A=10;          %amplitude of S(t)
 T=length(v);          %duration of S(t)
 S=fliplr(v)*A;       %the transmit pulse
 E=norm(S)^2;         %S(t) Energy
 input = rand(1,N)&gt;0.5;   % generating 0,1 with equal probability
 bits=(2*input-1);      %mapping the bits with S(t)
 x=kron(bits,S);

 SNR_db=0:0.25:10;
 n_var=(E/2)*10.^(-SNR_db/10);

 %Noise that gives SNR=0dB to SNR=7dB 

 for i = 1:length(n_var)

  n=randn(1,length(x))*sqrt(n_var(i));   %noise 
   r=x+n; %received signal

  %v=ternary coefficients, filtering the received signal and coefficients                            
   filtered=filter(v,1,r); 

   %sampling at T &amp; using thresholding operation
   z=sign(filtered);
   z=(z(T:T:end)); 

  %recovering the sent bits
  received_bits=(z+1)/2; 

  %calculating the bit error
  Pb(i)=mean(abs((input)-(received_bits)));

 end

 %Plotting Pb Vs SNR     
  figure(1);
 SNR=10.^(SNR_db/10);
 P_theory=(0.5)*erfc(sqrt(2.*SNR)./sqrt(2));
 semilogy(SNR_db,Pb,'o',SNR_db,P_theory,'r-')
 title ('SNR Vs Probabolity of Error');
 xlabel ('SNR (dB)');
 ylabel ('Probability of Error');
 legend('practical curve','theoratical curve');
 grid on;