How to Calculate the Area Between Two Curves

To calculate the area between two curves in DataGraph, you can use the same techniques for calculating the area under a curve. Specifically, the total integral is determined using the Expression variable and the cumulative integral is determined using the Plot Action column.

Total Area

Here is an example dataset to illustrate.

Here is a plot of the two lines. The computed area between the two lines should be equal to 2.

Add an Expression variable as described in How to calculate the area under a curve. This time add the total integral of each column and give them different names (in this example ‘a’ and ‘b’). In the Value field, subtract the integrals to get the integral between.

Here is what the variable will look like. In this example, the value for Area equals 2.

Cumulative Integral

To calculate a cumulative integral, start by calculating the difference between the two columns, using an Expression column.

Add a Plot action column and set y to the computed difference.

Related Articles