# Symbol Timing Recovery for QPSK (digital modulations)

(10 votes, average: 4.80 out of 5)

### What is Symbol timing Recovery :

When transmitting data across a communication system, three things are important: frequency of transmission, phase information and the symbol rate.

In coherent detection/demodulation, both the transmitter and receiver posses the knowledge of exact symbol timing and symbol phase (and/or symbol frequency). While everything is set at the transmitter, the receiver is at the mercy of recovery algorithms to regenerate these information from the incoming signal itself. If the transmission is a passband transmission, the carrier recovery algorithm also recovers the carrier frequency. For phase sensitive systems like BPSK, QPSK etc.., the carrier recovery algorithm recovers the symbol phase so that it is synchronous with the transmitted symbol.

The first part in such a receiver architecture of a MPSK transmitting system is multiplying the incoming signal y(t) with sine and cosine components of the carrier wave.

The sine and cosine components are generated using a carrier recovery block (Phase Lock Loop-PLL or setting a local oscillator and tracking the variations).

Once the in-phase and quadrature signals are separated out properly, the next task is to match each symbol with the transmitted pulse shape such that the overall SNR of the system improves.

Implementing this in digital domain, the architecture described so far would look like this (Note the subscript of the incoming signal has changed from analog domain to digital domain – i.e. y(t) to y[n])

In the digital architecture above, the Matched Filter is implemented as a simple FIR (Finite Impulse Response) filter whose impulse response is matched to that of the transmitter pulse shape. It helps the receiver in timing recovery and also it improves the overall SNR of the system by suppressing some amount of noise. The incoming signal up to the point before the matched filter may have fluctuations in the amplitude. The matched filter also behaves like an averaging filter that smooths out the variations in the signal.

Note that in this digital version, the incoming signal y[n] is already a sampled signal. It has already passed through an analog to digital converter that sampled the signal at some sampling rate. From the symbol perspective, the symbols have to be sampled at optimum sampling instant to extract its content properly.

This requires a re-sampler, which resamples the averaged signal at the optimum sampling instant. If the original sampling is before or after the optimum sampling point, the timing recovery signal will help to resample it accordingly.

Let’s take a simple BPSK transmitter for illustration. This would be equivalent to any of the single arms (in-phase and quadrature phase arms) of a QPSK transmitter or receiver.

An alternate data pattern (symbols) – [+1,-1,+1,+1,…,] is transmitted across the channel. Assume that each symbol occupies Tsym=8 sample time.

Lets add some noise. A random noise of standard deviation 0.25 is generated and added with the generated BPSK symbols.

From the first plot, we see that the transmitted pulse is a rectangular pulse that spans ‘Tsym’ samples. In the illustration, Tsym=8. The best averaging filter (matched filter) for this case is a rectangular filter that spans 8 samples. Such a rectangular pulse can be mathematically represented in terms of unit step function as
$latex u[n]-u[n-8]$

(Another type of averaging filter – “Moving Average Filter” is implemented here)

The resulting rectangular pulse will have a value of 0.5 at the edges of the sampling instants (index 0 and 7) and a value of ‘1’ at the remaining indices in between the edges. Such a rectangular function is indicated below.

The incoming signal is convolved with the averaging filter and the resultant output is given below

We can note that the averaged output peaks at the locations where the symbol transition occurs. Thus, when the signal is sampled at those ideal locations, the BPSK symbols [+1,-1,+1,…] can be recovered perfectly.

In practice, a Square Root Raised Cosine (SRRC) Filter is used both at the transmitter and the receiver (as a matched filter) to mitigate inter-symbol interference. An implementation of SRRC filter in Matlab is given here

But the problem here is: “How does the receiver know the ideal sampling instants?”. The solution is “someone has to supply those ideal sampling instants”. A symbol time recovery circuit is used for this purpose.

Coming back to the receiver architecture, lets add a symbol time recovery circuit that supplies the recovered timing instants. The signal will be re-sampled at those instants supplied by the recovery circuit.

### The Algorithm behind Symbol Timing Recovery:

Different algorithms exist for symbol timing recovery and synchronization. An “Early/Late Symbol Recovery algorithm” is illustrated here.

The algorithm starts by selecting an arbitrary sample at some time (denoted by ‘T’). It captures the two adjacent samples (on either side of the sampling instant ‘T’) that are separated by δ seconds. The sample at the index T-δ is called Early Sample and the sample at the index T+δ is called Late Sample. The timing error is generated by comparing the amplitudes of the early and late samples. The next symbol sampling time instant is either advanced or delayed based on the sign of difference between the early and late sample.

1) If the Early Sample = Late Sample => The peak occurs at the on-time sampling instant (T). No adjustment in the timing is needed.
2) If |Early Sample| > |Late Sample| => Late timing, the sampling time is offset so that the next symbol is sampled T- δ/2 seconds after the current sampling time .
3) If |Early Sample| < |Late Sample| => Early timing,the sampling time is offset so that the next symbol is sampled T+ δ/2 seconds after the current sampling time .

These three situations are shown next.

There exist many variations to the above mentioned algorithm. The Early/Late synchronization technique given here is the simplest one taken for illustration.

Let’s complete the architecture with a signal quantization and constellation de-mapping block which gives out the estimated demodulated symbols.

# Square Root Raised Cosine Filter (Matched/split filter implementation)

(8 votes, average: 3.88 out of 5)
An implementation of a rectangular pulse shaping filter in transmitter and receiver side was discussed in the previous article. Another pulse shaping filter namely Raised Cosine Filter was also discussed.

