06-29-2011 03:48 AM
Please How do I write a program that can accurately count the number of peaks in a wave form. see attached files please.
06-29-2011 04:35 AM - edited 06-29-2011 04:36 AM
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...
06-29-2011 05:18 AM
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.
06-29-2011 06:02 AM - edited 06-29-2011 06:03 AM
Why don't you filter your input signal ? You could avoid noises.
06-29-2011 06:08 AM
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
06-29-2011 06:15 AM
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,
06-29-2011 07:50 AM
There is a built in function in LabVIEW that allows for this and you do not need a filter to do it.
You can find this vi here:
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.
06-29-2011 07:55 AM
Thanks Tim,
Here is the data I am trying to use
06-29-2011 08:13 AM
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.
06-29-2011 02:22 PM
That wasnt actually the real waveform but the boolean based on the threshold I used. But your suggestion works. Thanks