LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate power in specific frequency band

Hi Everyone. I have been trolling on here for months but this is my first post so I hope I am putting this in the correct place.

 

What I am trying to do is simple in theory but I have tried over and over and am having no luck in getting this to work. I wish to calculate the power in specific frequency bands for heart rate variability analysis.

 

Referring to the article "Using LabVIEW for Heart Rate Variability Analysis"  http://zone.ni.com/devzone/cda/epd/p/id/5832 I am aware of the steps I need to follow.

 

I have plotted the RR intervals and resampled these with cubic spline interpolation to give a nice time dependent series. I then wire this to a PSD VI and this is where I am out of my depth.

 

I know from the above article that I am looking for power in these frequency bands

 

VLF   ms2 Power from 0–0.04 Hz.
LF   ms2 Power from 0.04–0.15 Hz.
HF ms2 Power from 0.15–0.4 Hz.

 

 

The NI Biomedical Startup kit can do these, however I am unable to look into the source code as I do not have some required plugins in my installation. I have LabVIEW 8.6 full development system.

 

As this is not my area there is a steep learning curve and I have read many forum posts and pages but am still unsure of what I need to do here.

 

It is my understanding that the frequency resolution is simply the sample rate/number of samples. So if I require a resolution of 0.01Hz then theoretically 100Hz sample rate and 10,000samples would give me this.Furthermore I gather that the size of the output array from the PSD VI is equal to the # of data points (This i have just noticed from trial and error so I may be wrong).

 

Therefore if I am using the above values then is it correct that PSD would return an array and all I need to do is simply sum the contents of those array elements to get the power?

For example if frequency resolution is 0.01 , then to get power from 0-0.04Hz I must simply add the first 4 elements in the PSD output array?

 

I have made a test VI to show what I am talking about and attached it to this post.

 

Some feedback on the required approach would be a lifesaver here. I have purchased a couple of books and read through pages of forum posts but am still having trouble with this.

 

Many thanks!

 

 

 

0 Kudos
Message 1 of 19
(7,960 Views)

Hi NiKT,

   Please try to place some band pass filters before giving the input to PSD vi.Since three bands are there so band pass filters and three PSD vis.

 

 

Thanks and regards,

srikrishnaNF

Message Edited by srikrishnaNF on 02-24-2010 05:25 AM
Regards,
Srikrishna


0 Kudos
Message 2 of 19
(7,947 Views)
Can you post your code with some data?


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 19
(7,941 Views)

Thanks for the quick replies.

 

As I said, it is not implemented so there is no code with data that I can post. The VI is doing a lot of other stuff as well but I have screen shotted the relevant portion but I am unsure how intuitive it will be to look at so I will try and summarize what is happening.

 

1. Case block is exectuted when peaks are found in heart signal

2. Time location in seconds of peak is noted

3. An array is constructed of the time between successive peaks

4. There is some heuristic based code to trim outliers out of this data if they vary greatly from the previous reading

5. This array of time values is resampled and interpolated to form a time based sequence suitable for PSD

6. The output of this sampling is suitable for the PSD power measurment. However at this point I wish to see power in the specific frequency bands listed in the previous post (VLF, LF and HF bands).

 

Note - for the data going into the PSD function I arbitrarily chose to use a subset of 200 data points from the array. What I really need is a window of say 20 seconds worth of data each time so I expect this number of data points needs to be bigger.

0 Kudos
Message 4 of 19
(7,921 Views)

Please send your code. We can not debug a pictureSmiley Indifferent And I also have some ideas. For example I would have used the Unevenly Sampled Signal Spectrum VI

Unevenly Sampled Signal Spectrum VI
Owning Palette: Spectral Analysis VIs

Requires: Full Development System

Calculates the power spectrum of a signal that is unevenly spaced in time.

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 19
(7,905 Views)

Sorry about that, I didn't realize you wanted to run the code too 🙂 The VI was doing a bunch of other stuff so I have tried to clean that out and just leave the relevant bit. As mentioned above, the case block executes when a peak is detected in the data and appends this value to an array.

 

I am using the technique of resampling the data because this is what was mentioned in this http://zone.ni.com/devzone/cda/epd/p/id/5832 and also in another reference that I have been following titled "Heart Rate Variability Standards of Measurement, Physiological Interpretation, and Clinical Use" http://circ.ahajournals.org/cgi/content/full/93/5/1043 which states

"The spectrum of the HRV signal is generally calculated either from the RR interval tachogram (RR durations versus number of progressive beats; see Fig 5a,b) or by interpolating the DES, thus obtaining a continuous signal as a function of time, or by calculating the spectrum of the counts–unitary pulses as a function of time corresponding to each recognized QRS complex.35 Such a choice may have implications on the morphology, the measurement units of the spectra, and the measurement of the relevant spectral parameters. To standardize the methods used, the use of RR interval tachogram with the parametric method, or the use of the regularly sampled interpolation of DES with the nonparametric method may be suggested; nevertheless, regularly sampled interpolation of DES is also suitable for parametric methods. The sampling frequency of interpolation of DES must be sufficiently high that the Nyquist frequency of the spectrum is not within the frequency range of interest. "

 

 

0 Kudos
Message 6 of 19
(7,880 Views)

Thank you for the code. My first question is does it work? Because I see some details that I suspect are wrong. I think your approach is not optimal. Also what do you want to achieve with this code, and what kind of project is this. I am asking this in order to help you better. Also are you using ECG or some other source like SPO2.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 19
(7,874 Views)

I beleive it is working satisfactorily in terms of detecting a pulse and logging the data. I have attached a screenshot of the signal that I am getting from my hardware, and although it is a bit faint if the sensor is not positioned carefully, it seems to be doing the job.

The hardware I am using is a simple Vishay TCRT1000 reflective optical sensor with transistor output, this is fed directly into the NI9215 DAQ. The sensor is placed on the fingertip.

 

That being said, I'm quite sure that my approach is not optimal as this is my first LabVIEW development and I am adding on new functionality as I learn it rather than planning the whole project ahead.

The work is for my research degree in I.T, I am investigating some affective computing applications for e-learning. To do this, I wish to monitor these physiological markers while participants carry out certain tasks (such as viewing evocative images and doing some reasoning tests). The data I collect in this study will help me establish some norms which I can apply to my software development.

Message Edited by NikT on 02-26-2010 03:21 AM
0 Kudos
Message 8 of 19
(7,871 Views)

Just a tip. From your waveform I think it would be much better to detect the valleys not the peaks 😉

Edit: Sorry I am used to using ECG then doing this kind of work. From your code I can see that you are doing the as I said

Message Edited by Coq Rouge on 02-26-2010 12:12 PM


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 9 of 19
(7,857 Views)

I would guess that the technique for measuring power in band would be the same for ECG too. Although I don't think its something that people do.

Any other suggestions on how to tackle this?

0 Kudos
Message 10 of 19
(7,811 Views)