Main Content

Numerical Integration and Differentiation

Quadratures, double and triple integrals, and multidimensional derivatives

Numerical integration functions can approximate the value of an integral whether or not the functional expression is known:

  • When you know how to evaluate the function, you can useintegralto calculate integrals with specified bounds.

  • To integrate an array of data where the underlying equation is unknown, you can usetrapz, which performs trapezoidal integration using the data points to form a series of trapezoids with easily computed areas.

For differentiation, you can differentiate an array of data usinggradient, which uses a finite difference formula to calculate numerical derivatives. To calculate derivatives of functional expressions, you must use theSymbolic Math Toolbox™.

Functions

expand all

integral Numerical integration
integral2 Numerically evaluate double integral
integral3 Numerically evaluate triple integral
quadgk Numerically evaluate integral — Gauss-Kronrod quadrature
quad2d Numerically evaluate double integral — tiled method
cumtrapz Cumulative trapezoidal numerical integration
trapz Trapezoidal numerical integration
del2 Discrete Laplacian
diff Differences and approximate derivatives
gradient 数值梯度
polyint Polynomial integration
polyder Polynomial differentiation

Topics