LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calculate area plot

Solved!
Go to solution

 Hello.
Who knows how to calculate the area under a curve bounded by two cursors?
I bring my non-working option. I went through the entire “integral” palette and nothing helped. There is no calculation.

integral.png

0 Kudos
Message 1 of 8
(4,201 Views)

Hello!

 

Try to add an indicator (or probe) to the blue indices. You probably want to use the threshold 1d function: https://zone.ni.com/reference/en-XX/help/371361R-01/glang/threshold_1d_array/

 

Then, add indicators to the X and Y array that You feed into the integration VI. I guess that their size is different, because you limit the X array but not the Y array. This might or might not be an error, depending on what You want to do here.

0 Kudos
Message 2 of 8
(4,185 Views)

I need to calculate the area under the curve in the selected area.
Example in the picture.

ОС-1Е 273_(405+950нм).png

0 Kudos
Message 3 of 8
(4,150 Views)

Have You tried the things I have written above? What was the result?

 

Next time, please attach the .vi file.

0 Kudos
Message 4 of 8
(4,143 Views)

Yes. I did as you said. Nothing succeeded. I tried the whole palette of the integral and also nothing.

It does not count correctly or in any way at all.
I found an example of how to calculate the integral, and built it into my VI.
Now everything is correct. I attach my VI. Maybe it will help to someone .

МКС-1 113_(950нм)_20200529_141821.jpg

0 Kudos
Message 5 of 8
(4,128 Views)

Hi Fizi,

 


@Fizikaman wrote:

Yes. I did as you said. Nothing succeeded. I tried the whole palette of the integral and also nothing.

It does not count correctly or in any way at all.
I found an example of how to calculate the integral, and built it into my VI.
Now everything is correct. I attach my VI. Maybe it will help to someone .


What about this:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(4,092 Views)
Solution
Accepted by Fizikaman

I usually use locked to plot cursors and then use the cursor index to get the correct subset. Here's a quick example:

 

altenbach_0-1590773890727.png

 

 

Personally, I would probably resample the input into a linear X axis with a reasonable sampling interval, then use the plain integration tools (not shown). Then you can just integrate the entire dataset and take the difference of the integral between two different indices to get the integral of the subset. (not shown)

0 Kudos
Message 7 of 8
(4,082 Views)

Thanks to everyone. I think this topic will help many people.

0 Kudos
Message 8 of 8
(4,029 Views)