peterhcharlton / RRest

Algorithms to estimate respiratory rate from physiological signals
http://peterhcharlton.github.io/RRest/
Other
162 stars 60 forks source link

algorithm question #6

Open jsjs1 opened 6 years ago

jsjs1 commented 6 years ago

Great work, I have enjoyed getting to play around with the simulation framework you produced. I have two questions:

1) For fm, why do you divide the amplitude by 2? 2) For am, why do you detrend the unmodulated signal? What benefits does that provide?

Thanks J

peterhcharlton commented 6 years ago

Hi,

Glad you've found it useful, and thanks for your questions. To answer:

  1. The coefficient of the frequency modulation specified on line 94 of this function is half that of the coefficients used for amplitude modulation and baseline wander. The coefficients are arbitrary, and I found that using the same coefficient for FM as for AM and BW resulted in extremely large variations in beat-to-beat intervals, which were too large to be close to normal physiological variations. Hence, the coefficient was halved.

  2. The detrending performed on line 240 of this function is necessary to achieve the desired amplitude modulation. Initially, the unmodulated signal occupies the range of 0 to 1. The amplitude modulation is added by multiplying the original signal values by an offset cosine function (with a mean of 1). Consequently, if the unmodulated signal was used, then the lowest values (at 0), would not be exposed to any amplitude modulation (since 0 multiplied by the cosine function will be 0). Detrending the signal prior to the multiplication ensures that both the lower and upper parts of the signal are subject to amplitude modulation. It may be helpful to visualise this by trying it with and without the detrending step.

Hope this helps

Pete