LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

area under curve of an XY graph with constant non equi-distant x values and corresponding Y values which is dynamic and changing with time

I am trying to find the area under an XY graph. X and Y values are arrays connected to the XY graph.  The X values are the wavelength values which are constant but not equi-distant. The corresponding Y values are intensity values which are changing dynamically with time.  I have used numerical integration. Since numerical integration accepts only equi-distant x-values, I have converted the non equi-distant x- array to equi-distant x array. It is relatively easy since the x values are constant. I simply read it from a constant array. However, I could not determine the corresponding Y values of these equi-distant X values. This is necessary since the numeric integration vi gives correct integral value only if the Y array has equi-distant x values. How can I find the corresponding Y values (Y array) so that I can connect this to the numeric integration.vi. ? I have used polynomial interpolation.vi but it only gives one value and if I put a for loop around it to calculate the whole array, it takes a long time to find 2048 corresponding Y values. I also do not want to fit a polynomial curve to the original data because the nature of the curve changes with time. In short, my question is : how can I find the area under a curve with non equidistant x values?
 
Also if possible, is there a way to obtain the funtion of the curves created by X and Y arrays? X array is constant and has 2048 index values. Corresponding Y values are changing with time.
 
Thanks
 
Baris
0 Kudos
Message 1 of 4
(4,566 Views)

Sound like you need to do a piecewise integration. Find the area under the line between point 1 and point 2, between point 2 and point 3, between point 3 and point 4, and so on. Then sum all these results.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(4,555 Views)

Using the trapezoid method, the numerical integration is rather direct.
See the attached vi.

You can't get the function described by the X and Y arrays. You need to know the function from start ! However, you can always fit a function to the data. Polynomial curve fitting is quite popular. Of course this is something you could have done : fit a polynomial, then integrate it. With a large number of points (such as yours), the result will not be better than the trapezoid method.

Chilly Charly    (aka CC)
Message 3 of 4
(4,547 Views)
THanks a lot for the vi. It was really helpful.
0 Kudos
Message 4 of 4
(4,532 Views)