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: 

When I change the start and finish of the xscale of a plot, how do i acesss these numbers and then integrate the area under the curve?

Hi

I want to integrate the area under the curve using the changed start and finish values of a plot.

That is , for example, the plot starts from 2 -6 but I want to integrate from 4 -5. So I want to change the graph from 4-5 and then the integrated value comes up.

Thank you.
0 Kudos
Message 1 of 4
(2,286 Views)
For a start, you may implement a Riemann sum of the data.
0 Kudos
Message 2 of 4
(2,281 Views)
Hello adrianT,

You can use graph cursors to specify the start and end points on the graph, and then use Cursor List property node of the graph to programmatically detect the current X positions of the cursors. From this information you can get the subset of your array and integrate it (you can use Numeric Integration.vi for this).

Hope this helps and good luck with your application!

Shakhina P.
Applications Engineer
National Instruments
Message 3 of 4
(2,262 Views)
There are many ways to do this.

IF you really want to change the displayed x-range, you can get the current beginning and end with a property node of the graph using the properties (xscale-range-minimum and ...-maximum). If you are using custom scaling (offset, increment) you would need some simple math to get the indices for the desired subarray.


It is typically more intuitive to select the desired subrange with two cursors. Personally, I would go with Shahina's solution or similar. 🙂
(Instead of using property "cursor position X" you might want to read the "Cursor Index" property instead, it gives you directly the array index of the data point at the cursor position. Also ensure that your cursor is locked to your plot for this).
Message 4 of 4
(2,257 Views)