# Sampling signal after root raised cosine

I am generating series of 1 and 0. then pulse shaped them with root raised cosine and after than deciding to do match filtering and recovering the bits however it turns out that I am not getting the correct bits. What I do is as follow:

1. generate 0 and 1.
2. pulse shape them with RRC.
3. match filter using the same transmited filter
4. Remove samples up to peak using [val,pos]=max(mysignal)
5. sample using mysingal(pos:overample:end)

But what I get is not correct. I simulated this using 10 bits but I get only 2. I know there is something wrong but I do not know why. My method works when I only have one bit.

I am wondering if I have more than one bit should I do this procedure for every bit.How can I approach this problem.

This is also my code assume RX2 is the pulse shaped version of my signal and os is the oversampling factor and 0.25 is the roll of factor. I am wondering how to detect all the bits like all 10 or 100?

RX1=filter(srrc(os,0.25),1,RX2);
[val,pos]=max(RX1);
RX=RX1(pos:os:end);
Bits=RX;
One=Bits>=Th;
BER=sum(One)/length(Bits);


The first one is the signal after passing through matched filter using conv command and no built in command like filter. the original bits are 0 0 1 1 1 Can anyone tell me how can I sample signal to get these bits back. what command I should use. simply downsampling will not work.

The second one is for the same bits but using filter command for 0 0 1 1 1 can anyone please tell me how to obtain correct bits back from any of these figures.

• well, you cut off samples at the start, and it doesn't look like you're appending "zero stuffing" at the end of your input bits, so you're losing signal, right? Commented Jun 13, 2016 at 11:16
• From the looks of it, your filter delay is about 34 samples on the TX RRC and the same on the RX RRC, so you need to add that many zero-input samples to be able to see he last bit you've modulated. Commented Jun 13, 2016 at 11:17
• Use conv instead of filter. Then read the pulse shaping chapter in the book linked at the bottom of this page: ece.wisc.edu/~sethares/telebreak.html
– MBaz
Commented Jun 13, 2016 at 13:25
• @MarcusMüller,I am upsampling the input signal when I want to apply the transmitter filter. I would like to know when you say I should add more zeros, you mean after applying match filter? and why should I do that? Commented Jun 13, 2016 at 17:05
• @MBaz, is there anything wrong about filter command I know filter command kind of truncate my symbol but I used in the input side as well/ Commented Jun 13, 2016 at 17:07

I can visibly see from your figure that you have done the two cascaded RRC's properly. I circled the samples I would expect to see for your 00111 data sequence after RC filtering. Clearly you are using 8 samples per symbol, and a longer data sequence would continue in similar fashion after the initial delay that you have as shown.

To demodulate this, you typically would have a timing recovery loop to establish the ideal sampling locations. There are several approaches to establish timing, but one recently discussed on this forum is the use of the Gardner TED (Timing Error Detector) which would create an error signal that you could use to control a timing sample location (increment up or down a position pointer based on the accumulated error, forming a timing recovery loop. This would be done using a (discardable) training sequence with lots of transitions, typically as part of the header for the data packet that would be significantly longer than your short data set.

Another synchronizer I like is the M&M synchronizer (Mueller & Meuller) as well as excellent approaches I learned from fred harris using polyphase filters for timing synchronization (thank you fred!).

Below are links to recent discussions on the Gardner TED, but in particular I want to copy here the figure for the eye diagram of the transmitted symbols after they have gone through a root raised cosine (RRC) filter ("Before RRC Filter") the received signal after it has been passed through a second RRC filter as you are doing. Conveniently this was done with same alpha= 0.25 roll-off factor you have used, and what it shows is the continuous time representation of every possible trajectory between symbols based on previous symbol patterns. In your case, you have eight samples per symbol, landing on one of these trajectories.

Links to recent discussions on the Gardner TED:

Location of Matched Filter

Gardner Timing Recovery for Repeated Sybmols

• Thanks But how do you find the initial point for sampling that is the problem I have. How do you know you should start from sample 65 or 69? how can I find this number with different oversampling factor ?what figure or graph determines the initial delay or staring point of sampling is determined ? Commented Jun 15, 2016 at 5:17
• You could start from any sample and the timing recovery loop will converge with enough symbol transition information in your header (training) sequence. Once you establish timing, (and carrier offset and equalization in a real world system) you can establish alignment via framing information in the header. Commented Jun 15, 2016 at 11:20
• However in your plots I do not see as I pointed out any evidence of lost bits (if you could confirm that you are indeed over-sampling by a factor of 8), however I cannot tell if your sequence is reversed. Please show us what you get with this sequence: 10110111000 Commented Jun 15, 2016 at 11:24
• Thank you so much.However I meant in my case how did you know you should start from sample 66 and how did you know my oversampling factor since I did not mention them? Commented Jun 16, 2016 at 2:07
• I am familiar with what the RC shape should look like (see the eye diagrams I plotted- not sure if you know how to read them, but this is the waveform over 2 symbols repeated over itself many times for all combinations of prior symbols.), and I could see from your plot that "1" is the symbol convergence point (like what happens at sample 6 and 16 in my eye diagram) as that is the only point on your graph where there are 3 interceptions with a horizontal line (given your data ends in 1 1 1). From there I could see that there were 8 samples between those positions. Hope that helps. Commented Jun 16, 2016 at 5:08