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.


closed as unclear what you're asking by Peter K. Jun 17 '17 at 21:42

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ But in your example, $\int_{-\infty}^{\infty}\sin(t-\tau)d\tau$ does not exist. $\endgroup$ – msm Jun 16 '17 at 19:35

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


Not the answer you're looking for? Browse other questions tagged or ask your own question.