Calculate numeric and symbolic integrals

An integral is a mathematical measure that combines infinitesimal data points. Integrals have a broad range of applications in all engineering disciplines.

Types of Integrals

In general, integrals can be either definite or indefinite. Definite integrals represent functions with bounded upper and lower limits, whereas indefinite Integrals represent functions without limits.

The following example shows an indefinite integral:

$$I= \int3x^2 dx=x^3+c$$

where ‘c’ is a constant.

A definite integral for the same equation must have defined limits. For example, we can integrate the above equation with limits [-2, 2] as follows:

$$I= \int_{-2}^2 3x^2 dx=(2^3+c)-(-2^3+c)=16$$

You can use MATLAB® and Symbolic Math Toolbox™ to calculate integrals numerically and symbolically.

Examples of Integral Applications

  1. Area under curves:

You can calculate the area under two curves using integrals. For example, we define two curves,


$$x2=1- y^2$$

and calculate the area under the curves as follows:

$$A=∫(x2-x1) dy=\frac{(-2y(y^2-3))}{3}$$

The area under the curve\('A’\) here is a function of \('y’\) because we did not specify limits. If we define the limits as \([-1, 1]\), the integral returns a value of:


  1. Volume of objects:

You can use integrals to calculate the volume of objects. For example, you can derive the volume of a sphere by starting with a function:

$$f(x)=√(r^2-x^2 )$$

which depicts a semi-circle with radius ‘r.’ Rotating this semi-circle around the x-axis would yield a sphere.

The area of the semi-circle would be


Integrating this area with limits [-r, +r] would give us the volume of the sphere:

$$V= ∫_{-r}^{+r} A dx=\frac{(4πr^3)}{3}$$

  1. Velocity of a moving object:

You can find the velocity of an object by finding the definite integral of the object’s acceleration with respect to time, because acceleration is simply defined as the rate of change of velocity over time.

$$∆Vel= ∫Acc \; dt$$

Techniques to Calculate Integrals

You can calculate integrals numerically using techniques such as:

  1. Simpson quadrature
  2. Lobatto quadrature
  3. Gauss-Kronrod quadrature

For more information on the numeric and symbolic calculations of integrals, see MATLAB® and Symbolic Math Toolbox™.

See also: analytical solution, mathematical modeling, computer algebra system, dimensional analysis, inverse kinematics