Simulate matched filter system with SRRC filtering

Key focus: Let’s learn how to simulate matched filter receiver with square root raised cosine (SRRC) filter, for a pulse amplitude modulation (PAM) system.

Simulation Model

A basic pulse amplitude modulation (PAM) system as DSP implementation, is shown in Figure 1 by adding an upsampler (), pulse shaping function () at the transmitter and a matched filter (), downsampler () combination at the receiver.

DSP implementation of a PAM modulation system with pulse shaping and matched filtering
Figure 1: DSP implementation of a PAM modulation system with pulse shaping and matched filtering

In this model, a random stream of source bits is first segmented into -bit wide symbols that can take any value from the set . The simulation code directly starts by generating a random set of symbols, that goes into the modulation mapper. Pulse amplitude modulation (MPAM) mapping and de-mapping, described in sections 5.3.1 and 5.4.1, are considered here for simulation. An MPAM modulator maps the -bit information symbols to one of the distinct signaling levels. The MPAM modulated symbols are shown in Figure 2.

This article is part of the book Wireless Communication Systems in Matlab, ISBN: 978-1720114352 available in ebook (PDF) format (click here) and Paperback (hardcopy) format (click here).

%Program: MPAM modulation
N = 10ˆ5; %Number of symbols to transmit
MOD_TYPE = 'PAM'; %modulation type
M = 4; %modulation level for the chosen modulation MOD_TYPE
d = ceil(M.*rand(1,N)); %random numbers from 1 to M for input to PAM
u = modulate(MOD_TYPE,M,d);%MPAM modulation
figure; stem(real(u)); %plot modulated symbols
Figure 2: M-PAM modulated Symbols

Each MPAM modulated symbol should last for some duration called symbol time, denoted as . Each modulated symbol will go through a discrete time pulse shaping filter whose impulse response is spaced sample, where denotes the sampling period. To do this, the incoming symbols from the modulation mapper need to be converted to discrete time impulse train by upsampling them by a factor (as per the upsampling equation given here ). The upsampler inserts zeros between each modulated symbols. In practice, is chosen as integral multiples of 4. The upsampler/oversampled output is shown in Figure 3.

%Program: Upsampling
L=4; %Oversampling factor (L samples per symbol period)
v=[u;zeros(L-1,length(u))];%insert L-1 zero between each symbols
%Convert to a single stream
v=v(:).';%now the output is at sampling rate
stem(real(v)); title('Oversampled symbols v(n)');
Figure 3: Modulated symbols upsampled by 4 (left) and the SRRC pulse shaping filter output (right)

In order to fill-in proper values in place of the inserted zeros, interpolation is performed by a pulse shaping filter by convolving the output of the upsampler and the pulse shaping function. The pulse shaping function needs to satisfy Nyquist criterion for zero ISI, otherwise, aliasing effect will wreak havoc. If the amplitude response of the channel is flat and if the noise is white, then the amplitude response of the pulse shaping function can be split equally between the transmitter and receiver. For this simulation the desired Nyquist pulse shape is a raised-cosine pulse shape and the task of raised-cosine filtering is equally split between the transmit and receive filters. This gives rise to square-root raised-cosine (SRRC) filters at the transmitter and receiver. This is a matched filter system, where the receive filter is matched with the transmit pulse shaping filter.

A matched filtering system is a theoretical framework and it is not a specific type of filter. It offers improved noise cancellation by improving the signal noise ratio at the output of the receive filter. The implementation starts with the design of an SRRC filter with roll-off factor . The SRRC filter length is influenced by the parameter – the span of the filter length in units of symbols and the oversampling factor .

Filters will not produce instantaneous output and they take sometime to produce the output. That is, the output of the filter is shifted in time with respect to the input. For symmetric FIR filters of length , the filter delay is . Apart from returning the SRRC pulse function, the filter design function given in this section returns the filter delay. Filter delays are useful in determining the appropriate sampling instances at the receiver. The modulated symbols at the transmitter are passed through the designed filter and the response of the filter is plotted in Figure 3 (right).

