LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting peak values

Please How do I write a program that can accurately count the number of peaks in a wave form. see attached files please.

0 Kudos
Message 1 of 12
(2,737 Views)

Hi,

this is an example of counting ascending edges : the count is growing when actual value is 1 and previous is 0.

 

You just have to replace the 1D array command by the datas of your xls file.

 

Regards

 

P.S. : this is a snippet, you just have to drag and drop it into diagram to generate code if you have LV 2010...

V-F
0 Kudos
Message 2 of 12
(2,733 Views)

Thanks for the solution but there is an issue. The sensor I am using isn't given me a smooth wave form. I am using a threshold to Generate 1s and 0s so that if the waveform is rough, there might be a short spike in between and the program would erroneously count it. I am trying to get a program that can avoid this. 

0 Kudos
Message 3 of 12
(2,722 Views)

Why don't you filter your input signal ? You could avoid noises.

V-F
0 Kudos
Message 4 of 12
(2,717 Views)

How do I do it. The Excel spread sheet I attached is the input signal. There are short burst of 0 to 1 in between a long stream of 0s, or long streams of 1s

0 Kudos
Message 5 of 12
(2,714 Views)

Two options :

1) you use Labview vi's filters (search in Labview help how use a low filter)

2) make your own "filter" by modifiying my exemple : counting should be activated only if the peaks duration is greather than XX ms...

 

Regards,

V-F
0 Kudos
Message 6 of 12
(2,712 Views)

There is a built in function in LabVIEW that allows for this and you do not need a filter to do it.

 

Example_VI.png

 

You can find this vi here:

 

Untitled-1.png

 

If you send the array data to this vi and set the threshold and the width. then it would only count the long pulses and the small peaks would not be a problem. If you send so actual data we could do a better job of helping.

Tim
GHSP
0 Kudos
Message 7 of 12
(2,701 Views)

Thanks Tim,

Here is the data I am trying to use

0 Kudos
Message 8 of 12
(2,697 Views)

I thought you said that your real data was spikey? Using the data that you sent me this is how I would use what I showed you to get the result.

 

Example_VI.png

Tim
GHSP
0 Kudos
Message 9 of 12
(2,688 Views)

That wasnt actually the real waveform but the boolean based on the threshold I used. But your suggestion works. Thanks

0 Kudos
Message 10 of 12
(2,671 Views)