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.