Path: Math/Integration
% Uses 2D Simpson's Rule to integrate an area. The area is rectangular with boundaries x = a to x = b an dy = c to y = d. The number of divisions is nX in x and nY in y. nX and nY should be odd. If they are even it will add one. The integrand is of the form integrand(a,b,c,d,varargin) Type TwoDSimpsonIntegration for a built-in demo for the integral of y.*sin(x)+x.*cos(y); from pi <= x <= 2pi and 0 <= y <= pi. rHS is a pointer. The function must be vectorized. -------------------------------------------------------------------------- Form: q = TwoDSimpsonIntegration( integrand, a, b, c, d, nX, nY, varargin ) -------------------------------------------------------------------------- ------ Inputs ------ integrand (1,1) Pointer to the integratnd a (1,1) Lower x limit b (1,1) Upper x limit c (1,1) Lower y limit d (1,1) Upper y limit nX (1,1) Number of divisions in x nY (1,1) Number of divisions in y varargin {} Passed to integrand ------- Outputs ------- q (1,1) Integral --------------------------------------------------------------------------
Common: Graphics/Plot2D Math: MathUtils/Odd
Back to the Math Module page