OriginLab Corporation - Scientific Graphing and Data Analysis Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis

Integrate


Description

This function performs numerically integration on the active data plot using the trapezoidal rule. Missing values are ignored. Moreover, the resulting area, peak location, peak width, and peak height (maximum deflection from the X axis), are written to the Result Log. In addition, this function supports integrating with a simple baseline which is a straight line crossing the end points.

To use this function:

  1. Create a new worksheet with input data.
  2. Highlight the selected data.
  3. Select Analysis: Mathematics: Integrate from the Origin menu to open the Integ1 dialog box.

The Integ1 X-Function is called to complete the calculation.

Dialog Options

Input

Specify the input data to be integrated.

Use End Points Straight Line as Baseline

Specify whether to create a straight line that crosses the end points and use it as the baseline for the integration.

Area Type

Specify the integral area type. Please see more details in the Algorithm part below.

  • Mathematical Area
    The area is the algebraic sum of trapezoids.
  • Absolute Area
    The area is sum of absolute trapezoid values.
Output

Specify the range of the cumulative result.

Plot Integral Curve

Specify whether to plot the integral curve, and where to plot the integral curve.

  • None
    Do not plot the integral curve.
  • New Graph
    Plot the integral to a new graph.
  • Source Graph
    Plot the integral to the source graph. This option is available when the source data is from the graph.
Rescale Source Graph

Specify whether to rescale the source graph when the integral is plotted into it. This check-box is available when the Plot Integral Curve is Source Graph.

Algorithm

The idea of numerically integrate is calculating a definite integral by an approximate function:

\int _{a}^{b}f(x)dx

Since the original data is discrete, we can use a pair of adjacent values to form a trapezoid for approximation:

Image:Integ.png

As illustrate above, the curve is divided into pieces and we can calculate the sum of each trapezoid to estimate the integral by:

\int _{x_1}^{x_n}f(x)dx \approx \sum _{i=1}^{n-1}( x_{i+1} -x_i) \frac{1}{2}[f(x_{i+1})+f(x_i)]

Given a baseline y=f(x_0 )\!, the mathematical area of f(x)\! can be calculated by

\int _{x_1}^{x_n} \left[f \left( x \right)-f \left( x_0 \right) \right] \,dx \approx \sum _{i=1}^{n-1} \frac{1}{2} \left( x_{i+1} -x_i \right) \left[ \left( f \left( x_{i+1} \right) -f \left( x_0 \right) \right) + \left( f \left( x_i \right) -f \left( x_0 \right) \right) \right]

If the sum of each trapezoid's area absolute value is computed, we can get the absolute area:

\int _{x_1}^{x_n} | \left[f \left( x \right)-f \left( x_0 \right) \right] | \,dx \approx \sum _{i=1}^{n-1} \frac{1}{2} \left( x_{i+1} -x_i \right) | \left[ \left( f \left( x_{i+1} \right) -f \left( x_0 \right) \right) + \left( f \left( x_i \right) -f \left( x_0 \right) \right) \right] |

Take the curve in the following graph for example.

Image:integ22.png

As illustrated above, the baseline is y=f(x_0 )\! and the curve is divided into five trapezoids (or triangles). The area of each trapezoid (or triangle) is calculated by

A_i = \frac{1}{2} \left( x_{i+1} -x_i \right) \left[ \left( f \left( x_{i+1} \right) -f \left( x_0 \right) \right) + \left( f \left( x_i \right) -f \left( x_0 \right) \right) \right]

From the expression, we can know that A_1\!, A_2\! and A_3\!, which are above the baseline, are positive, but A_4\! and A_5\!, which are beneath the baseline, are negative.

So the mathematical area of this curve should be A_1+A_2+A_3+A_4+A_5\! and the absolute area of this curve should be |A_1|+|A_2|+|A_3|+|A_4|+|A_5|=A_1+A_2+A_3-A_4-A_5\!.