Calculates the integral of a series using Simpson’s rule.
INTEG(series)
series |
- |
An interval or XY series, the series to integrate. |
A series or table.
W1: gsin(1000,.001)
W2: integ(w1)
W3: (1 - cos(2*pi*xvals(w1)))/(2*pi)
W4: w2 - w3
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:
For the specific case, we have:
For t0 = 0 and f = 1:
This result is displayed in W3 and the Simpson’s rule approximation is displayed in W2.
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.
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.
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:
where
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.