%Program: SRRC pulse shaping
%----Pulse shaping-----
beta = 0.3;% roll-off factor for Tx SRRC filter
Nsym=8;%SRRC filter span in symbol durations
L=4; %Oversampling factor (L samples per symbol period)
[p,t,filtDelay] = srrcFunction(beta,L,Nsym);%design filter
s=conv(v,p,'full');%Convolve modulated syms with p[n] filter
figure; plot(real(s),'r'); title('Pulse shaped symbols s(n)');
Figure 4: Received signal with AWGN noise (left) and the output of the matched filter (right)

The pulse shaped signal samples are sent through an AWGN channel, where the transmitted samples are added with noise samples that are generated according to the required (refer AWGN noise model given in this post). The received signal that is corrupted with AWGN noise is shown in Figure 4 (left).

%Program: Adding AWGN noise for given SNR value
EbN0dB = 10; %EbN0 in dB for AWGN channel
snr = 10*log10(log2(M))+EbN0dB; %Converting given Eb/N0 dB to SNR
%log2(M) gives the number of bits in each modulated symbol
r = add_awgn_noise(s,snr,L); %AWGN , add noise for given SNR, r=s+w
%L is the oversampling factor used in simulation
figure; plot(real(r),'r');title('Received signal r(n)');

For the receiver system, we assume that the ADC in the receiver produces an integer number of samples per symbol (i.e, is an integer). In practice, this is not always the case and thus a resampling filter is often included in real world designs. In the discrete time model, the received samples are passed through a matched filter, whose impulse response is matched to the impulse response of the pulse shaping filter as . Since the SRRC pulse is symmetric, we will be using the same SRRC pulse shaping function for the matched filter. The received samples are convolved with the matched filter and the output of the matched filter is shown in Figure 4 (right).

Refer the book Wireless Communication Systems in Matlab for the program on how to perform matched filtering

Next, we assume that the receiver has perfect knowledge of symbol timing instants and therefore, we will not be implementing a symbol timing synchronization subsystem in the receiver. At the receiver, the matched filter symbols are first passed through a downsampler that samples the filter output at correct timing instances.

The sampling instances are influenced by the delay of the FIR filters (SRRC filters in Tx and Rx). For symmetric FIR filters of length , the filter delay is . Since the communication link contains two filters, the total filter delay is . Therefore, the first valid sample occurs at position in the matched filter’s output vector ( is added due to the fact that Matlab array indices starts from 1). The downsampler that follows, starts to sample the signal from this position and returns every symbol. The downsampled output, shown in Figure 5, is then passed through a demodulator that decides on the symbols using an optimum detection technique and remaps them back to the intended message symbols.

Figure 5: Downsampling – output of symbol rate sampler
%Program: Symbol rate sampler and demodulation
%------Symbol rate Sampler-----
uCap = vCap(2*filtDelay+1:L:end-(2*filtDelay))/L;
%downsample by L from 2*filtdelay+1 position result by normalized L,
%as the matched filter result is scaled by L
figure; stem(real(uCap)); hold on;
title('After symbol rate sampler $\hat{u}$(n)',...
'Interpreter','Latex');
dCap = demodulate(MOD_TYPE,M,uCap); %demodulation

Rate this article: Note: There is a rating embedded within this post, please visit this post to rate it.

Books by the author


Wireless Communication Systems in Matlab
Second Edition(PDF)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart

Digital Modulations using Python
(PDF ebook)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart

Digital Modulations using Matlab
(PDF ebook)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart
Hand-picked Best books on Communication Engineering
Best books on Signal Processing

Topics in this chapter

