04-29-2019 04:10 PM
Thank you for the offer to help on the circuit but I was referring to the VI. Our circuit works perfectly. The beats per minute portion of my VI is not accurate with the tone measurement. I asked the professor for help and he suggested using the spectral analysis to get an array of data then look for the peaks of that array. I tried that. attached is what I have so far with that.
04-29-2019 04:14 PM
There's something I don't understand here. You say that you know what the EKG signal looks like, but then seem to be modeling it by "running a signal generator on triangle wave" and "it works". Do you think a triangle wave is a good model for an EKG signal? Please run your EKG_4 routine with the EKG hooked up to one of your team members (could be yourself) and post it here -- maybe this is the source of your problem! [Some of us will be able to recognize an EKG ...] In four seconds, you should be able to get a few heartbeats ...
Incidentally, do you know IBM's Famous Slogan? (You could look it up ...)
Bob Schor
04-29-2019 04:19 PM
Hmm... I had to google "IBM Famous Slogan" too
04-29-2019 05:47 PM
Per request.
04-29-2019 07:50 PM
You have posted several versions of your code and one image of the data displayed on the front panel. Unfortunately, we cannot combine the two to see how the data is processed by your code. Please perform the following steps.
1. Run the VI
2. Select Edit -> Make Current Values Default
3. Save the VI
4. Attach the updated VI
Once you have saved the data inside the chart, we could easily run the last block of data through your analysis code. We could then suggest specific changes or tweaks to improve your results.
The peak detector should provide the best detection of your waveform. The output is in samples/peak and would have to converted to peaks/minute.
04-29-2019 10:04 PM
@Brad750 wrote:
Per request.
Wow! Look at that plot! Nine peaks, values much larger than anything else, data that stick way up there, a few points that are way above 95%, maybe 99% of the rest of the data. Hmm, where have I heard values like 95%, or like 99%? Let's employ the Famous IBM Slogan and see if we make any progress in solving this (fairly simple, if you stop and IBM about it ...).
Bob Schor
04-29-2019 10:17 PM - edited 04-29-2019 10:18 PM
Bob
What on earth are you taking about. I’m well aware that the peaks have a higher amplitude. That’s why I used the peak detector vi. But the damn thing is so inaccurate the values it outputs are all over the place. Sometimes they’re right at 70bpm and sometimes it says 25346 or some other arbitrary number.
Did you come here to ridicule me or help?
04-29-2019 10:51 PM
Well, there is not much help to give until you post a VI where you have the raw data saved.
At least now you are giving a big of a clue as to what is going wrong when you say it is a crazy number like 25346. However the last VI you posted EKG6 doesn't show how it could be coming to such a crazy number.
04-30-2019 06:51 AM
Well, I tried to give a "hint" by talking about 95%. Have you ever learned about Probability or Statistics, and encountered the phrase "95%", maybe with the word "confidence" near it? Honestly, if you employ the Famous IBM Slogan and just look at your data, you might realize that you can reduce the problem to the very simple one of asking "in this subset of points, which one is the maximum" (and, yes, There's a LabVIEW Function for That). No Express VI, no Peak Detector, no FFT, Frequency Analysis, etc.
Bob Schor
04-30-2019 08:17 AM - edited 04-30-2019 08:18 AM
So to recap:
I would probably have used the Waveform Peak Detection for this, with an appropriate threshold value and width.
Dr. Schor's post about avoiding peak detectors makes wonder what better methods might be available. I'd consider whether just a boolean comparison with scalar value and then checking for number of changes in the boolean value within the array is a better method (probably susceptible to noise at the threshold value, but that'd be true for the Waveform Peak Detection VI too...). Finding the indices of local maxima is simple, but I can't work out how to do it (simply) without a suitably set window size (which requires some pre-knowledge about the expected BPM value) and then repeating the check for maxima (since as far as I know, you'd need multiple indices).