I have the following integral
$$\int_{-\infty}^{\infty} g(t-\tau) \, \mathrm d\tau$$
where $g(\cdot)$ is a known function, e.g., $g(t) = \sin(t)$, and I want to evaluate its value with MATLAB. How should I do this in discrete form? Thanks.
I have the following integral
$$\int_{-\infty}^{\infty} g(t-\tau) \, \mathrm d\tau$$
where $g(\cdot)$ is a known function, e.g., $g(t) = \sin(t)$, and I want to evaluate its value with MATLAB. How should I do this in discrete form? Thanks.
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