LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

integrate area under multiple curves

I have a VI that will detect peaks (centroid) and their amplitudes from waveform data. I would like to also integrate the areas under each peak. I used the trigger/gate vi and the numeric integration vi to integrate the area under the first peak, but cannot get integration of later peaks. I am also wondering why I get the message: NaN when I try to use Simpson's integration rule (I am using trapezoid rule). The VI "read voltage make table" is attached.
0 Kudos
Message 1 of 2
(2,769 Views)
I took a quick look at your VI. The reason you are only integrating the first peak is that the Trigger and Gate Express VI only triggers once. You need to put you data into a loop with a shift register and extract the section containing each peak. Then integrate each section separately (possibly in the same loop).

I like to put the data acquisition and data processing (peak detection and integration) in separate, parallel loops. This can help avoid missed data and is easier to maintain. Look at the examples for State Machines.

NaN often comes from dividing by zero. I do not recall the Simpson's rule algorithm, but if your data can have vertical segments you might see an infinite slope which could produce a divide by zero error.

Lynn
0 Kudos
Message 2 of 2
(2,761 Views)