INTEG

Purpose:

Calculates the integral of a series using Simpsonís rule.

Syntax:

INTEG(series)

series

-

An interval or XY series, the series to integrate.

Returns:

A series or table.

Example:

W1: gsin(1000,.001)

W2: integ(w1)

W3: (1 - cos(2*pi*xvals(w1)))/(2*pi)

W4: w2 - w3

 

image\integpic.gif

 

W2 contains the integral of the 1 Hertz sinewave in W1 over one period. The value of each point in W2 is the definite integral of W1 up to the corresponding point in W1. W4 displays the difference between the calculated integration and the analytical result in W3.

 

The value of this integral can be solved analytically. In general:

 

image\integ01.gif

 

For the specific case, we have:

 

image\integ02.gif

 

For t0 = 0 and f = 1:

 

image\integ03.gif

 

This result is displayed in W3 and the Simpsonís rule approximation is displayed in W2.

Example:

y1 = gnorm(1000, .001);

a1 = integ(y1);

a2 = area(y1);

 

Series a1 contains the cumulative area of y1 and scalar a2 contains the value of the total area of y1. Note that a1[end] == a2, the last point of the cumulative area equals the total area.

Example:

W1: gsin(1000,.001)

W2: xy(xvals(w1), yvals(w1))

W3: integ(w1)

W4: integ(w2)

W5: w3 - w4

 

W1 contains a 1 Hertz sinewave over one period as an interval series. W2 converts W1 into an XY series. The X values of W1 are implicit and can be constructed from the delta X value. The X values of W2 are explicit.

 

The definite integrals of each series are calculated and the differences are displayed in W5.

Remarks:

INTEG uses the composite Simpson's rule to compute the integral of evenly (interval series) or unevenly (XY series) spaced data. This method fits a quadratic polynomial to three points of the series and performs polynomial integration. In particular:

 

image\integ04.gif

 

where

 

image\integ05.gif

 

See CUMTRAPZ for an implementation of the trapezoidal rule.

 

See AREA to compute the total area.

 

See FINTEG for an implementation in the frequency domain.

 

The input series can be Real or Complex.

See Also:

AREA

CAREA

CUMTRAPZ

DERIV

FDERIV

FINTEG

LDERIV

PARTSUM

RDERIV

TRAPZ