matlab integrate code example
Example 1: integral in matlab
fun = @(x) exp(-x.^2).*log(x).^2;
q = integral(fun,xmin,xmax)
Example 2: matlab integration
q = integral(fun,xmin,xmax)
q = integral(fun,xmin,xmax,Name,Value)
Description
q = integral(fun,xmin,xmax) numerically integrates function fun
from xmin to xmax using global adaptive quadrature and default error tolerances.
q = integral(fun,xmin,xmax,Name,Value) specifies additional options
with one or more Name,Value pair arguments.
For example, specify 'WayPoints' followed by a vector of real or complex
numbers to indicate specific points for the integrator to use.
Example1:
fun = @(x) exp(-x.^2).*log(x).^2;
q = integral(fun,0,Inf)
Example2:
TOL = eps;
fun = @(x) exp(-x.^2).*log(x).^2;
q = integral(fun,0,Inf, 'AbsTol', TOL)