From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

peak detectors width for ecg

Mcduff, I think my vi does the same thing as yours.. I tried to apply what you told me and this is what I get.. 

0 Kudos
Message 11 of 20
(1,024 Views)

Not sure what you are asking. Your frequencies are off from real values, because you have a dt of 1 in your data.

 

mcduff

0 Kudos
Message 12 of 20
(1,020 Views)

Mmm true... but I need that dt to show the location in time of the peaks! 

 

I'm confused now Smiley Frustrated

0 Kudos
Message 13 of 20
(1,016 Views)

So, do a conversion from a dt of 1 to the real dt. Then peaks will be in real time and you can convert.

0 Kudos
Message 14 of 20
(1,012 Views)

Did you figure it out yet? You can try adding this to your analysis.

 

Snap30.png

mcduff

0 Kudos
Message 15 of 20
(989 Views)

Hello mcduff, my code does the same as your analysis, my dt isn't 1 but 0.0006 (I checked it with an indicator). 

My problem seems to be that I'm not filtering in the right way.

Thank you for your interest!

0 Kudos
Message 16 of 20
(961 Views)

OK, I'm looking at the signal you are showing, which shows about 10k samples at 5.5, about 15k samples that have slow wave and 50 Hz negative pulses, and about 8k samples mostly near -5.  I'm "guessing" that you are using 50 Hz power (as opposed to my devices plugged into 60 Hz power) and that your acquisition system is unshielded or improperly grounded (you aren't recording "single-ended", are you?).  I'm also guessing that the relatively slow fluctuations (ignoring the negative pulses) are the signal you are trying to study.

 

Although I'm not an engineer, I learned at an early age that you want to start with as clean a signal (no "mains" noise, for example) as you can before you try to filter out "noise" (eliminating noise before you sample is always best).  For your signal, I would start by carefully examining the signal to see if my supposition that it is contaminated with a largely-negative narrow pulse at (almost exactly) 50 Hz.  Let me assume that this is true.  I would make the following recommendations:

  1. First, and most important -- try to eliminate the source of the noise.  Find an Electrical Engineer who understands "mains noise", shielding, and the difference between single-ended and differential recording modes.
  2. If you'd determined that the noise really does come from the mains, you want to eliminate it before you "acquire" it.  Learn about "anti-aliasing filters" that come before the acquisition system.  Choose an appropriate corner frequency, which will probably be <100 Hz.
  3. If you do choose to implement a post-acquisition digital filter, "think smart".  If your main "noise" is "mains noise", it will occur quite reliably at 20 msec (if 50 Hz mains) intervals.  You could take a 20 msec interval of data, compute the mean and S.D. of the data, and look for a region where the signal was consistently >3 SD from the mean -- this is your Noise Pulse.  Replace these data with the mean of, say, the 10 points before and 10 points after the pulse, or, perhaps even better, replace the entire 20 msec sample (of 320 points) with a single point consisting of the mean of all the points except those identified as "part of the noise peak".  This will appropriately low-pass (and "mains-noise-remove") your data.

I would hope you'd be able to write the code in Step 3 by yourself.  Do try -- if you get stuck, attach your entire VI and come back and show your efforts.  But it is most important that you do the first step of identifying (and, I hope, eliminating) the noise before trying a post-acquisition low-pass "decimating" filter (I call it that because it will replace you 35000-point record with 100-200 points).

 

Bob Schor

0 Kudos
Message 17 of 20
(956 Views)

@deuchi wrote:

Hello mcduff, my code does the same as your analysis, my dt isn't 1 but 0.0006 (I checked it with an indicator). 


If I use a dt of 0.0006 I get a ~5 Hz rate between beats, much too fast for a heart beat, but is this a simulation.

 

mcduff

0 Kudos
Message 18 of 20
(945 Views)

Bob_Schor, thank you for the detailed explanation. My signal,as you said, was very noisy and it was due to the circuit I was using. Now I have improved my circuit (and my code) which I'm attaching it here.

Is it ok the way the code is written? 

0 Kudos
Message 19 of 20
(937 Views)

Now I'm filtering with an analogical filter (Butterworth)... I actually wanted to use the digital filters, the IIR for example, but my knowledge about them isn't that big...   

0 Kudos
Message 20 of 20
(936 Views)