Matched Filter BER vs SNR curve does not match the theoretical curve
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;