## 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

**Area under curves**:

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

$$x1=y^2-1$$

$$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:

$$A=8/3.$$

**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

$$A=πf(x)^2$$

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}$$

**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:

- Simpson quadrature
- Lobatto quadrature
- Gauss-Kronrod quadrature

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

### Examples and How To

### Software Reference

#### Numerical Integration

#### Symbolic Integration

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