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


closed as unclear what you're asking by MBaz, Laurent Duval, jojek Jan 16 '17 at 13:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I find your code very difficult to understand. Please add more information about what you're doing, why you're using delta modulation, and what you're trying to achieve. Please consider posting a block diagram along (or instead of) your code. $\endgroup$ – MBaz Jan 4 '17 at 20:23
  • $\begingroup$ @MBaz I wanted the coefficients to not just be binary but ternary. So to do that I used firpm and got the target coefficients to be made ternary. To oversample I used interpolation. The interpolated output is fed into sigma delta modulator which uses ternary quantizer. This code works fine as output (variable v which uses ternary quantizer) I get is +1, -1, 0. $\endgroup$ – Abeer Jan 5 '17 at 7:12
  • $\begingroup$ @MBaz My actual problem is in the other code that when I plot Pe vs SNR, it does not show much difference which I have added now at the end of the question, please check it. I'll try to add block diagram as well. $\endgroup$ – Abeer Jan 5 '17 at 7:25
  • $\begingroup$ We cannot run the code, at least the function TernaryQuantizer is missing. However, looking at your curve: You have 50% Bit error. This amounts to completely random output, which is independent of the input. I suggest you debug your problem first with infinite snr (i.e. noise=0). In this case, your receiver should create the correct output sequence. I suppose, it currently does not. $\endgroup$ – Maximilian Matthé Jan 5 '17 at 7:48
  • $\begingroup$ @MaximilianMatthé Thank you for your suggestion. and yes sorry I forgot to provide the ternary quantizer function. Should I remove the noise first? $\endgroup$ – Abeer Jan 5 '17 at 7:55

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)>0.5;   % generating 0,1 with equal probability
 bits=(2*input-1);      %mapping the bits with S(t)


 %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                            

   %sampling at T & using thresholding operation

  %recovering the sent bits

  %calculating the bit error


 %Plotting Pb Vs SNR     
 title ('SNR Vs Probabolity of Error');
 xlabel ('SNR (dB)');
 ylabel ('Probability of Error');
 legend('practical curve','theoratical curve');
 grid on;

enter image description here

  • $\begingroup$ Thank you so much. The curve looks good. I have one question so I can understand the theory, I know the matched filter impulse response must be time reversed as that of input but why do you mirror the coefficients in this case? $\endgroup$ – Abeer Jan 5 '17 at 20:36
  • $\begingroup$ The mirroring amounts to the time-reversal. $\endgroup$ – Maximilian Matthé Jan 5 '17 at 21:58
  • $\begingroup$ So in order to do matching the transmitted pulse now contains the mirrored ternary coefficients and then this pulse is matched with the matched filter which has those coefficients? In other words mirrored coefficients are being matched. Is my conclusion correct? $\endgroup$ – Abeer Jan 6 '17 at 9:58
  • $\begingroup$ the matched-filter criterion is if, g[n] is the TX filter, then g[-n] should be the RX filter (or vice versa). This is what I have implemented. $\endgroup$ – Maximilian Matthé Jan 6 '17 at 10:18
  • $\begingroup$ ok I get it now. Thank you so much for the guidance, explanation and suggestions $\endgroup$ – Abeer Jan 7 '17 at 11:49

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