03-12-2019 08:08 AM
Hello guys,
I'm new to labview (started working with it a week ago) and I managed to do a program which detects the peaks in a sinus wave, (it works very well, thanks to the advice I got here) in order to calculate the frequency (I'm doing a project for my university).
Now, I have to adapt this technique for ecg signal. I'm using the VirtualBench of NI, so the minimum sample rate I get is 15.26k, I use a sample rate of 16k and I'm taking the measurements in a window of 2s. So I tried to put a width of 8k, but it's not working very well... Sometimes the frequency goes to 3.. Any suggestion of how to adjust the width?
Any help is VERY appreciated!
03-12-2019 12:11 PM
Have you used a real oscilloscope? [I'm old enough to think that a "real" oscilloscope has a CRT where a moving electron beam "paints" the CRT with a "sweeping" beam whose Y position varies as the input "signal" voltage]. Almost all oscilloscopes are Digital, meaning there's (somewhere) a fast A/D converter and "software" that plays out the (vastly-over-sampled) signal at the rate you specify. So the "minimum sampling rate" of the Virtual Bench is more-or-less meaningless -- you are over-sampling, so you need to figure out how to see the signal on a time scale that makes sense to you. A simple thing to do would be a "poor-man's Low Pass Filter" -- sample at, say, 20kHz, take 200 points and average them (this takes 200/20k = 10 msec) and display it at an "effective" sampling rate of 100 Hz, probably reasonable for an EKG signal.
Doesn't the Virtual Bench "do this for you"? [I've seen it at shows, but never played with one -- I thought it would "act like" an oscilloscope emulator].
Bob Schor
03-13-2019 02:23 PM
Yes I've used the analogical oscilloscope, but in my case I have to work with the Virtual Bench because of my thesis... I acquire the signal from there and then take the measurements using my labview program.
I will try the filter to sample at a lower sample rate. Will this solution be ok in terms of memory? If I sample at a lower rate, will I have memory enough to take the measurements for like one hour?
The virtual bench actually oversamples and doesn't let me go lower than a circa 15k sample rate... and I'm having problems in the term of memory
Can you give me an idea what to do?
03-13-2019 03:11 PM
16k sampling means 16,000 samples in a second. Assume somebody has a pulse rate of 60 beats per minute, that is 1 beat per 16,000 samples that you acquired. If you take 32,000 samples then you should see 2 beats.
I am not a medical doctor, but I believe the ECG is a series of short pulses. Did you read the advice Henrik_Volkers gave you here
I quote
"The help file tell you to take not more than half width of the pulse,"
You set a width of 8k, which implies 0.5s. Is an ECG pulse really that wide, I thought it was much narrower. Have you tried adjusting the width, like Henrik suggested?
mcduff
03-13-2019 04:35 PM
Do you have an envelope? Turn it over and take out a pencil -- we're going to do a "back-of-the-envelope" calculation.
Bob Schor
03-13-2019 07:10 PM
03-13-2019 10:31 PM
Thank you, BlessedK. My only quibble is I think of myself as "calm", not "excited" ...
Bob Schor
03-14-2019 11:11 AM
Mcduff,
I read the advices several times, now I think I understand it better. I adjusted the width (to 4k, with my sample rate at 16k) and it works!
Bob_Schor, thank you so much for your detailed advice! I get the method that you suggested, but my question is wether the memory will support that kind of data, and maybe how to do the average in just taking one sample... (or maybe by doing the average my memory will not take the undeeded samples?)
03-14-2019 11:18 AM
I noticed that with a filter I can adjust the sample rate of the signal. I attached here the vi, you can see what my code looks like
03-14-2019 11:44 AM
You need to do some signal processing on your input to remove stuff/noise, low frequency drifts, etc. Here is an idea to try, not sure how well it works, but it may point you in the right/wrong direction.
mcduff