Pulse Shaping, Matched Filtering and Partial Response Signaling
● Introduction
● Nyquist Criterion for zero ISI
● Discrete-time model for a system with pulse shaping and matched filtering
 □ Rectangular pulse shaping
 □ Sinc pulse shaping
 □ Raised-cosine pulse shaping
 □ Square-root raised-cosine pulse shaping
● Eye Diagram
● Implementing a Matched Filter system with SRRC filtering
 □ Plotting the eye diagram
 □ Performance simulation
● Partial Response Signaling Models
 □ Impulse response and frequency response of PR signaling schemes
● Precoding
 □ Implementing a modulo-M precoder
 □ Simulation and results

Discrete-time communication system model

Key focus: Baseband communication system and its equivalent DSP implementation (discrete time model) with a pulse shaping & matched filter is briefly introduced.

If a train of pulses representing an information sequence need to be sent across a band-limited dispersive channel, the bandwidth of the channel should be large enough to accommodate the entire spectrum of the signal that is being sent. If we try to stuff the signal spectrum without proper pulse shaping into a band-limited channel, the spectrum of the received signal at the receiver will be truncated by the band-limiting nature of the channel. In time-domain, the energy of one pulse may spill to the time slot allocated for one or more adjacent pulses, leading to Inter-Symbol Interference (ISI) and therefore a source of error in the receiver.

ISI can be minimized by optimal signal design and the detection of a signal with known pulse shape that is buried in noise is a well-studied problem in communication. At the receiver, optimal signal detection is performed by a matched filter whose impulse response is matched to the impulse response of the pulse shaping filter employed at the transmitter.

This article is part of the book
Wireless Communication Systems in Matlab (second edition), ISBN: 979-8648350779 available in ebook (PDF) format and Paperback (hardcopy) format.

A typical baseband communication system and its equivalent DSP implementation (discrete time model) with a matched filter is shown in Figure 1. The interpolating filter at the transmitter is implemented in DSP as a chain of upsampler and a pulse shaping function. The upsampler inserts L-1 zeros between the successive incoming data samples and the pulse shaping filter fills in the zeros generated by the upsampler by using a pulse shaping function. On the other hand, the receiver contains a downsampler that keeps every Lth sample starting from a specified offset. The factor L denotes the oversampling factor or upsampling ratio which is given as the ratio of symbol period (Tsym) and the sampling period (Ts) or equivalently, the ratio of sampling rate Fs and the symbol rate Fsym as

Figure 1: A typical baseband communication system (top) and its equivalent DSP implementation (bottom)

The interpolating filter at the transmitter is implemented in DSP as a chain of upsampler and a pulse shaping function. The upsampler inserts zeros between the successive incoming data samples and the pulse shaping filter fills in the zeros generated by the upsampler by using a pulse shaping function. On the other hand, the receiver contains a downsampler that keeps every sample starting from a specified offset. The factor denotes the oversampling factor or upsampling ratio which is given as the ratio of symbol period () and the sampling period () or equivalently, the ratio of sampling rate and the symbol rate as

The implementation of impulse response of the most widely discussed pulsing shaping functions (filters) will follow in the next series of articles, followed by an example on a complete matched filter system with square-root raised-cosine pulse shaping.

Rate this article: Note: There is a rating embedded within this post, please visit this post to rate it.

Books by the author


Wireless Communication Systems in Matlab
Second Edition(PDF)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart

Digital Modulations using Python
(PDF ebook)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart

Digital Modulations using Matlab
(PDF ebook)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart
Hand-picked Best books on Communication Engineering
Best books on Signal Processing

Topics in this chapter

Pulse Shaping, Matched Filtering and Partial Response Signaling
● Introduction
● Nyquist Criterion for zero ISI
● Discrete-time model for a system with pulse shaping and matched filtering
 □ Rectangular pulse shaping
 □ Sinc pulse shaping
 □ Raised-cosine pulse shaping
 □ Square-root raised-cosine pulse shaping
