| 119 | The solution to this is to add something known as a barker code to the beginning of our signal. This is a special code that is "random," but both receiver and transmitter know what it is. So, at the transmitter, we compare the barker code to every timestamp in the signal and see which timestamps match the closest. We then know that the barker code occurred at those locations. Knowing one barker code can tell us where the signal starts. Knowing two can tell us the frequency offset based on the time difference between the two. |
| 120 | |
| 121 | [[Image()]] |
| 122 | |
| 123 | In reality this is done using a mathematical tool called correlation which compares multiplies the two signals at every time point (you can imagine the shorter barker code scrolling across the longer signal) and takes the integral/area under curve. After correlating with both I and Q, the result of each is squared and added together. The final correlation is shown below |
| 124 | |
| 125 | [[Image()]] |
| 126 | |
| 127 | After finding the frequency offset and phase, we can multiply each IQ sample by some exponential e^(-''i''<delta>) where <delta> stands in for the error / angle offset of that sample. When multiplying numbers in the complex plane, the angle of the two are added allowing us to easily correct every sample. Now we see why complex numbers are useful. The corrected IQ samples are shown below. |
| 128 | |
| 129 | [[Image()]] |
| 130 | |