Learn to solve definite
integrals with a numerical software
calculate integrals with Matlab
or numerical methods, a numerical integration can be performed by a
algorithms that calculate the approximate value of definite integrals.
evaluation of the integral is
called quadrature. The
term ‘numerical quadrature’ is more or less a synonym for numerical
integration, especially if applied to one-dimensional integrals.
going to focus this time on the calculation of definite integrals using
Matlab already built-in functions.
can evaluate definite integrals
a number of reasons for carrying out numerical integration. The
may be known only at certain points, such as obtained by sampling. Some
systems and other computer applications may need integral calculus for
formula for the integrand could be known, but it may be difficult or
to find an analytical integral.
be possible to find an antiderivative, but it may be easier to compute
numerical approximation. That may be the case if the exact integral is
an infinite series, or if its evaluation requires a special function
provides the following built-in functions for numerical integration:
adaptive Simpson quadrature.
form: q = quad(FUN, A, B), which tries to approximate the integral of
scalar-valued function FUN from A to B to within an error of 1 x 10-6
using recursive adaptive Simpson quadrature. The function Y = f(X) should accept a vector argument X and return a vector result Y, the integrand evaluated at each
element of X.
Uses adaptive Lobatto quadrature.
form: q = quadl(FUN, A, B), which tries to approximate the integral
order recursive adaptive quadrature.
work on some examples and learn a little bit about intgral calculus...
Gaussian integral (aka Euler-Poisson integral or Poisson integral) is
integral of the Gaussian function over the entire real numbers.
the result is exact for a known interval, let’s use this function as a
let’s plot it to see what we’re doing. We cannot go from -infinity to
but we can use a more reasonable interval.
x = -7 :
.1 : 7;
see that if we integrate in the interval [-8, 8] we can get a very good
We don’t have to go beyond that.
define a separate function for the integrand, and use its name within
function. In this case, the expression is simple and we’re going to use
directly as an argument to the quadrature
quad('exp(-x.^2)', -8, 8)
quad('exp(-x.^2)', -20, 20)
the second answer is better than the first one (according to sqrt(pi)), due to the longer interval,
even the first answer is correct to 5 digits.
type help quad
or help quadl
on your Matlab command window to see a full description
of the usage and examples of the functions.
evaluate definite integrals of the form
the function dblquad. The basic syntax for double integration is:
dblquad(‘fxy_fun’, x_min, x_max, y_min, y_max)
compute the following double integral
dblquad(f, 11, 14, 7, 10)
result is 1719
Integrals' to 'Calculus Problems'