0
$\begingroup$

I am trying to extract breaths from a respiratory signal, which is essentially peak detection. See the example below for what such a signal looks like. This particular signal looks rather clean, however, lower amplitude noise is very common (both high and low frequencies).

I have tried the ones mentioned here, however, those seem to require that the height of the peak can be described by its y-value. As you can see below, the signal is very prone to baseline wander, and the top of a peak can very well fall below 0.

Any suggestions for a peak detection algorithm?

enter image description here

$\endgroup$
1
  • $\begingroup$ Did you try my solution? $\endgroup$ Commented Mar 16, 2018 at 19:28

3 Answers 3

2
$\begingroup$

I have a slick trick which may do what you want.

Do an exponential smoothing in the forward direction, call it F.

Do an exponential smoothing in the backard direction, call it B.

Take the difference of these two D = (B - F) / 2. (Rescaling by half isn't necessary)

This will do two things for you:

1) Smooth out the noise

2) Convert peaks (and troughs) to zero crossings, no matter what their height.

You can find details in my blog article "Exponential Smoothing with a Wrinkle". There is a "ramp up" and "ramp down" zone at the beginning and the end that you should not use. They are fairly short and their length depends on your smoothing factor.

Hope this helps,

Ced

$\endgroup$
1
$\begingroup$

A running standard deviation can be used to create a new vector for the detection. It is essentially an easy way to find the steepest gradient. If normalized, I don't think you will need a bandpass filter.

$\endgroup$
4
  • $\begingroup$ Can you please elaborate? $\endgroup$
    – A_A
    Commented Mar 19, 2018 at 15:27
  • $\begingroup$ It would give a cheap way of finding the steepest gradients. A vector that maybe takes 3 points in the signal, takes the std and then moves along the signal creating a new signal. But I think the input signal would need to be normalized before it can work. $\endgroup$ Commented Mar 20, 2018 at 17:02
  • $\begingroup$ I understand, I am not asking for myself but to make the response more useful to the original question. Does STD stand for Standard Deviation? $\endgroup$
    – A_A
    Commented Mar 20, 2018 at 17:08
  • $\begingroup$ Oh, sorry yes. I'll edit the main. $\endgroup$ Commented Mar 20, 2018 at 17:50
0
$\begingroup$

I am slightly confused in what you mean with "extract breaths from a respiratory signal". If you just want the noise free signal, bandpass filtering is certainly sufficient when you just use fourier transform first to find frequencies of interest. You will have to utilize more than one peak to reconstruct the signal with all its amplitude variations but they should stil be in a clear frequency range.

Do you have any extra information about the signal(s) (such as noise level, sample rate, etc) that limits your potential approach?

$\endgroup$
2
  • $\begingroup$ I want to get the index (i.e. position) of the peak of the breaths, such that I can calculate for example how many breaths there are in a given minute, their mean height, etc. $\endgroup$
    – user33236
    Commented Jan 15, 2018 at 16:58
  • $\begingroup$ And is your SNR so low that you can't distinguish peaks? Do you have an example signal (with noise) to show what you are working with? In any case, I would suggest frequency filtering and then simply use the findpeak function from matlab. I have myself also solved simliar tasks with that. $\endgroup$ Commented Jan 16, 2018 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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