Life Science

Showing results for 
Search instead for 
Did you mean: 

How to measure distance between R-R peaks

To process your signals, you are going to have to become well versed in this stuff.  NI does have a adaptive filter toolkit now, and maybe that might help you.  Unless you can enhance your ECG detection, you are going to have problems extracting it from the noise whether you eliminate the respiration signal or not.


For what I sent you


1.  Taps are the number of acquired points that are being processed each time through the loop.  Essentially, each time through the loop, the oldest point is dropped out of the taps as the newest point is added.


2.  Weights are the filter coeffiecients of the adaptive filtering.  They are computed each time through the loop to minimize the error signal.


The error signal is the feedback that tells the filter how well its current coefficients are working.  It also is your output signal.  The Beta defines how much your coefficients can change from loop iteration to loop iteration.  The higher it is, the more responsive your filter will be.  If it is too high, the filter will become unstable and will not work.  If it is too low, it will not filter as effectively as it could.  The values I saved as default values are in the right ballpark, but may not be optimum.



 The adaptive filter is used to help clean up your data.  Until you can clean it up enough to reliably find the R peaks, it will be difficult to compute anything.


Message Edited by rpursley8 on 10-30-2008 08:03 AM
Randall Pursley
0 Kudos
Message 21 of 36

Dear Mr.Pursley,


can you give me some resources for the adaptive filter toolkit where I can get some information to process or enhance my signal. I looked at the examples on labview but I could not find much on signal enhancement.

0 Kudos
Message 22 of 36

Dear Mr. Zhijun Gu,


thanks for your mod vi, why is that I cannot run any of the other signals using your mod vi. I can only run "R10-R10_closed cover_Bhavin1_1.lvm" signal here and that too its not continous it just scans for a few seconds and then stops, how can I make this to run continously.


thanks for your time

0 Kudos
Message 23 of 36

I think you are going to have to work on signal enhancement in hardware before worrying about the software.


The Adaptive Filter Toolkit info can be found here

Randall Pursley
0 Kudos
Message 24 of 36

thanks for the link, due to short time constraints it is not possible for me to work on the hardware signal enhancement, and my task is to extract the best signal conditioning from this hardware, so I am really bound by time and trying my best to get HRV out of this signal.


I have downloaded the trial version of adaptive filter toolkit..its for 30 days only..although my signal is full of noise but in some of the previous recorded signal that I have sent, I can see ECG, I know its not very clear, but I have to work with them only, as I dont have any option at the moment.


From the attached screenshot you can see some ECG signal but my I am not sure weather I am getting the correct measurements here..your previous data mod vi works absolutely perfect with the conventional ECG, but with my signal it looks as in screenshot. I have a doubt with the locations of Heart rate, when I change the location to 1,2,3,4,...and so on it shows different heart rates every I am confused by this, can you explain me what exactly is happening here..I have to display a mean heart rate, and mean value of R-R interval at the can I do this.


thank you for your time,


Message Edited by infra444 on 11-03-2008 09:38 AM
0 Kudos
Message 25 of 36

It looks like you are getting the right signal, but you may have to adjust some parameters to optimize it.  You might try to increase the width parameter of your Peak to avoid detecting the double peaks.  You should also play with the filters and wavelet stuff to see if a different wavelet or cutoff frequency works more effectively.


Instead of getting a heart rate measurement from each R-R distance, get a single number for each 5 second set of data.  In addition, you know that heart rates should be between let's say 50 and 300 bpm.  Any number outside the range should be thrown out before averaging the distances from the remaining peaks.


You might even try to average across a 10 second span to get more peaks for an average.  Create a 10 second buffer of data and each time through the loop drop off the oldest 5 seconds worth of data and add the new 5 seconds worth of data.

Randall Pursley
0 Kudos
Message 26 of 36

Here is some info on an article that just came out that you might look into.





Tonometric Arterial Pulse Sensor With Noise Cancellation
Ciaccio, E.J.; Drzewiecki, G.M.;
Biomedical Engineering, IEEE Transactions on
Volume 55,  Issue 10,  Oct. 2008 Page(s):2388 - 2396


Arterial tonometry provides for the continuous and noninvasive recording of the arterial pressure waveform. However, tonometers are affected by motion artifact that degrades the signal. An arterial tonometer was constructed using two piezoelectric transducers centered within a solid base. In two subjects, one transducer was positioned over the radial pulse (p) and the other was positioned on the wrist not overlying the pulse (n). The presence of induced motion artifact and any noise was removed after signal digitization by noise cancellation. Besides fixed weighting, two adaptive algorithms were used for cancellation-LMS and differential steepest descent (DSD). Criteria were developed for comparison of the adaptive techniques. The best fixed weighting for noise cancellation was w = 0.6. For fixed-weighting, LMS, and DSD, the mean peak-to-peak errors were 1.22 ± 0.54, 1.18 ± 0.30, and 1.16 ± 0.23 V, respectively, and the mean point-to-point errors were 15.86 ± 3.15, 11.40 ± 1.96, and 10.13 ± 1.25 V, respectively. Noise cancellation using a common-mode reference input substantially reduces motion artifact and other noise from the acquired tonometric arterial pulse signal. Adaptive weighting provides better cancellation than fixed weighting, likely because the mechanical gain at the transducer-skin interface is time-varying.

Randall Pursley
0 Kudos
Message 27 of 36
thanks for the article..I will look into it..
0 Kudos
Message 28 of 36

Dear Mr. Pursley,


I have modified a vi based on your previous adaptive filter concepts, I really dont know if this makes sense here. Kindly have a look at my attached files.

I have 3 data samples here (Real ecg) that is conventional ecg and the other two are samples from my real time measurements with DAQ device.

In the second data sample R10-R10_closed cover_Bhavin1_2,  the output after wavelet denoising looks good, only thing is I am not able to get the

heart rates and the intervals here. Kindly have a look at it.


thanks for your time,




Message Edited by infra444 on 11-17-2008 07:22 AM
0 Kudos
Message 29 of 36
You have very little repeatability from beat to beat.  The amplitude changes dramatically which makes it very hard for the peak detector to identify all of the desired peaks.  Most ECG measurments count on ECG having very slow changes in amplitude (over many seconds).  Your data has ECG peaks whose subsequent peaks over half as large as the previous peak.  I'm not sure what else I can suggest.
Randall Pursley
0 Kudos
Message 30 of 36