Finding correct values based on information from two arrays Consider the following scenario:

Say, one machine is sending out a beep signal every 10 seconds in a very noisy environment. I have two sensors which detects these beeps independently. Device A is near to machine compared to B, so B always have a two samples delay compared to A. Since it is noisy environment, devices sometimes detects noise also as beeps and sometimes even misses the data.

Below is the data

A = [5,10,20,25,30,40,45,50]
B = [12,18,22,32,38,42,52]


See, A and B have beeps at 10 &amp; 12 which says beep @5 in A is a noise. Similarly @25 in A because 30 in A and 32 in B says they are the good data.

Similarly in B, 18 is a noise because there is a synchronized peak at @20 in A and @22 in B.

Below is a plot of that (red mark shows noisy beeps):



Question:

Is there any mathematical/signal processing method which I can use to find the location of correct beeps based on the synchronized information available from two datas and get rid of the noisy ones?
This is a fairly easy task. The reason is that your signals are monotonically increasing and encode the same additively evolving time information. 
First of all, I suggest you subtract 2 from B. Then what you do is:

1) Start at position 0 on A and position 0 on B and maintain 2 separate indices (say $i$ and $j$) for traversing A and B.

2) Compare current values of $A$ and $B$: $A_i$ and $B_j$.

3) The moment where $A_i &gt; B_j$ increase $i$ : $i=i+1$.

4) The moment where $B_j &lt; A_i$ increase $j$ : $j=j+1$.

5) The moment where $B_j = A_i$ you have a beep. Increase both indices.

6) Goto step 2 and repeat until you reach the end.