%% Singularity at Lower Limit
% Create the function f(x) = \ln(x).

fun = @(x)log(x);

%
% Evaluate the integral from x=0 to x=1 with the default error tolerances.

format long
q1 = integral(fun,0,1)

%
% Evaluate the integral again, this time with 12 decimal places of accuracy. Set RelTol to zero so that integral only attempts to satisfy the absolute error tolerance.

q2 = integral(fun,0,1,'RelTol',0,'AbsTol',1e-12)

% Copyright 2012 The MathWorks, Inc.