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

We appreciate your patience as we improve our online experience.

Life Science

Showing results for 
Search instead for 
Did you mean: 

Analysis of ECG signal

It should be the same.  Try putting your t0 and dt value into the properties of the graph (offset and mulitplier) and see if it looks OK.
Randall Pursley
0 Kudos
Message 21 of 32
2. Perform a Hilbert Transform of X to get Y

Randall Pursley

Hi Randall, can you explain better the function of the Hilbert Transform in your code ? I doens´t understood the step 2 above.

I apreciate any answer

Eduardo Alvarenga

0 Kudos
Message 22 of 32
The Hilbert Transform takes a signal (which, by definition, is made up of sinusoidal components) and changes the sines to cosines and vice versa.

The most basic case is if you input a cos(x), the output of the Hilbert transform is a sin(x).

Another way to explain it is if you look at your signal in the frequency domain, the Hilbert transfrom changes the sign of the spectrum on the negative side of 0 Hz.

The reason I use it here is to turn the ECG signal into an analytic signal using the Hilbert transform.  The magnitude of which is the envelope of your original signal.  The envelope of the signal gives a better peak that is easier to detect.

The most basic case is the cos(x).  The Hilbert transform result is a sin(x).  The analytic signal would be y=cos(x) + jsin(x).  And, of course, the magnitude of this would be one.

Hope this helps.  There is plenty of info on the web on Hilbert Transforms and analytic signals.
Randall Pursley
0 Kudos
Message 23 of 32
thanks Randall... this helps me a lot

0 Kudos
Message 24 of 32
can someone tel how  BPM is calculated in EKG am not able to
waiting for help
thanks in advance

Message Edited by iam on 03-18-2008 04:22 AM
0 Kudos
Message 25 of 32

Hi iam,

rpursley8 explains how to calculate the beats per minute in the first page of this discussion forum. Here is what it says about how the EKG calculates the BPM:

I have attached a VI that should do what you want if you have Labview 7.1 and Advanced Analysis Library.

If not, then this is what the VI does.

First you process the signal a little to enhance the R wave.

1. Take the derivative of the signal (difference function), name this signal X
2. Perform a Hilbert Transform of X to get Y
3. Combine to get Z = X + iY (complex) and take the magnitude of Z
4. This process will enhance the R wave amplitude in relation to the rest of the signal

Then you perform a peak detection to find all of the peaks and their locations.

Find the difference between the peaks to get the number of points between beats.

Divide this number by (Sampling Rate * 60) and invert the number to convert to beats/min.

The Advanced Analysis Library has the Derivative, Peak Detect, and Hilbert Transform functions used in the VI. I tried to save it as version 7.0 but it wouldn't let me.

If you have more specific questions about certain parts of the calculations, please let us know!



National Instruments
Applications Engineer
0 Kudos
Message 26 of 32

Instead of generating a ECG signal, can I use a real ECG signal-using same technique to calculate the Heart rate-Peak detection.

I substituted the to a DAQ Assistant and obtained a mismatch error. Can you please correct me...

I appreciate any help.
0 Kudos
Message 27 of 32

You can read the following app notes for more help on HRV detection and analysis.


0 Kudos
Message 28 of 32



I tried to compare the result of the beat per minute to constant number; To use the output and activate a case containing an alarm but since the output is array of Boolean there was an error in the wiring. Is there a way to compare the beat per minute and get a Boolean output?


I attached the VI

Thank you

0 Kudos
Message 29 of 32

Hi ziad,

I had provided an answer with image and code fix in your original post.

Please continue the discussion in the original thread and do not hijack other threads with a new topic.



Message Edited by JoeLabView on 06-22-2008 01:30 PM
0 Kudos
Message 30 of 32