The code was modified a bit to implement a Square Root Raised Cosine Filter (SRRC). Instead of using a single Raised Cosine filter at the transmitter, a square root raised cosine filter is used at both transmitter and receiver. This is to achieve matched filtering (maximizes SNR of the system). SRRC and RRC filters are used to mitigate inter symbol interference (ISI).

The frequency response of the SRRC filter is the square root of the frequency response of the raised-cosine filter. The impulse response of the SRRC filter (according to 3GPP standard[1]) is given by

with following values[2]at $$t=0$$ and $$\frac{t}{T}=\pm \frac{1}{4 \alpha}$$ .

$$\begin{matrix} p(t)\mid _{t=0}=(1-\alpha)+\frac{4\alpha}{\pi}\\ \\ p(t)\mid _{\frac{t}{T}=\pm \frac{1}{4\alpha}}=\frac{\alpha}{\sqrt{2}}\left ( (1+\frac{2}{\pi})sin(\frac{\pi}{4\alpha})+(1-\frac{2}{\pi})cos(\frac{\pi}{4\alpha}) \right ) \end{matrix}$$

There are several forms of equations to implement SRRC.

### Simulation of Square Root Raised Cosine Filter in Matlab:

Define oversampling factor (to simulated digital to analog conversion in the transmitter), input bits to be transmitted and the impulse response of the desired SRRC filter (as shown in the equation/function above).

The SRRC filter’s impulse response is computed for t=-4T to 4T duration. This duration can be changed to any appropriate desired value.

Convolve the impulse response of the root raised cosine filter with the oversampled version of input bits and plot the resulting response. This is the response of the filter for the input bits at the transmitter side.

At the receiver side the received signal (“output_of_srrc_filter”) is convolved with a matched filter (which is same as the transmitting filter).Note that no noise is added to the incoming signal. If you wish you could add some noise to the signal before performing the matched filter operation.

Note that the peak value of the matched filter response occurs at 65th sample (this number will vary depending on the oversampling rate). Noting down the sample number of the peak value for a single bit input at the transmitter is important in downsampling operation (equivalent to recovering the input bits by sampling using a Digital to Analog Converter). A small snipped of code is given below, to extract the recovered bits out of the matched filter response.

Following simulation results are shown for a series of input bits: Input_bit = [1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1]. It is interesting to note how the effect of inter symbol interference being mitigated by the Square Root Raised Cosine Filters implemented at both the transmitter and receiver. The roll-factor of the SRRC filter can be adjusted to see the effects of ISI on the recovered samples.

### References:

[1] 3GPP TS 25.104 V6.8.0 (2004-12) (URL for all 3GPP Standards – click here)
[2] Michael Joost,”Theory of Root-Raised Cosine Filter”,Krefeld DE,December 2010

# Oversampling, ADC – DAC Conversion,pulse shaping and Matched Filter

(2 votes, average: 5.00 out of 5)
In order to simulate a communication system in Matlab one needs to understand the concept of oversampling (upsampling) and undersampling (downsampling).

Digital communication systems involves conversion of digital data to analog form (with some modulation,coding stuffs etc..) at the transmitter side. The data transmitted through a channel is in analog form and it needs to be converted back to digital domain by the process of Digital to Analog Conversion (DAC). Once the data is in digital domain, the receiver is at ease to process it to recover the transmitted data.

In Matlab one needs to emulate this situation where in the input data has to be represented in analog form in the transmitter and back to digital form at the receiver. Matlab is just a piece of software that runs on a digital machine (computer terminals), so it cannot really produce data in analog domain. To circumvent this problem, one has to use a process called oversampling.

Lets consider a digital communication system (shown below), where in, a train of input data (In = $$\pm 1$$) are shaped by a pulse shaping filter and modulated by a carrier Fc. This is a simple system implementing BPSK modulation. We will use rectangular pulse shaping filter (p(t)) for implementation in Matlab.

For illustration we try to transmit only one bit (In=1) through the system. To represent digital to analog conversion (“n” domain to “t” domain), we use oversampling by 4. Oversampling is a process in which additional “oversampling factor-1” zeros are inserted in to the digital data.

For example, oversampling In=1 by a factor of 4 gives [1 0 0 0]. Similarly, oversampling the input [1 0 1 1] by a factor of 3 gives [1 0 0 0 0 0 1 0 0 1 0 0].

The oversampled version of input is then passed through a pulse shaping filter (it can be a rectangular filter, root cosine filter, etc..,). A rectangular filter is implemented in the following code.

At the receiver side, we might want to recover the transmitter samples. To do this we need to used a matched filter at the receiver side (to maximize the SNR of the system). The matched filter is exactly matched to the pulse shaping filter used in the transmitter side.

Once the received signal is passed through the matched filter it has to be converted back to digital domain (“t” to “n” domain). This is achieved by implementing a downsampling process. Note that the value “1” is at 4 th sample, this is where we have to sample in the receiver side.

The above chart illustrates the scenario in which the input bit is received properly via a matched filter arrangement.Note that there are some trailing zeros in the downsampled signal (which is the effect of padding additional zeros in the pulse shaping function). The trailing zeros can be removed, if the padded zeros are stripped off from the pulse shaping function ( Matlab Code: pt = [ones(1,overSampling_Factor) ]/sqrt(overSampling_Factor);)

Output of the received signal (after matched filter) for an input [1 0 1 1] is shown below (click to enlarge the picture).