# LabVIEW

cancel
Showing results 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?

Angel
Message 1 of 4
(1,832 Views)

## Re: Measure the period of a iregular wave

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
Message 2 of 4
(1,826 Views)

## Re: Measure the period of a iregular wave

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.
Message 3 of 4
(1,792 Views)

## Re: Measure the period of a iregular wave

Hi again,

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