03-03-2010 09:26 PM
Is your program not functioning like you expect it to? Or are you having trouble optimizing the code? If you're not seeing the results that you expect, then it might help to see what the results you are getting and what you expect them to be.
If you're looking for programming/optimization tips, then you might want to start by modularizing your code. Even though you might be prototyping it right now, it could be helpful down the line to have already created subVIs that do some of the operations you're looking for. This should help clean the code and make it easier to debug if there is a problem. I'm not quite sure how to optimize the algorithm itself, just because I'm not too familiar with heart rate analysis :), but I don't see any obvious problems.
03-08-2010 12:37 AM
The problem is that I don't have any known correct data to compare my results to, so I am having to trust the calculations.
If you could clarify that I am on the right track with the frequency bins then that would be helpful. Here is my understanding so far :
Frequency resolution = Sample rate / Number of samples
Therefore in my example (Sample rate 100Hz, Number of samples 10,000) then the resolution is 0.1Hz and the number of bins in the output array (from FFT) is 10,000.
One thing that springs to mind is that this would give an upper frequency limit of 10,000 * 0.1 or 1,000Hz. Surely this is wrong since it is way above the nyquist frequency?
Second question is that if I want to look at power for the the bottom 1Hz of data, then is this simply 10 array elements of data (1 hz / frequency resolution = 10) ? So my output array elements 1-11 would contain the required data (I omit element 0 as according to the FFT help page this contains the DC component).
Does this all sound sensible so far? 🙂
03-09-2010 11:52 AM
03-15-2010 08:56 PM
Yes my math was a little off there, oops 🙂 Thanks for the suggestion of looking at the df component of the PSD instead of trying to work it out beforehand.
With regard to your question of the number of samples. My data starts off as an array of heart rate intervals such as the following
0.60
0.61
0.60
0.65
0.70
0.62
I am taking a subset of this (say for example the last 20 beats), and then passing this to the "Align and Resample" VI with spline interpolation.
I see a potential issue here in getting the required 5000 samples though, since I want to use a subset of the recent heart beat times over no more than a 30 second period. This means I start off with only 30-40 samples and would have to interpolate all the rest, would this introduce a lot of error?
03-16-2010 04:34 AM
I have a feeling that something is fundamental wrong in your setup. In order to do HRV analysis you need to collect a lot of heart beat to beat intervals and then do analysis on the result. You can not use the acquired SPO2 signal for this analysis. As your result will be a soup from of many signal sources. You must separate the beat to beat variations from your signal. Also in order to have a good HRV analysis you must do continuous measurement for a quite long period, say 10 minutes.

03-16-2010 07:34 AM
NikT,
Heart rate data is non-uniformly sampled data. This means that you cannot use Fourier transform methods (such as PSD) directly because they require uniform sampling. Coq Rouge mentioned this in message 5.
You may need to spend more time with the mathematics and the literature related to your task before worrying about the program.
Lynn
03-16-2010 10:48 AM
johnsold wrote:NikT,
Heart rate data is non-uniformly sampled data. This means that you cannot use Fourier transform methods (such as PSD) directly because they require uniform sampling. Coq Rouge mentioned this in message 5.
You may need to spend more time with the mathematics and the literature related to your task before worrying about the program.
Lynn
That will be a good idea. Have you discussed your setup with your teacher? Because I do not think you are on the correct track at all.

03-16-2010 11:08 PM
There is no SP02 data, the array is an array of R-R intervals in seconds.
To perform frequency domain measures on this data it is plotted on a tachogram
I cite http://www.macses.ucsf.edu/research/allostatic/heartrate.php summary
"Frequency measures involve the spectral analysis of HRV. Briefly, R-R interval data are represented on a tachogram (Figure 1), in which the y-axis plots the R-R intervals, and the x-axis the total number of beats. Spectral analysis of the tachogram transforms the signal from time to frequency on the x-axis, by representing the signal as a combination of sine and cosine waves, with different amplitudes and frequencies"
This is what I am doing, by using the R-R intervals as the Y component and resampling/interpolating this to make a uniformly spaced sequence.
However after revisiting the above journal I have noticed an oversight on my part - I was interpolating with a fixed dt value which is naturally wrong since the R-R intervals are ocurring at different time points! I am glad that you are questioning the basis of the data as it is making me double check everything 🙂
The standard I am following is that published by American Heart Association/European Society of Cardiology and I think I am following it properly
"The series of data subjected to spectral
analysis can be
obtained in different ways. A useful pictorial representation
of the data is the discrete event series (DES), that is, the plot of
RiRi-1 interval versus time (indicated at
Ri occurrence), which is an irregularly time-sampled
signal. Nevertheless, spectral analysis of the sequence of
instantaneous heart rates has also been used in many
studies.26
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,"
A quick question - What is the most reliable way to interpolate an irregularly time-sampled signal? Until now I was incorrectly using the Align and Resample VI which only allows a fixed dt.
03-17-2010 03:40 AM
I still do no not think your approach is optimal. You may not be aware of it but we have a Biomedical User Group here http://decibel.ni.com/content/groups/biomedical-user-group.
So why not move your question to that group.
