Numericaly computing an integral in MATLAB
Use integral function.

q = integral(g,xmin,xmax)


For example $g(t) = e^{-t}$

$$q = \int_0^{\infty}e^{-t}\mathrm{d}t = 1$$

g = @(t) exp(-t);
q = integral(g,0,Inf)


More information
Matlab numerical integration