# Understanding time delay estimation for GPS?

I really need help to understand these questions which is highlight, for the GPS situation, I hope anyone who has been working in this situation before, please help me to have a clear understanding about "time delay estimation":

Here is the scenario:

1. Suppose I know precisely I have transmit the signal (data), I know the sampling, I know the time correspond to the very 1st point, I can go through the sign the time every single measurement, that I just transmitted. Now, I received the signal (data), I have section of data and in there somewhere is the signal that transmitted. Unlike, as the transmit, I know the time correspond to the very 1st point in my receive data:

what would I do to get the time delay?

what steps do we follow?

1. In there, somewhere, I don’t know where exactly, but in there somewhere is transmitted the signal and I want to estimate time delay between the transmit and receive. So, I want to look at:

what you need to do that?

What math. operation do I need to use to compute that time delay?

1. If I say:"I want to compute xcorr between 2 vectors". So, this xcorr is twice sum of the length – 1:

what do I do when I have xcorr output?

1. I take 2 vectors, and I compute even longer vector use xcorr, so now I compute the longer vector but I want a number, I don’t want a vector, I want a time delay estimation:

what do I do with the xcorr solved like a MATLAB?

1. If I say xcorr(x,y), x has certain length and y has certain length, the result is the length of x plus length of y and minus 1. So, now I have a long vector:

what do I do then to determine the time delay?

what the signal look like and what xcorr look like?

what do I do when I have xcorr to determine the time delay?

6.I know that have xcorr with bunch of complex number but I need only one real number. The real number that I want is the time delay. I take input data, I take received signal, I compute xcorr, then I do something to help myself to get the time delay. Result to that is single real number. But these are general ideas, I need to answer those question.

1. I have read this link: Time delay estimation of oscilloscope signals using cross correlation . It's really help my understanding, but they way he answered very high level, I think I need to understand the basic first, then continue with this link.

Thank you very much, everyone.

• @Nick Sinas : you have been working in time delay estimation before, I hope you can give me ideas. Thank you. – phuc nguyen Mar 14 '17 at 14:55
• @Mohammad: you have been working in time delay estimation before, I hope you can give me ideas. Thank you. – phuc nguyen Mar 14 '17 at 14:55
• For any direct-sequence spread spectrum (DSSS) signal like GPS, you want to correlate the received signal with the spreading code waveform. The output of the correlator will contain large peaks corresponding to points where the received signal lined up with the transmitted spreading code. You use the locations of those peaks to estimate the timing of the modulating signal. For the GPS application, there are many subsequent steps required to obtain the total time delay from the satellite, but this is how you start. – Jason R Mar 14 '17 at 15:38

For GPS, (simplifying for now by omitting corrections for ionsphere and orbit position and relativistic clock offsets), we determine the "Pseudo-range" to each satellite (SV), which will be the relative delay between all the received satellites we have correlated to relative to our local clock- using correlation as you described (delay each locally generated SV until you get a maximum peak and that delay value is your pseudo-range. Thus, as long as we have a pseudorange for at least 4 satellites, we can solve a matrix involving 4 equations with 4 unknowns: x position, y position, z position and time (which is the time error between our local clock and the clock of the satellite). The satellite's time keeping is highly accurate (using Atomic clocks) and the 4 equation solution allows us to use very inexpensive clocks in our local receivers.

Below is shown a simplified 2D explanation showing how unique x,y position is determined on a plane with 3 satellites and perfect knowledge of time. Note how with 2 satellites there are two solutions. The same thing occurs with 4 satellites and unknown time, it is just that one of the solutions is on earth and the other can be neglected as it would be out in outer space. In practice we benefit in a lower error solution by averaging over all satellites in view (forming a least mean square solution to an over determined set of equations). Below is a sample output of what the output of a sliding correlator looks like for a particular SV in an actual captured GPS signal (the signal itself is indistinguishable from noise since the GPS signal prior to correlation is approximately 20 dB below the noise floor). Here we see the result of the spreading code that repeats every 1 ms, and the specific location of the peak in time relative to any local time reference we choose is the "pseudo-range". These peaks are what you would get out of the Xcorr command (shown is the absolute value) and the horizontal axis where a peak occurs is the delay you are interested in finding. What is important is that all you need is the relative delay between all the satellites in view and your local clock reference (so you can pick any reference point you want as long as all codes are done with the same clock). What I have seen in implementation, and perhaps this would be more complicated than you need, is to have a code NCO in a code tracking loop that is used to generate the codes for each satellite, and the code tracking is done using three correlators for each SV in an early-prompt-late arrangement each offset by 1/2 a chip. Early minus Late correlator output would then be proportional to code error (once acquired) and drives the Code NCO to track the delay. In such a fashion the code generator is always kept in alignment with the received code (in contrast to the sliding correlator approach I show below), and the relative delay is determined by the relative position of each code. Below is the received signal prior to correlation (for the same signal used to generate the correlation plot above), with the blue representing the captured waveform after I had down-converted it to baseband and aligned it with the spreading code shown in red (as evidenced by the correlation peak). To note that any resemblance to the code that you think you might be able to see in the blue waveform to the red waveform is purely coincidental. The blue waveform in this view at this scale is visually indistinguishable from the AWGN process that is dominating it. This is how the transmitted signal looks at that satellite (just two states +1 and -1): And this is how that same signal looks as captured at our receiver, after down converting to baseband, removing all carrier and code offsets, and sampling at the mid point of each symbol (to match what we know was +1/-1 at the satellite). This matches very well to an AWGN noise process within the sampling space described, with no evidence of the signal without performing the correlation with the known sequence. To add to the simplified descriptions above, here is a link to a good reference on the complete PVT solution (position, velocity and time) using GPS: http://www.nbmg.unr.edu/staff/pdfs/Blewitt%20Basics%20of%20gps.pdf

• for example: when this system working, those 3 TXs going to transmit different signals and RXs going to receive all 3 signals listen for each of TX will transmit signal let say 100ms window. So, RX will listen for 300ms every second. In that 300ms, there will be 1st TX, 2nd TX, and 3rd TX. Now, in determine where RX is? I must determine delay for all 3 TXs. Since I have delay for all 3 TXs what I can do next? – phuc nguyen Mar 15 '17 at 0:21
• is it true when I say? if I take 10 samplings at 10 mega seconds, I have 300 ms, so I will have 3 million samples of receive data. And I have 25ms of data from each TX, so now I have three 250,000 samples long Transmit data. And I can compute xcorr of each of the transmit signal we receive data. Now, I have 3 vectors, there are each 3,350,000 points long. (cont.) – phuc nguyen Mar 15 '17 at 0:27
• For each of those three, I need to find the number correspond the delay of the TX signal from that TX and if you think about that processing will tell 2 important things to have to be true TX the signal for them to be useful in determining ranges. If is not right, please fix them for me! – phuc nguyen Mar 15 '17 at 0:27
• Read the link I put at the bottom of my post on how to solve the PNT equation once you have your pseudo-ranges, and all the correction factors involved and knowledge you need of the satellite position. But to see how it works with course accuracy you could just make up where the positions are. Also you will want at least 4 TX's. – Dan Boschen Mar 15 '17 at 0:27
• i will read it for more understanding, thank you for quick response. – phuc nguyen Mar 15 '17 at 0:28