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 Every Peak Value Sine Wave

Hi 

 

I have a sine wave that has an average peak to peak value of 1.2V. The sine wave has a dc offset of around 2.5V. Each cycle in the sine wave varies in width. 

 

I can feed the signal into the express vi to tell me the maximum Positive pulse peak value and minimum negative peak value. 

 

Unfortunatly i would like to measure the Maximum and Minimum Positive Pulse Peak value and Maximum and Minimum negative peak values. 

Im a little bit lost on how to do this. 

 

the frequency of the signal is around 10-20 hz. 

 

If i could get the Postivie peak value for every cycle and negative peak value of every cycles stored in two seperate 1d Array i could then search the 1d array for maximum and minimum. Problem is i am unsure how to find each indiviaul peak value. 

 

i have attached my code. I am using at 9229 to monitor the signal. I am sampling at 10000 samples per second and recording about 2 seconds of data.

 

Thanks 

0 Kudos
Message 1 of 6
(4,665 Views)

any ideas anyone

0 Kudos
Message 2 of 6
(4,636 Views)

I think the Peak Detector VI will do most of what you want. In the attached VI I simulated your signal with the sum of a sine and a ramp to create a series of waves with peaks and valleys at different amplitudes.  For this simple example I used the offset as the threshold. Depedning on the behavior of your signal, you may need to use a more sophisticated method to find a suitable threshold, possibly using different thresholds for different segments of the signal.

 

Lynn

0 Kudos
Message 3 of 6
(4,620 Views)

I tried using the you put into the VI and unfortunatly it doesnt work. Im using a 20hz sine wave. I have set my threshold to be the dc offset of the signal so around 2.5V but this changes by around 20mv each time. 

 

I have uses an Max and Min array function. It chucks out the highes Peak amplitude but the lowest peak amplitude is incorrect. It counts that there is over 2000 pulses, but that is impossible as there is only 20 high pulses. 

 

Any more ideas or help would be great. 

 

 

 

0 Kudos
Message 4 of 6
(4,585 Views)

Hi JWinstanley,

 

Have you tried using the peak detect function on LabVIEW? 

 

Here is a link explaining a few of the functions.

 

http://www.ni.com/white-paper/3770/en/

 

I hope this helps,

 

Jinfone
Applications Engineer
National Instruments
0 Kudos
Message 5 of 6
(4,567 Views)

Ive been able to sort it. with the help of a guy at my work i figured out how many bits of data per cycle. Used two for loops to then look at min and maximum values per 986 bits of data. this then gave me maximum and minium pulse amplitude per cycle. this then got put into a 1d array. 

 

Thanks for your help 

0 Kudos
Message 6 of 6
(4,562 Views)