%% Integral with Singularity at Endpoint
% Evaluate the integral
% q=\int_0^1 e^x \;\;\ln \left(x\right)\;\textrm{dx}\ldotp
% This integral has a singularity at the point x=0 because \ln \left(0\right) diverges to -\infty.
%
% Create an anonymous function for the integrand. The log function calculates \ln \left(x\right).

f = @(x) exp(x).*log(x);

%
% Integrate f from 0 to 1.

q = quadgk(f,0,1)

% Copyright 2019 The MathWorks, Inc.