LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Calculus to help find peaks on a sine wave?

Ricky,

 

The data in that file seems to lack resolution. There are multiple readings for each x value. Is your raw data collected that way or was it a result of the way it was saved to the file?

 

The Peak Detector seems to work well with the width greater than ~30. Looking at the points used to find the peak shows only two or three distinct amplitude values at the peak.

 

The attached VI shows what I have tried. The all rows array contains the data from the file you posted so that the VI does not need to read the file every time.

 

Lynn

Message 11 of 15
(881 Views)

My apologies - the angles exported as integers... I replaced them with what they should be about (increments of 0.072 degrees) and attached the file. I have not used the amplitude part of the Peak Detector yet, just the locations. I have gotten it to recognize every peak using a width of 20 so far with no false peaks, and I have been able to use the location (as an integer) to find the angle that was assigned to the readings on the peak. 

0 Kudos
Message 12 of 15
(857 Views)

With the revised data I still find that I need a width of >=30 to reliably get all the peaks. There are several smaller values (7, 13, 16, 21, 29) which return 6 peaks but I would not trust that they would work for the next data set.

 

Lynn

0 Kudos
Message 13 of 15
(818 Views)

If the frequency is not changing too fast.... well, ... the min max have a regular periode

capture enough points to get at least 2 to 5 periodes

use tone detection to get the main frequence (main = dominat, maybe you will also get the main (line) frequency 😉 )

with the dominant frequency and the samplerate calc the points per half periode

apply that point value to the find peaks vi.  The find peak vi will adapt a quadratic fit to locate the peak position and max value (using the number of points specified) so it's quite robust to noise.

do the same to get the minima. 

 

If you only have one min/max per revolution, turn multiple times ( 😉 ) or have a look at the Savitsky-Golay filter as Lynn already mentioned.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 14 of 15
(783 Views)

Thank you, I will use a width of 30 from now on and see how it goes. Thank you all so much for your advice, it has helped me get so much farther Have a great day! -Ricky

0 Kudos
Message 15 of 15
(763 Views)