I have a noisy signal that roughly switches between two distinct amplitude levels, i.e. looks like a pule train with irregular pulse with and small variations in the "on" and "off" amplitude over time, part of it could look something like this:

enter image description here

I'm looking for a robust algorithm that will produce a "good" (I'm not sure what criterion to apply here) binary decision threshold from this signal such that signal samples with amplitude above that threshold correspond to plateaus and samples with amplitude below the threshold correspond to minima.

  • $\begingroup$ Can you simply look at the differential of the signal? This may help you locate the falling and rising edges. Will this do the job for you? $\endgroup$ – havakok Apr 24 '19 at 8:17
  • $\begingroup$ That sounds sensible, but I'm not sure how get a threshold value out of that. I'm thinking I could detect peaks in the derivative, use those to split the original signal into "low" and "high" regions and then calculate the average amplitudes of both categories and obtain a threshold from that. Is that what you had in mind? $\endgroup$ – Peter Apr 24 '19 at 8:26
  • $\begingroup$ Almost, I would start, as you said, by splitting. I will then continue to normalize each split separately. Normalizing will be enough by subtracting the average and dividing by the max absolute value per split. After normalization, all signals will be nested around 0 with amplitude smaller than 1. You may now concatenate them and threshold on 0This may do the trick? $\endgroup$ – havakok Apr 24 '19 at 8:34
  • $\begingroup$ What is the range of your amplitude? Your question is very vague, an answer could be put an threshold above the mean of the max and min value. It seems that epochs where the signal is going down are very short in time. You could therefor also calculate the mean and variance of the epochs in the "high" state and define the threshold based on these values ... $\endgroup$ – Irreducible Apr 24 '19 at 8:36
  • $\begingroup$ I don't really have more information about the problem than that the signal looks similar to the picture above over its complete duration, i.e. I don't have concrete limits for the "high" and "low" amplitudes. I just now tried splitting the signal by looking at the derivative but I'm finding it hard to locate the peaks in the derivative because they are not super distinct due to noise. $\endgroup$ – Peter Apr 24 '19 at 8:57

Your Answer

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

Browse other questions tagged or ask your own question.