I want to compute the following type of integrals in Matlab.

It is the integral of function e^-(u)*u and the boundaries are zero and infinity. This integral should return 1.
How can I do this in Matlab?
And if you don't have the symbolic toolbox, or want more speed, quadgk
supports infinite limits:
f = @(x) x.*exp(-x);
a = quadgk(f, 0, inf)
a =
1.000000000000000e+00
syms u
int(exp(-u)*u, u, 0, inf)
来源:https://stackoverflow.com/questions/11839394/infinite-integration-with-matlab