Let's start with the problem of delay compensation. To simplify the analysis we will assume that the clocks at the transmitter and receiver are synchronized and synchronous. So T prime of s is equal to Ts, and the channel acts as a simple delay. So the received signal is simply a delayed version of the transmitted signal Which implies that the frequency response of the channel, is simply e to the minus j omega d. So the channel introduces a delay of d seconds. We can express this in samples, in the following way. We write d as the product of the sample period, times b + tao, where b is an integer. And tao is strictly less than 1/2 in magnitude. So b is called the bulk delay because it gives us an integer number of samples of delay at the receiver and tao is the fractional delay so the fraction of samples introduced by the continuous time delay of d. So how do we compensate for this delay? Well the bulk delay is rather easy to tackle. Imagine the transmitter begins transmission by sending just an impulse over the channel. So the discrete time signal is this one. Is just a delta in zero. It gets sent to d to a converter and the converter will output a continuous time signal that looks like an interpolation function, like a sink. And like all interpolation functions, it will have a maximum peak at zero, that corresponds to the non zero sample. This signal gets transmitted over the channel. And it gets to the receiver after a delay, D, that we can estimate for instance by looking at this placement of the peak of the intervalation function. The receiver converts this into a discrete time sequence. Now, in the figure here it looks as if the sample instance and the transmitter and receiver are perfectly aligned. Now this is not necessarily the case because the starting time for the interpolator at the transmitter and the sampler and the receiver are not necessarily synchronous. But any difference in starting time can be integrated into the propagation delay as long as the sampling period are the same. So with this, all we need at the receiver is to look for the maximum value in the sequence of samples. Because of the shape of the interpolating function, we know that the real maximum will be utmost half a sample in either direction of the location of the maximum sample value. So at the receiver to offset the bulk delay we will just set the nominal time N=0, to coincide with the location of the maximum value of the sample sequence. Now, of course, we need to compensate for the fractional delay, so we need to estimate tao, and to do that we'll use a different technique. Let me add in passing that in real communication devices, of course we're not using impulses to offset the bulk delay. Because impulses are fullband signals, and so they would be filtered out by the passband characteristic of the channel. The trick is to embed these continuities in pilot tones, and to recognize these discontinuities at the receiver. As we have seen in the animation at the beginning of this module, We use phaser reversals which are abrupt discontinuities in sinusoid to provide a recognizable instant in time for the receiver to latch on. Okay so what about the fractional delay? Well, for the fractional delay we use a sinusoid instead of a delta, so we build a baseband signal which is simply complex exponential at a known frequency, omega zero. This will be converted to a real signal before being sent to the D-to-A converter. And so, what we transmit actually is cosine of omega C, the carrier frequency, plus the pilot frequency omega 0 times n. The receiver will receive a delayed version of this, which contains the delay, now in sample, the n fraction of sample, b + tao. After we demodulate this cosine, we remember we get a complex exponential. And we can also compensate already for the bulk delay, which we know, so for an integer number of sample b, and we obtain a base band signal hat b of n. And, which is e to the j omega, n- tao. Since we know the frequency omega 0, we can just multiply this quantity, by e to the- j omega 0 n and obtain e to the- j omega 0 tao, which is a constant. And which we can invert, given that we know the frequency omega zero. And so now we have an estimate for both the bulk delay and the fractional delay. Now we have to bring back the signal to the original timing. The bulk delay is really no problem. It's just an integer number of samples. What creates a problem is the fractional delay because that will shift the peaks with respect to the sample intervals. So, if we want to compensate for the bulk delay we need to compute subsample values. And in theory to do that we should use a sink fractional delay, namely, a filter with impulse response sinc of n + tao. In practice, however, we will use a local interpolation and this is a very practical application of the Lagrange interpolation technique that we saw in module 6.2. So graphically the situation is like so. We have a stream of samples coming in, and for each sample, we want to compute the sub-sample value with a distance of tao from the nearest sampling interval. And we want to only use a local neighborhood of samples to estimate this. Now you remember from Module 6.2, the Lagrange approximation works by building a linear combination of Lagrange polynomials weighed by the samples of the function. So as per usual, we choose the sampling interval equal to 1 so that we lighten the notation. We have a continuous time function X of T, and we want to compute X of N + Tao, with Tao at one less than half of magnitude. So we have samples of this function at integers n and the local Lagrange approximation around n is given by this linear combination of Lagrange polynomials weighted by the samples of the functions around the approximation point. So, we use notation x L of n and t. n is a centerpoint, and t is the value from the centerpoint at which we want to compute the approximation. And, the Lagrange polynomials are given by this formula here, which is the same as in module 6.2. So the delayed compensated input signal will be set equal to the Lagrange approximation at tao. So let's look at an example. Assume that we want a second order approximation so we pick N equal to one and we'll have three Lagrange polynomials. And so we will need to use three samples of the sequence to compute interpolation. These three polynomials will be centered in n- 1, n, and n + 1 and scaled by the value of the samples at these locations. And finally we will sum the polynomials together and compute our value in n + tao. So we start with our first one which is centered in n- 1. And like all interpolation polynomials, its value is one in n minus one, and zero at other integer values of the argument. The second polynomial will be centered in n, and the third polynomial will be centered in n + 1. When we sum them together We obtain a second order curve that goes through the points, that interpolates with three points. And then, we can compute the approximation as the value of this curve n + tao. Now the nice thing about this approach is that if we look at the approximation, if we take the Lagrange approximation around n, we can define a set of coefficients, d tao of k, which are the values of each lagrange polynomial n tao. So d tao of k are 2 n + 1 values. The form, the coefficients, of an FIR filter. And we can compute. The value of the Lagrange approximation simply as the convolution of the incoming sequence with this interpolation filter. So for example if these are the three Lagrange polynomials for n equal to one, we can compute these polynomials for t equal to tao, where tao is the fractional delay that we estimated before and we will obtain three coefficients. Like here for instance is an example for tao equal to 0.2. Three coefficients that give us an FIR filter and then we can just simply filter the samples coming into the receiver with this filter to compensate for the fractional delay. So, again, the algorithm is estimate the fractional delay, the bulk delay is not problem, again. Compute the 2N + 1 Lagrangian coefficients and filter with the resulting FIR. The added advantage of this strategy is that if the delay changes over time for any reason, all we need to do is to keep the estimation running and update the FIR coefficients as the estimation changes over time.