0
$\begingroup$

I have this signal as the following figure:

Rx Signal

Now, I need to know each beginning index of each pulse as described in the following figure:

First Peak Of Each Patch

I have tried to detect the peaks through obtaining the cross correlation function with the sequence that I am sending and the Signal that I am receiving (which is exactly as if am doing auto-correlation). But they are not aligned as the following figure:

Comparison of original signal and its cross correlation

Can you suggest a solution to this problem, please? I am kinda stuck and this is my last step in my project.

I can show the codes if needed.

$\endgroup$
  • $\begingroup$ This looks like you simply need to use a threshold to compare your signal to. What's wrong with that (very straight-forward) method? $\endgroup$ – Marcus Müller May 7 '18 at 17:08
  • $\begingroup$ Can you provide the code and data? $\endgroup$ – Seth May 7 '18 at 18:00
  • $\begingroup$ @MarcusMüller I tried to use threshold before, but my data is not at the same level, so I cannot take one threshold to all the snaps at a time. I only can take for each snap, which will cost me a lot of time. It is not efficient also to take threshold for every batch of data alone. $\endgroup$ – OMAR MOHAMED MOHAMED IBRAHIM A May 8 '18 at 10:44
  • $\begingroup$ @Seth I can provide it though email. Please send me your email. $\endgroup$ – OMAR MOHAMED MOHAMED IBRAHIM A May 8 '18 at 10:44
  • $\begingroup$ How about thresholding with the average of each batch? that wouldn't be a big loss in efficiency, would it? also, how about using a median filter and a derivative to detect the edges? $\endgroup$ – Florent May 10 '18 at 6:57
1
$\begingroup$

filtering -> thresholding -> edge detection

apply low pass filter:

averageFilterCoefficient = 0.01
for each sample of x:
  y[i] = y[i-1]*(1-averageFilterCoefficient) + x[i]*averageFilterCoefficient

this simple code should remove all high frequencies and produce more smooth signal. Now apply thresholding:

threshold = 100
for each sample of y:
  if y[i] > threshold then
    z[i] = 1
  else
    z[i] = 0

Now you have nice logical signal, lets find rising edges:

for each sample of z:
  if z[i-1] = 0 and z[i] = 1 then
    print i

You just need to find the right values for exponential average filter coefficient and thresholding level.

$\endgroup$
  • 2
    $\begingroup$ You don't have a moving-average filter, you have an exponential average filter. $\endgroup$ – Ben Jun 6 '18 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.