● Eye Diagram
● Implementing a Matched Filter system with SRRC filtering
 □ Plotting the eye diagram
 □ Performance simulation
● Partial Response Signaling Models
 □ Impulse response and frequency response of PR signaling schemes
● Precoding
 □ Implementing a modulo-M precoder
 □ Simulation and results

Symbol Timing Recovery for QPSK (digital modulations)

The goal of timing recovery is to estimate and correct the sampling instants and phase at the receiver, such that it allows the receiver to decode the transmitted symbols reliably.

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 sampling 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 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 to track 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. to )

In the digital architecture above, the matched filter is implemented as a simple finite impulse response (FIR) 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 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 instant is before or after the optimum sampling point, the timing recovery signal will help to re-sample (re-adjust sampling times) 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,\cdots,] is transmitted across the channel. Assume that each symbol occupies Tsym=8 sample time.

clear all; clc;
n=10; %Number of data symbols
Tsym=8; %Symbol time interms of sample time or oversampling rate equivalently
%data=2*(rand(n,1)<0.5)-1;
data=[1 -1 1 -1 1 -1 1 -1 1 -1]'; %BPSK data
bpsk=reshape(repmat(data,1,Tsym)',n*Tsym,1); %BPSK signal

figure('Color',[1 1 1]);
subplot(3,1,1);
plot(bpsk);
title('Ideal BPSK symbols');
xlabel('Sample index [n]');
ylabel('Amplitude')
set(gca,'XTick',0:8:80);
axis([1 80 -2 2]); grid on;

Lets add white gaussian noise (awgn). A random noise of standard deviation 0.25 is generated and added with the generated BPSK symbols.

noise=0.25*randn(size(bpsk)); %Adding some amount of noise
received=bpsk+noise; %Received signal with noise

subplot(3,1,2);
plot(received);
title('Transmitted BPSK symbols (with noise)');
xlabel('Sample index [n]');
ylabel('Amplitude')
set(gca,'XTick',0:8:80);
axis([1 80 -2 2]); grid on;

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 (though they are not preferred in practice, I am just using it for simplifying the illustration) that spans 8 samples. Such a rectangular pulse can be mathematically represented in terms of unit step function as

(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

impRes=[0.5 ones(1,6) 0.5]; %Averaging Filter -> u[n]-u[n-Tsamp]
yy=conv(received,impRes,'full');
subplot(3,1,3);
plot(yy);
title('Matched Filter (Averaging Filter) output');
xlabel('Sample index [n]');
ylabel('Amplitude');

set(gca,'XTick',0:8:80);
axis([1 80 -10 10]); grid on;

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.

Rate this article: Note: There is a rating embedded within this post, please visit this post to rate it.

For Further Reading:

[1] Technique for implementing an Early-Late Gate Synchronization structure for DPSK.↗
[2] Ying Li et al,”Hardware Implementation of Symbol Synchronization for Underwater FSK”, IEEE International Conference on Sensor Networks, Ubiquitous, and Trustworthy Computing (SUTC), p 82 – 88, 2010.↗
[3] Heinrich Meyr & Gerd Ascheid,”Digital Communication Receivers: Synchronization in Digital Communication Volume I, Phase-, Frequency-Locked Loops, and Amplitude Control (Wiley and Signal Processing)”,John Wiley & Sons; Volume 1 edition (March 1990),ISBN-13: 978-0471501930.↗
[4] Umberto Mengali,”Synchronization Techniques for Digital Receivers (Applications of Communications Theory)”,Springer; 1997 edition (October 31, 1997),ISBN-13: 978-0306457258.↗

Books by the author


Wireless Communication Systems in Matlab
Second Edition(PDF)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart

Digital Modulations using Python
(PDF ebook)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart

Digital Modulations using Matlab
(PDF ebook)

Note: There is a rating embedded within this post, please visit this post to rate it.
Checkout Added to cart
Hand-picked Best books on Communication Engineering
Best books on Signal Processing