4
$\begingroup$

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.

$\endgroup$
  • 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
6
$\begingroup$

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

| improve this answer | |
$\endgroup$

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