10-15-2015 07:18 AM
Hi all,
I am doing a project on LabView to make a PPG that will monitor heart rate (see attached). Ignore the part of DAQ assistant data, for now someone else is configuring the data input so for now I am using the function simulate signal. I set it as 1.5 Hz since it is around 90 per minutes. It produces a most recent frequency and an average frequency over time (the one with collector).
The first improvement I would like to make is allowing it to calculate the change of heart rate, any idea how to?
The second is detecting peak frequency. I considered using shift register, greater than function and case structure, wanting to let some value replacement take place if the new value is greater. However, the greater than function does not seem to connect to case structure because it is a 1D array of Boolean. Any other suggestions?
As for spectrum, I suppose my teacher is asking for a histogram on all the available frequencies. I added the histogram in but was wondering if there are any better ways to do this?
Thanks all!
Edwin Neo
10-15-2015 08:46 AM
Edwin Neo,
As a general comment you may want to move away from the Express VIs. While they work for simple processes, it is difficult to customize them when you need to do something more complicated. Also the configuration process and the (evil) Dynamic Data Type obscure information about what the program is doing.
Next. Do some math. The simulated signal you generate has a sampling rate of 200 Hz. A 50 Hz signal will be represented by 4 samples. A 50.01 Hz signal will be represented by 4 samples except maybe one time in 5000 trials when only 3 samples will be collected. Your bandstop filter almost never does anything. Try bypassing the other two filters and reducing the signal amplitude to zero, leaving only noise. Run the output of the bandstop filter directly to the Spectral Measurements VI. You will not see a notch in the spectrum at 50 Hz because it almost never sees any energy at that frequency. The period of a 50 Hz signal is 20 milliseconds. The period of the 50.01 Hz signal is 19.996+ milliseconds. To accurately measure and resolve such small differences you would need a sampling rate in excess of 250 kHz or very large data sets.
It will be difficult for you to tell whether the heart rate is varying since your simulated signal does not have a variable frequency.
First you must decide how you are going to define the variation in heart rate. One method common in the field is to calculate every R-R interval and look at the variations from beat to beat. Depending on what data you acquire (EKG, pulse,...) and how you process it, even calculating the R-R intervals can be very difficult. For example ectopic beats have different waveforms from normal sinus beats so that determining the precise point of the differing waveforms to compare may be hard. If you want to use FFT methods (Spectral Measurements or Extract Single Tone Information), then you are typically looking at some time interval over which you will be measuring the rate. If the rate changes within that interval, then you get some kind of average. If the interval is too short, the measurements will not be very good because the FFT works best with three to five complete cycles or more of the waveforms. If the interval is too long, you miss any short term variations.
Once you define more clearly what you want to do, then it will be easier for someone to help you.
Lynn