Wednesday 3 June 2015

How can I align these two signals? Cross correlation isn't working properly


I have two radios sampling simultaneously, and I am trying to time-align their two signals (they will always start sampling at slightly different times with random delays due to hardware differences). I have a circuit that automatically switches between the antennas and nothing at a set interval, and I'm trying to use the transitions between signal and silence to determine how to time-align the two signals. I tried using cross correlation to find the shift between the two signals, but it's not getting the correct alignment (it's very off). I suspected it was due to the signals being too noisy, so I smoothed them both and tried to make their amplitudes similar, but it still didn't get the right alignment.


Here's a screenshot of an example of the two signals. The image is zoomed in to the region where the circuit switches the radios from nothing to the antennas, and I would like to align the two signals such that these transitions match up.



Two signals


EDIT: Here are text files of two more signals that I'm trying to align: s0.txt s1.txt. When they're aligned, they look like this:


enter image description here


(note that these are not the same signals in the previous picture). I found the optimal delay to be 1069 for the first signal. I used other methods to find the delay (described in a comment below), but I would like to reproduce this result using cross correlation as I believe it will prove to be more reliable / precise.



Answer



If the above is a good representation you should just try to infer when there is energy in the signal to align them.
As it seems they start with nothing (Zero value).
Then all needed is just to find where "Something" happens. This could be easily done with high resolution (Few samples).


Regarding Cross Correlation, try to normalize both signal to have the same Maximum Value (Normalize both to have amplitude of 1).


In the case above you'll be able to say where the alignment point is.

Pay attention that if the whole signal is harmonic then the cross correlation is harmonic as well.


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...