From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Measure the period of a iregular wave

I want to measure the time that one wave is above one certain level. I have a Electrocardiogram signal that is not alwalys the same shape, so I can not measure the period as a common signal.

Anybody knows how I could solve the problem that I have. is there any tool in Labview to do this?

Thank you for your help

Angel
0 Kudos
Message 1 of 4
(2,343 Views)
How about the following method?

Step 1. Remove the DC first.
Step 2. Compute the power spectrum of the signal using FFT Power Spectrum VI.
Step 3. Detect the peak in the power spectrum.
Step 4. The reciprocal of the peak location is the period of the signal.

If your signal has single tone frequency, this method should work.


Good luck
0 Kudos
Message 2 of 4
(2,337 Views)
Hi angelito,

I haven´t found any example either on web page or through the help of Labview and for this reason I´ve been analyzed your question and let me split your application in two parts:

1) Calculate when your wave is crossing the threshold (that you have determinated in a preview stage)

2) Calculate the subtract between two cross points and then to multiplicate for the time between samples

1) I attach a VI and as you can see, firstly I generated a triangle sine (you have to change for your signal), when the signal is within for loop, this signal is compared with the threshold and if the signal has crossed the threshold (either rising or falling) the application builds an array, and it shows you in each element of the array, the moment when your wave crossed the threshold.

2)Now with this array you´ll have to program a VI to calculate the substract of each element of the array and multiplicate for the time between samples of your wave (1/Fs). where Fs is sampling frequency of your signal

Moreover you may find some examples under the Help of Labview and type "Peak" and you´ll see an example called "Peak detection and display.vi" and under "Signal Source" field you can choose "EKG". Basically, this option detects the peaks and valleys of the signal

I hope this helps you

Regards

Diego M.
0 Kudos
Message 3 of 4
(2,303 Views)
Hi again,

I have attached other vis and I´ve added the elapsed time between each two cross points.

Please, take a look and I hope this vi can help you.

Regards.

Diego M.
0 Kudos
Message 4 of 4
(2,289 Views)