LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

peak detector

Hi,
I'm acquiring air flow.The shape of the graph is like a sine wave. I want to calculate respiration rate which is the differnce of the positive peaks.I used peak detector but it calculated negative peaks too.Thus,i I saw respiration rate -80,etc. How can I detect only positive peaks.
Thanks in advance.
0 Kudos
Message 1 of 4
(2,970 Views)
burcu;

The Peak Detector.vi has and input that allows you to select between peaks and valleys. Make sure you select "peaks".

However, anyway if you are reading peaks or valleys, you should not be getting negative values. Make sure you are calculating the difference in time between peaks rather than the difference between peak values. It is not strange to get those confused 😉

Regards;
Enrique Vargas
www.visecurity.com
www.vartortech.com
0 Kudos
Message 2 of 4
(2,970 Views)
Thanks for your help . I tried to calculate the difference in time between peaks .But i'm not sure if i did the right thing or not,I'm a beginner in Labview. Would you please check the vi enclosed.
Thanks in advance
0 Kudos
Message 3 of 4
(2,970 Views)
burcu;

I cannot run your code because there are some VIs that are missing ("ADAC Get Board Selections" and "ADAC AI Continuous Scan"). Anyway, chances are they include a dll call or something that communicate with the hardware, so I won't be able to execute it anyway.

Just looking at your code, if you are using the default values, the sampling at 1 kHz and then requesting only 100 points at each loop, you are not going to see anything! I am not expert in physiology, but if you are measuring respiration... let say a person breathe normally at an average of 1 full cycle every 4 seconds, then the input to the Peak Detector VI is a straight line, thus only one peak! Try changing the parameters to something like 100 Hz and 800 points. If the br
eathing assumption is correct, you should acquire about two full breathing cycles. 100 Hz is still a lot resolution for a signal so low in frequency. Try lowering the sampling frequency to 20 or 10 Hz. Even if you keep the number of points at 100, you will get more peaks that you need. The key is to learn how to manipulate the sampling rate and the number of samples.

Finally, to calculate the breathing rate: once you substract the points as you are doing, multiply that number to the actual sampling period and then invert.
www.vartortech.com
0 Kudos
Message 4 of 4
(2,970 Views)