From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating rate

I have a program that reads an analog input from the DAQ and, using a derivative and peak detect function, counts how many breaths have taken place (it uses a thermistor). I was finally able to get the breath counter right, however the overall goal is to determine respiratory rate, every ten second interval. What I tried gives a ridiculously high rpm rate (something like 7128 for 12 breaths).

 

Also, I tried the traditional method of peak detect, but it wouldn't work, the locations don't show up. The thing is, this vi can detect the peaks, but it can't determine the locations. I was wondering if there is some way to, every ten seconds, multiply the number of detected peaks by six (to get the rate of respirations per minute) then refresh the counter to zero and repeat this process. Thank you.

Download All
0 Kudos
Message 1 of 3
(2,276 Views)

Hi Bombercules,


First of all, are you sure, your program is detecting the peaks correctly? I am asking this because respiratory signals are one of the most unstable and fluctuating biological signal when compared to signals like ECG...and the peaks are usually very wide. So the NI Peak detectors may detect multiple peak locations for a single peak unless you develop an algorithm specifically for your peak detection. So I would suggest you cross check the detected peaks before proceeding further.

 

Did you try going through the posts in Biobench? You may post this question there as most of them have gone through these kind of problems earlier..


Regards,

Nitzz

(Kudos are always Welcome;)) 

0 Kudos
Message 2 of 3
(2,258 Views)

Hello NitzZ,

 

It works, at least for me, I'm not 100% sure it will work on its intended subject (a rat). I tweaked it a lot to make sure it worked, and the peaks are very wide which posed a problem early on, also since it is a thermistor and the temperatures fluctuate slightly, I couldn't do a peak detect on the actual voltage signal. However, because the change is more dramatic than natural fluctuation, I determined I could do a peak detect on the derivative of the signal. I still had the same problem with the width though, so I used the PtByPt threshold peak detector, and all that returns is a boolean (true when above and false when below). The threshold itself will depend on the subject, so it's not perfect, but basically it counts every time the boolean from the peak detector vi switches from false to true. Although detecting the respirations is the main objective, the data isn't really useful unless it can be conveyed as a rate.

 

I will take your advice and post this question there, I did a quick look and didn't find any similar questions (I've been searching this for a week or two now so I've looked almost everywhere). I just had a breakthrough Tuesday (being able to detect respirations at all) and I had basically no progress before that and didn't want to ask for too much help here. I feel there should be some sort of case structure that could reset the counter to 0 each time, then I could use the case structure I tried originally that took the number of detections every ten seconds and multiplied by 6 (the ten seconds is somewhat arbitrary, but if it was just the time between the peaks I feel the numbers would be somewhat misleading unless the breathing rate didn't fluctuate at all, which is a lot to ask when a rat is being operated on).

0 Kudos
Message 3 of 3
(2,230 Views)