Hi Burcu !
Still stuck with peaks ?
😉There is nothing strange in your integration signal : You are integrating over the whole signal range, and your data present a small offset. That gives a continuously increasing result.
Remember : the integral of a constant is a straight line.
And the integral of a sine function is a cosine function.
This second statement explains why you do not obtain the lung volume : you are integrating over the whole signal, instead of integrating on only a breath duration!
I suppose that your signal is the air flow rate (BTW, what is the signal unit ? ml/s, l/min ?). You are apparently recording both positive and negative air flow : air entering and leaving the lungs. Of course, the sum of the two operations should be near zero, since respiration produces an amount of CO2 (as volume) nearly equal to the consumed O2. Otherwise the lungs would collapse (out>in) or explode (in>out)!
What you have to do is to detect the instants when the air flow crosses the zero value (ie going from breath in to breathe out, or the reverse), and integrate the signal only between these two instants. You will get result which sign will depend on the breath direction.
I'm sure that with Randall help's you will rapidly find the solution now.
CC
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...